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
26 #include <boost/assign.hpp>
28 #include <pinocchio/fwd.hpp>
31 #include <dynamic-graph/signal-helper.h>
33 #include <sot/core/matrix-geometry.hh>
34 #include <sot/core/robot-utils.hh>
47 :
public ::dynamicgraph::Entity {
49 DYNAMIC_GRAPH_ENTITY_DECL();
55 void init(
const double& dt,
const std::string& robotRef);
76 void playTrajectoryFile(
const std::string& fileName);
79 void getJoint(
const std::string& jointName);
82 bool isTrajectoryEnded();
89 void moveJoint(
const std::string& jointName,
const double& qFinal,
91 void moveForce(
const std::string& forceName,
const int& axis,
92 const double& fFinal,
const double& time);
100 void startSinusoid(
const std::string& jointName,
const double& qFinal,
109 void startTriangle(
const std::string& jointName,
const double& qFinal,
110 const double& time,
const double& Tacc);
119 void startConstAcc(
const std::string& jointName,
const double& qFinal,
130 void startForceSinusoid(
const std::string& forceName,
const int& axis,
131 const double& fFinal,
const double& time);
142 void startLinearChirp(
const std::string& jointName,
const double& qFinal,
143 const double& f0,
const double& f1,
const double& time);
145 void startForceLinearChirp(
const std::string& forceName,
const int& axis,
146 const double& fFinal,
const double& f0,
147 const double& f1,
const double& time);
153 void stop(
const std::string& jointName);
159 void stopForce(
const std::string& forceName);
162 virtual void display(std::ostream& os)
const;
164 void sendMsg(
const std::string& msg, MsgType t = MSG_TYPE_INFO,
165 const char* =
"",
int = 0) {
166 logger_.stream(t) << (
"[JointTrajectoryGenerator-" + name +
"] " + msg)
207 bool generateReferenceForceSignal(
const std::string& forceName,
int fid,
208 dynamicgraph::Vector& s,
int iter);
210 bool convertJointNameToJointId(
const std::string& name,
unsigned int&
id);
211 bool convertForceNameToForceId(
const std::string& name,
unsigned int&
id);
212 bool isJointInRange(
unsigned int id,
double q);
213 bool isForceInRange(
unsigned int id,
const Eigen::VectorXd& f);
214 bool isForceInRange(
unsigned int id,
int axis,
double f);
void sendMsg(const std::string &msg, MsgType t=MSG_TYPE_INFO, const char *="", int=0)
DECLARE_SIGNAL_OUT_FUNCTION(fLeftHand, dynamicgraph::Vector)
DECLARE_SIGNAL_OUT(dq, dynamicgraph::Vector)
std::vector< SinusoidTrajectoryGenerator * > m_sinTrajGen
std::vector< AbstractTrajectoryGenerator * > m_currentTrajGen_force
status of the forces
RobotUtilShrPtr m_robot_util
control loop time period
TextFileTrajectoryGenerator * m_textFileTrajGen
std::vector< LinearChirpTrajectoryGenerator * > m_linChirpTrajGen
std::vector< JTG_Status > m_status_force
DECLARE_SIGNAL_OUT_FUNCTION(fLeftFoot, dynamicgraph::Vector)
std::vector< LinearChirpTrajectoryGenerator * > m_linChirpTrajGen_force
std::vector< NoTrajectoryGenerator * > m_noTrajGen_force
DECLARE_SIGNAL(fLeftHand, OUT, dynamicgraph::Vector)
std::vector< MinimumJerkTrajectoryGenerator * > m_minJerkTrajGen_force
double m_dt
true if it is the first iteration, false otherwise
std::vector< ConstantAccelerationTrajectoryGenerator * > m_constAccTrajGen
DECLARE_SIGNAL_OUT_FUNCTION(fRightFoot, dynamicgraph::Vector)
DECLARE_SIGNAL_OUT(q, dynamicgraph::Vector)
DECLARE_SIGNAL(fRightFoot, OUT, dynamicgraph::Vector)
DECLARE_SIGNAL_OUT(ddq, dynamicgraph::Vector)
bool m_firstIter
true if the entity has been successfully initialized
DECLARE_SIGNAL(fRightHand, OUT, dynamicgraph::Vector)
DECLARE_SIGNAL_IN(base6d_encoders, dynamicgraph::Vector)
std::vector< TriangleTrajectoryGenerator * > m_triangleTrajGen
std::vector< JTG_Status > m_status
std::vector< SinusoidTrajectoryGenerator * > m_sinTrajGen_force
DECLARE_SIGNAL(fLeftFoot, OUT, dynamicgraph::Vector)
std::vector< NoTrajectoryGenerator * > m_noTrajGen
std::vector< AbstractTrajectoryGenerator * > m_currentTrajGen
status of the joints
DECLARE_SIGNAL_OUT_FUNCTION(fRightHand, dynamicgraph::Vector)
std::vector< MinimumJerkTrajectoryGenerator * > m_minJerkTrajGen
std::vector< int > m_iterForceSignals
#define SOTJOINTTRAJECTORYGENERATOR_EXPORT
AdmittanceController EntityClassName