6 #ifndef __sot_torque_control_joint_trajectory_generator_H__ 7 #define __sot_torque_control_joint_trajectory_generator_H__ 14 #if defined(joint_position_controller_EXPORTS) 15 #define SOTJOINTTRAJECTORYGENERATOR_EXPORT __declspec(dllexport) 17 #define SOTJOINTTRAJECTORYGENERATOR_EXPORT __declspec(dllimport) 20 #define SOTJOINTTRAJECTORYGENERATOR_EXPORT 27 #include "boost/assign.hpp" 30 #include <dynamic-graph/signal-helper.h> 31 #include <sot/core/matrix-geometry.hh> 32 #include <sot/core/robot-utils.hh> 47 DYNAMIC_GRAPH_ENTITY_DECL();
53 void init(
const double& dt,
const std::string& robotRef);
56 DECLARE_SIGNAL_IN(base6d_encoders, dynamicgraph::Vector);
57 DECLARE_SIGNAL_OUT(q, dynamicgraph::Vector);
58 DECLARE_SIGNAL_OUT(dq, dynamicgraph::Vector);
59 DECLARE_SIGNAL_OUT(ddq, dynamicgraph::Vector);
60 DECLARE_SIGNAL(fRightFoot, OUT, dynamicgraph::Vector);
61 DECLARE_SIGNAL(fLeftFoot, OUT, dynamicgraph::Vector);
62 DECLARE_SIGNAL(fRightHand, OUT, dynamicgraph::Vector);
63 DECLARE_SIGNAL(fLeftHand, OUT, dynamicgraph::Vector);
66 DECLARE_SIGNAL_OUT_FUNCTION(fRightFoot, dynamicgraph::Vector);
67 DECLARE_SIGNAL_OUT_FUNCTION(fLeftFoot, dynamicgraph::Vector);
68 DECLARE_SIGNAL_OUT_FUNCTION(fRightHand, dynamicgraph::Vector);
69 DECLARE_SIGNAL_OUT_FUNCTION(fLeftHand, dynamicgraph::Vector);
74 void playTrajectoryFile(
const std::string& fileName);
77 void getJoint(
const std::string& jointName);
80 bool isTrajectoryEnded();
87 void moveJoint(
const std::string& jointName,
const double& qFinal,
const double& time);
88 void moveForce(
const std::string& forceName,
const int& axis,
const double& fFinal,
const double& time);
95 void startSinusoid(
const std::string& jointName,
const double& qFinal,
const double& time);
102 void startTriangle(
const std::string& jointName,
const double& qFinal,
const double& time,
const double& Tacc);
110 void startConstAcc(
const std::string& jointName,
const double& qFinal,
const double& time);
119 void startForceSinusoid(
const std::string& forceName,
const int& axis,
const double& fFinal,
const double& time);
129 void startLinearChirp(
const std::string& jointName,
const double& qFinal,
const double& f0,
const double& f1,
132 void startForceLinearChirp(
const std::string& forceName,
const int& axis,
const double& fFinal,
const double& f0,
133 const double& f1,
const double& time);
139 void stop(
const std::string& jointName);
145 void stopForce(
const std::string& forceName);
148 virtual void display(std::ostream& os)
const;
150 void sendMsg(
const std::string& msg, MsgType t = MSG_TYPE_INFO,
const char* =
"",
int = 0) {
151 logger_.stream(t) << (
"[JointTrajectoryGenerator-" + name +
"] " + msg) <<
'\n';
182 bool generateReferenceForceSignal(
const std::string& forceName,
int fid, dynamicgraph::Vector& s,
int iter);
184 bool convertJointNameToJointId(
const std::string& name,
unsigned int&
id);
185 bool convertForceNameToForceId(
const std::string& name,
unsigned int&
id);
186 bool isJointInRange(
unsigned int id,
double q);
187 bool isForceInRange(
unsigned int id,
const Eigen::VectorXd& f);
188 bool isForceInRange(
unsigned int id,
int axis,
double f);
196 #endif // #ifndef __sot_torque_control_joint_position_controller_H__ std::vector< ConstantAccelerationTrajectoryGenerator * > m_constAccTrajGen
void sendMsg(const std::string &msg, MsgType t=MSG_TYPE_INFO, const char *="", int=0)
std::vector< NoTrajectoryGenerator * > m_noTrajGen
std::vector< AbstractTrajectoryGenerator * > m_currentTrajGen_force
status of the forces
std::vector< LinearChirpTrajectoryGenerator * > m_linChirpTrajGen
std::vector< MinimumJerkTrajectoryGenerator * > m_minJerkTrajGen_force
std::vector< SinusoidTrajectoryGenerator * > m_sinTrajGen_force
bool m_firstIter
true if the entity has been successfully initialized
double m_dt
true if it is the first iteration, false otherwise
std::vector< int > m_iterForceSignals
std::vector< SinusoidTrajectoryGenerator * > m_sinTrajGen
std::vector< NoTrajectoryGenerator * > m_noTrajGen_force
TextFileTrajectoryGenerator * m_textFileTrajGen
#define SOTJOINTTRAJECTORYGENERATOR_EXPORT
std::vector< LinearChirpTrajectoryGenerator * > m_linChirpTrajGen_force
AdmittanceController EntityClassName
std::vector< JTG_Status > m_status_force
std::vector< JTG_Status > m_status
RobotUtilShrPtr m_robot_util
control loop time period
std::vector< TriangleTrajectoryGenerator * > m_triangleTrajGen
std::vector< AbstractTrajectoryGenerator * > m_currentTrajGen
status of the joints
std::vector< MinimumJerkTrajectoryGenerator * > m_minJerkTrajGen