SCL  1.0
Standard Control Library : Control, dynamics, physics, and simulation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
scl::CTrajectoryGenerator< task_dof_ > Class Template Reference

#include <CTrajectoryGenerator.hpp>

Collaboration diagram for scl::CTrajectoryGenerator< task_dof_ >:
Collaboration graph
[legend]

Public Member Functions

virtual sBool initTraj (const sFloat arg_cycle_time, const Eigen::Matrix< sFloat, task_dof_, 1 > &arg_max_pos, const Eigen::Matrix< sFloat, task_dof_, 1 > &arg_max_vel, const Eigen::Matrix< sFloat, task_dof_, 1 > &arg_max_acc, const Eigen::Matrix< sFloat, task_dof_, 1 > &arg_min_pos, const Eigen::Matrix< sFloat, task_dof_, 1 > &arg_min_vel, const Eigen::Matrix< sFloat, task_dof_, 1 > &arg_min_acc)
 
virtual sBool setTrajFromTxtFile (const std::string &arg_file, const sLongLong arg_traj_slices, const sBool arg_has_time=true)
 
virtual sBool setTrajFromFunc (sFloat(*arg_func)(sFloat), const sLongLong arg_traj_slices, const sFloat arg_time_per_slice, const Eigen::Matrix< sFloat, task_dof_, 1 > &arg_pos_start, const Eigen::Matrix< sFloat, task_dof_, 1 > &arg_scale, const Eigen::Matrix< sFloat, task_dof_, 1 > &arg_stagger)
 
virtual sBool getCurrGoal (Eigen::Matrix< sFloat, task_dof_, 1 > &arg_pos_curr, Eigen::Matrix< sFloat, task_dof_, 1 > &arg_vel_curr, Eigen::Matrix< sFloat, task_dof_, 1 > &arg_acc_curr)
 
virtual sBool saveCurrState (const Eigen::Matrix< sFloat, task_dof_, 1 > &arg_state, const sFloat arg_time)
 
virtual sBool getLoggedPositions (sutil::CMappedList< sFloat, Eigen::Matrix< sFloat, task_dof_, 1 > > &ret_traj)
 

Protected Attributes

sutil::CMappedList< sFloat,
Eigen::Matrix< sFloat,
task_dof_, 1 > > 
traj_desired_
 
sutil::CMappedList< sFloat,
Eigen::Matrix< sFloat,
task_dof_, 1 > > 
traj_achieved_
 
Eigen::Matrix< sFloat,
task_dof_, 1 > * 
traj_curr_pos_
 
Eigen::Matrix< sFloat,
task_dof_, 1 > 
traj_curr_vel_
 
Eigen::Matrix< sFloat,
task_dof_, 1 > 
traj_curr_acc_
 
sFloat traj_curr_time_
 
sLongLong traj_curr_idx_
 
Eigen::Matrix< sFloat,
task_dof_, 1 > 
max_pos_
 
Eigen::Matrix< sFloat,
task_dof_, 1 > 
max_vel_
 
Eigen::Matrix< sFloat,
task_dof_, 1 > 
max_acc_
 
Eigen::Matrix< sFloat,
task_dof_, 1 > 
min_pos_
 
Eigen::Matrix< sFloat,
task_dof_, 1 > 
min_vel_
 
Eigen::Matrix< sFloat,
task_dof_, 1 > 
min_acc_
 
TypeIOTG otg_
 
sBool traj_has_been_init_
 

Detailed Description

template<sUInt task_dof_>
class scl::CTrajectoryGenerator< task_dof_ >

A base class for trajectory tracking tasks. Reads a trajectory from file or generates trajectories on the fly.

Use this to build trajectory controllers.

Member Function Documentation

template<sUInt task_dof_>
sBool scl::CTrajectoryGenerator< task_dof_ >::getCurrGoal ( Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_pos_curr,
Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_vel_curr,
Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_acc_curr 
)
virtual

Generates an arbitrary function based trajectory along all the dofs.

Verifies whether the trajectory is achievable. Returns false if there is no current goal (ie. traj is over).

template<sUInt task_dof_>
virtual sBool scl::CTrajectoryGenerator< task_dof_ >::getLoggedPositions ( sutil::CMappedList< sFloat, Eigen::Matrix< sFloat, task_dof_, 1 > > &  ret_traj)
virtual

Returns the stored trajectory so far in a mapped list indexed by the time at which the config was logged. Returns false if nothing has been logged yet.

template<sUInt task_dof_>
sBool scl::CTrajectoryGenerator< task_dof_ >::initTraj ( const sFloat  arg_cycle_time,
const Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_max_pos,
const Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_max_vel,
const Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_max_acc,
const Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_min_pos,
const Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_min_vel,
const Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_min_acc 
)
virtual

Initializes the trajectory related parameters

Parameters
arg_cycle_timeThe cycle time of the control loop
arg_max_posThe current position along the task's directions
arg_max_velThe maximum velocity along the task's directions
arg_max_accThe maximum acceleration along the task's directions
arg_min_posThe minimum position along the task's directions
arg_min_velThe minimum velocity along the task's directions
arg_min_accThe minimum acceleration along the task's directions
template<sUInt task_dof_>
sBool scl::CTrajectoryGenerator< task_dof_ >::saveCurrState ( const Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_state,
const sFloat  arg_time 
)
virtual

Logs a step in the trajectory. Takes the passed configuration and stores it in the achieved trajectory, indexed by a timestamp.

Parameters
arg_stateThe present config measured by the sensors
arg_timeThe present time
template<sUInt task_dof_>
sBool scl::CTrajectoryGenerator< task_dof_ >::setTrajFromFunc ( sFloat(*)(sFloat arg_func,
const sLongLong  arg_traj_slices,
const sFloat  arg_time_per_slice,
const Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_pos_start,
const Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_scale,
const Eigen::Matrix< sFloat, task_dof_, 1 > &  arg_stagger 
)
virtual

Generates an arbitrary function based trajectory along all the dofs.

Verifies whether the trajectory is achievable. Returns false if the trajectory is impossible to achieve.

Parameters
arg_traj_slicesThe number of time slices of the required trajectory
arg_time_per_sliceThe time in which each trajectory slice should be achieved
arg_pos_startThe starting position along the task's directions
arg_scaleScales each successive dof by this value. Ie. dof_i = sin(t)*arg_scale(i);
arg_staggerStaggers each successive dof by this value. Ie. dof_i = sin(t)+arg_stagger(i);
template<sUInt task_dof_>
sBool scl::CTrajectoryGenerator< task_dof_ >::setTrajFromTxtFile ( const std::string &  arg_file,
const sLongLong  arg_traj_slices,
const sBool  arg_has_time = true 
)
virtual

Reads a trajectory and checks the trajectory for errors:

  1. Whether the trajectory dimensions match the task's dofs
  2. Whether the trajectory has a time field

Assumes : A trajectory in a text file. One time slice per line.

Parameters
arg_fileThe file to read in a trajectory from
arg_traj_slicesThe number of time slices (waypoints) along the trajectory
arg_has_timeIs the first collumn of the trajectory time?

Member Data Documentation

template<sUInt task_dof_>
sutil::CMappedList<sFloat, Eigen::Matrix<sFloat,task_dof_,1> > scl::CTrajectoryGenerator< task_dof_ >::traj_achieved_
protected

The achieved trajectory, indexed by time

template<sUInt task_dof_>
Eigen::Matrix< sFloat, task_dof_, 1 > scl::CTrajectoryGenerator< task_dof_ >::traj_curr_acc_
protected

The current trajectory acceleration. Computed on the fly.

template<sUInt task_dof_>
sLongLong scl::CTrajectoryGenerator< task_dof_ >::traj_curr_idx_
protected

The current trajectory index

template<sUInt task_dof_>
Eigen::Matrix< sFloat, task_dof_, 1 > * scl::CTrajectoryGenerator< task_dof_ >::traj_curr_pos_
protected

The current trajectory position. Index into mapped list.

template<sUInt task_dof_>
sFloat scl::CTrajectoryGenerator< task_dof_ >::traj_curr_time_
protected

The current trajectory time

template<sUInt task_dof_>
Eigen::Matrix< sFloat, task_dof_, 1 > scl::CTrajectoryGenerator< task_dof_ >::traj_curr_vel_
protected

The current trajectory velocity. Computed on the fly.

template<sUInt task_dof_>
sutil::CMappedList<sFloat, Eigen::Matrix<sFloat,task_dof_,1> > scl::CTrajectoryGenerator< task_dof_ >::traj_desired_
protected

The desired trajectory, indexed by time or numerical index


The documentation for this class was generated from the following file: