sot-torque-control  1.6.3
Collection of dynamic-graph entities aimed at implementing torque control on different robots.
JointTrajectoryGenerator Class Reference

#include <sot/torque_control/joint-trajectory-generator.hh>

Inheritance diagram for JointTrajectoryGenerator:
Collaboration diagram for JointTrajectoryGenerator:

Public Member Functions

 JointTrajectoryGenerator (const std::string &name)
 
 DECLARE_SIGNAL (fRightFoot, OUT, dynamicgraph::Vector)
 
 DECLARE_SIGNAL (fLeftFoot, OUT, dynamicgraph::Vector)
 
 DECLARE_SIGNAL (fRightHand, OUT, dynamicgraph::Vector)
 
 DECLARE_SIGNAL (fLeftHand, OUT, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_IN (base6d_encoders, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_OUT (q, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_OUT (dq, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_OUT (ddq, dynamicgraph::Vector)
 
virtual void display (std::ostream &os) const
 
void getJoint (const std::string &jointName)
 
void init (const double &dt, const std::string &robotRef)
 
bool isTrajectoryEnded ()
 
void moveForce (const std::string &forceName, const int &axis, const double &fFinal, const double &time)
 
void moveJoint (const std::string &jointName, const double &qFinal, const double &time)
 
void playTrajectoryFile (const std::string &fileName)
 
void sendMsg (const std::string &msg, MsgType t=MSG_TYPE_INFO, const char *="", int=0)
 
void startConstAcc (const std::string &jointName, const double &qFinal, const double &time)
 
void startForceLinearChirp (const std::string &forceName, const int &axis, const double &fFinal, const double &f0, const double &f1, const double &time)
 
void startForceSinusoid (const std::string &forceName, const int &axis, const double &fFinal, const double &time)
 
void startLinearChirp (const std::string &jointName, const double &qFinal, const double &f0, const double &f1, const double &time)
 
void startSinusoid (const std::string &jointName, const double &qFinal, const double &time)
 
void startTriangle (const std::string &jointName, const double &qFinal, const double &time, const double &Tacc)
 
void stop (const std::string &jointName)
 
void stopForce (const std::string &forceName)
 

Protected Types

enum  JTG_Status {
  JTG_STOP, JTG_SINUSOID, JTG_MIN_JERK, JTG_LIN_CHIRP,
  JTG_TRIANGLE, JTG_CONST_ACC, JTG_TEXT_FILE
}
 

Protected Member Functions

bool convertForceNameToForceId (const std::string &name, unsigned int &id)
 
bool convertJointNameToJointId (const std::string &name, unsigned int &id)
 
 DECLARE_SIGNAL_OUT_FUNCTION (fRightFoot, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_OUT_FUNCTION (fLeftFoot, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_OUT_FUNCTION (fRightHand, dynamicgraph::Vector)
 
 DECLARE_SIGNAL_OUT_FUNCTION (fLeftHand, dynamicgraph::Vector)
 
bool generateReferenceForceSignal (const std::string &forceName, int fid, dynamicgraph::Vector &s, int iter)
 
bool isForceInRange (unsigned int id, const Eigen::VectorXd &f)
 
bool isForceInRange (unsigned int id, int axis, double f)
 
bool isJointInRange (unsigned int id, double q)
 

Protected Attributes

std::vector< ConstantAccelerationTrajectoryGenerator * > m_constAccTrajGen
 
std::vector< AbstractTrajectoryGenerator * > m_currentTrajGen
 status of the joints More...
 
std::vector< AbstractTrajectoryGenerator * > m_currentTrajGen_force
 status of the forces More...
 
double m_dt
 true if it is the first iteration, false otherwise More...
 
bool m_firstIter
 true if the entity has been successfully initialized More...
 
bool m_initSucceeded
 
std::vector< int > m_iterForceSignals
 
std::vector< LinearChirpTrajectoryGenerator * > m_linChirpTrajGen
 
std::vector< LinearChirpTrajectoryGenerator * > m_linChirpTrajGen_force
 
std::vector< MinimumJerkTrajectoryGenerator * > m_minJerkTrajGen
 
std::vector< MinimumJerkTrajectoryGenerator * > m_minJerkTrajGen_force
 
std::vector< NoTrajectoryGenerator * > m_noTrajGen
 
std::vector< NoTrajectoryGenerator * > m_noTrajGen_force
 
RobotUtilShrPtr m_robot_util
 control loop time period More...
 
std::vector< SinusoidTrajectoryGenerator * > m_sinTrajGen
 
std::vector< SinusoidTrajectoryGenerator * > m_sinTrajGen_force
 
std::vector< JTG_Statusm_status
 
std::vector< JTG_Statusm_status_force
 
TextFileTrajectoryGeneratorm_textFileTrajGen
 
std::vector< TriangleTrajectoryGenerator * > m_triangleTrajGen
 

Detailed Description

Definition at line 46 of file joint-trajectory-generator.hh.

Member Enumeration Documentation

◆ JTG_Status

enum JTG_Status
protected
Enumerator
JTG_STOP 
JTG_SINUSOID 
JTG_MIN_JERK 
JTG_LIN_CHIRP 
JTG_TRIANGLE 
JTG_CONST_ACC 
JTG_TEXT_FILE 

Definition at line 171 of file joint-trajectory-generator.hh.

Constructor & Destructor Documentation

◆ JointTrajectoryGenerator()

JointTrajectoryGenerator ( const std::string &  name)

Definition at line 41 of file joint-trajectory-generator.cpp.

Member Function Documentation

◆ convertForceNameToForceId()

bool convertForceNameToForceId ( const std::string &  name,
unsigned int &  id 
)
protected

Definition at line 835 of file joint-trajectory-generator.cpp.

◆ convertJointNameToJointId()

bool convertJointNameToJointId ( const std::string &  name,
unsigned int &  id 
)
protected

Definition at line 817 of file joint-trajectory-generator.cpp.

◆ DECLARE_SIGNAL() [1/4]

DECLARE_SIGNAL ( fRightFoot  ,
OUT  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL() [2/4]

DECLARE_SIGNAL ( fLeftFoot  ,
OUT  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL() [3/4]

DECLARE_SIGNAL ( fRightHand  ,
OUT  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL() [4/4]

DECLARE_SIGNAL ( fLeftHand  ,
OUT  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_IN()

DECLARE_SIGNAL_IN ( base6d_encoders  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_OUT() [1/3]

DECLARE_SIGNAL_OUT ( ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_OUT() [2/3]

DECLARE_SIGNAL_OUT ( dq  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_OUT() [3/3]

DECLARE_SIGNAL_OUT ( ddq  ,
dynamicgraph::Vector   
)

◆ DECLARE_SIGNAL_OUT_FUNCTION() [1/4]

DECLARE_SIGNAL_OUT_FUNCTION ( fRightFoot  ,
dynamicgraph::Vector   
)
protected

◆ DECLARE_SIGNAL_OUT_FUNCTION() [2/4]

DECLARE_SIGNAL_OUT_FUNCTION ( fLeftFoot  ,
dynamicgraph::Vector   
)
protected

◆ DECLARE_SIGNAL_OUT_FUNCTION() [3/4]

DECLARE_SIGNAL_OUT_FUNCTION ( fRightHand  ,
dynamicgraph::Vector   
)
protected

◆ DECLARE_SIGNAL_OUT_FUNCTION() [4/4]

DECLARE_SIGNAL_OUT_FUNCTION ( fLeftHand  ,
dynamicgraph::Vector   
)
protected

◆ display()

void display ( std::ostream &  os) const
virtual

Definition at line 903 of file joint-trajectory-generator.cpp.

◆ generateReferenceForceSignal()

bool generateReferenceForceSignal ( const std::string &  forceName,
int  fid,
dynamicgraph::Vector &  s,
int  iter 
)
protected

Definition at line 385 of file joint-trajectory-generator.cpp.

◆ getJoint()

void getJoint ( const std::string &  jointName)

Print the current angle of the specified joint.

Definition at line 425 of file joint-trajectory-generator.cpp.

◆ init()

void init ( const double &  dt,
const std::string &  robotRef 
)

Definition at line 200 of file joint-trajectory-generator.cpp.

◆ isForceInRange() [1/2]

bool isForceInRange ( unsigned int  id,
const Eigen::VectorXd &  f 
)
protected

Definition at line 872 of file joint-trajectory-generator.cpp.

◆ isForceInRange() [2/2]

bool isForceInRange ( unsigned int  id,
int  axis,
double  f 
)
protected

Definition at line 886 of file joint-trajectory-generator.cpp.

◆ isJointInRange()

bool isJointInRange ( unsigned int  id,
double  q 
)
protected

Definition at line 853 of file joint-trajectory-generator.cpp.

◆ isTrajectoryEnded()

bool isTrajectoryEnded ( )

Returns whether all given trajectories have ended

Definition at line 435 of file joint-trajectory-generator.cpp.

◆ moveForce()

void moveForce ( const std::string &  forceName,
const int &  axis,
const double &  fFinal,
const double &  time 
)

Definition at line 751 of file joint-trajectory-generator.cpp.

◆ moveJoint()

void moveJoint ( const std::string &  jointName,
const double &  qFinal,
const double &  time 
)

Move a joint to a position with a minimum-jerk trajectory.

Parameters
jointNameThe short name of the joint.
qFinalThe desired final position of the joint [rad].
timeThe time to go from the current position to qFinal [sec].

Definition at line 727 of file joint-trajectory-generator.cpp.

◆ playTrajectoryFile()

void playTrajectoryFile ( const std::string &  fileName)

Definition at line 459 of file joint-trajectory-generator.cpp.

◆ sendMsg()

void sendMsg ( const std::string &  msg,
MsgType  t = MSG_TYPE_INFO,
const char *  = "",
int  = 0 
)
inline

Definition at line 164 of file joint-trajectory-generator.hh.

◆ startConstAcc()

void startConstAcc ( const std::string &  jointName,
const double &  qFinal,
const double &  time 
)

Start an infinite trajectory with piece-wise constant acceleration.

Parameters
jointNameThe short name of the joint.
qFinalThe position of the joint corresponding to the max amplitude of the trajectory [rad].
timeThe time to go from the current position to qFinal [sec].
TaccThe time during witch acceleration is keept constant [sec].

Definition at line 569 of file joint-trajectory-generator.cpp.

◆ startForceLinearChirp()

void startForceLinearChirp ( const std::string &  forceName,
const int &  axis,
const double &  fFinal,
const double &  f0,
const double &  f1,
const double &  time 
)

Definition at line 679 of file joint-trajectory-generator.cpp.

◆ startForceSinusoid()

void startForceSinusoid ( const std::string &  forceName,
const int &  axis,
const double &  fFinal,
const double &  time 
)

Start an infinite sinusoidal trajectory for the specified force signal.

Parameters
forceNameThe short name of the force signal (rh, lh, rf, lf).
fFinalThe 6d force corresponding to the max amplitude of the sinusoid [N/Nm].
timeThe time to go from 0 to fFinal [sec].

Definition at line 598 of file joint-trajectory-generator.cpp.

◆ startLinearChirp()

void startLinearChirp ( const std::string &  jointName,
const double &  qFinal,
const double &  f0,
const double &  f1,
const double &  time 
)

Start a linear-chirp trajectory, that is a sinusoidal trajectory with frequency being a linear function of time.

Parameters
jointNameThe short name of the joint.
qFinalThe position of the joint corresponding to the max amplitude of the sinusoid [rad].
f0The initial (min) frequency of the sinusoid [Hz]
f1The final (max) frequency of the sinusoid [Hz]
timeThe time to get from f0 to f1 [sec]

Definition at line 632 of file joint-trajectory-generator.cpp.

◆ startSinusoid()

void startSinusoid ( const std::string &  jointName,
const double &  qFinal,
const double &  time 
)

Start an infinite sinusoidal trajectory.

Parameters
jointNameThe short name of the joint.
qFinalThe position of the joint corresponding to the max amplitude of the sinusoid [rad].
timeThe time to go from the current position to qFinal [sec].

Definition at line 506 of file joint-trajectory-generator.cpp.

◆ startTriangle()

void startTriangle ( const std::string &  jointName,
const double &  qFinal,
const double &  time,
const double &  Tacc 
)

Start an infinite triangle trajectory.

Parameters
jointNameThe short name of the joint.
qFinalThe position of the joint corresponding to the max amplitude of the trajectory [rad].
timeThe time to go from the current position to qFinal [sec].

Definition at line 534 of file joint-trajectory-generator.cpp.

◆ stop()

void stop ( const std::string &  jointName)

Stop the motion of the specified joint. If jointName is "all" it stops the motion of all joints.

Parameters
jointNameA string identifying the joint to stop.

Definition at line 777 of file joint-trajectory-generator.cpp.

◆ stopForce()

void stopForce ( const std::string &  forceName)

Stop the trajectory of the specified force. If forceName is "all" it stops all forces.

Parameters
forceNameA string identifying the force to stop.

Definition at line 801 of file joint-trajectory-generator.cpp.

Member Data Documentation

◆ m_constAccTrajGen

std::vector<ConstantAccelerationTrajectoryGenerator*> m_constAccTrajGen
protected

Definition at line 197 of file joint-trajectory-generator.hh.

◆ m_currentTrajGen

std::vector<AbstractTrajectoryGenerator*> m_currentTrajGen
protected

status of the joints

Definition at line 191 of file joint-trajectory-generator.hh.

◆ m_currentTrajGen_force

std::vector<AbstractTrajectoryGenerator*> m_currentTrajGen_force
protected

status of the forces

Definition at line 201 of file joint-trajectory-generator.hh.

◆ m_dt

double m_dt
protected

true if it is the first iteration, false otherwise

Definition at line 184 of file joint-trajectory-generator.hh.

◆ m_firstIter

bool m_firstIter
protected

true if the entity has been successfully initialized

Definition at line 183 of file joint-trajectory-generator.hh.

◆ m_initSucceeded

bool m_initSucceeded
protected

Definition at line 182 of file joint-trajectory-generator.hh.

◆ m_iterForceSignals

std::vector<int> m_iterForceSignals
protected

Definition at line 188 of file joint-trajectory-generator.hh.

◆ m_linChirpTrajGen

std::vector<LinearChirpTrajectoryGenerator*> m_linChirpTrajGen
protected

Definition at line 195 of file joint-trajectory-generator.hh.

◆ m_linChirpTrajGen_force

std::vector<LinearChirpTrajectoryGenerator*> m_linChirpTrajGen_force
protected

Definition at line 205 of file joint-trajectory-generator.hh.

◆ m_minJerkTrajGen

std::vector<MinimumJerkTrajectoryGenerator*> m_minJerkTrajGen
protected

Definition at line 193 of file joint-trajectory-generator.hh.

◆ m_minJerkTrajGen_force

std::vector<MinimumJerkTrajectoryGenerator*> m_minJerkTrajGen_force
protected

Definition at line 204 of file joint-trajectory-generator.hh.

◆ m_noTrajGen

std::vector<NoTrajectoryGenerator*> m_noTrajGen
protected

Definition at line 192 of file joint-trajectory-generator.hh.

◆ m_noTrajGen_force

std::vector<NoTrajectoryGenerator*> m_noTrajGen_force
protected

Definition at line 202 of file joint-trajectory-generator.hh.

◆ m_robot_util

RobotUtilShrPtr m_robot_util
protected

control loop time period

Definition at line 186 of file joint-trajectory-generator.hh.

◆ m_sinTrajGen

std::vector<SinusoidTrajectoryGenerator*> m_sinTrajGen
protected

Definition at line 194 of file joint-trajectory-generator.hh.

◆ m_sinTrajGen_force

std::vector<SinusoidTrajectoryGenerator*> m_sinTrajGen_force
protected

Definition at line 203 of file joint-trajectory-generator.hh.

◆ m_status

std::vector<JTG_Status> m_status
protected

Definition at line 190 of file joint-trajectory-generator.hh.

◆ m_status_force

std::vector<JTG_Status> m_status_force
protected

Definition at line 200 of file joint-trajectory-generator.hh.

◆ m_textFileTrajGen

TextFileTrajectoryGenerator* m_textFileTrajGen
protected

Definition at line 198 of file joint-trajectory-generator.hh.

◆ m_triangleTrajGen

std::vector<TriangleTrajectoryGenerator*> m_triangleTrajGen
protected

Definition at line 196 of file joint-trajectory-generator.hh.


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