Commit 474a7931 authored by Noëlie Ramuzat's avatar Noëlie Ramuzat
Browse files

[tools] Change RobotUtil pointer to Share pointer

Change the pointer RobotUtil to share pointer in the different classes, accordingly to the changes done in sot-core.
Refactoring of the code.
parent f44657a9
......@@ -146,7 +146,7 @@ namespace dynamicgraph {
tsid::math::Vector6 m_v_RF_int;
tsid::math::Vector6 m_v_LF_int;
RobotUtil * m_robot_util;
RobotUtilShrPtr m_robot_util;
// tsid::math::Vector3 m_zmp_des_LF; /// 3d desired zmp left foot
// tsid::math::Vector3 m_zmp_des_RF; /// 3d desired zmp left foot
......
......@@ -181,7 +181,7 @@ namespace dynamicgraph {
bool m_initSucceeded; /// true if the entity has been successfully initialized
bool m_reset_foot_pos; /// true after the command resetFootPositions is called
double m_dt; /// sampling time step
RobotUtil * m_robot_util;
RobotUtilShrPtr m_robot_util;
bool m_left_foot_is_stable; /// True if left foot as been stable for the last 'm_fz_stable_windows_size' samples
bool m_right_foot_is_stable; /// True if right foot as been stable for the last 'm_fz_stable_windows_size' samples
......
......@@ -159,7 +159,7 @@ namespace dynamicgraph {
}
protected:
RobotUtil * m_robot_util;
RobotUtilShrPtr m_robot_util;
tsid::robots::RobotWrapper * m_robot;
bool m_initSucceeded; /// true if the entity has been successfully initialized
double m_dt; /// control loop time period
......
......@@ -119,7 +119,7 @@ namespace dynamicgraph {
}
protected:
RobotUtil * m_robot_util;
RobotUtilShrPtr m_robot_util;
bool m_initSucceeded; /// true if the entity has been successfully initialized
bool m_emergency_stop_triggered;
double m_dt; /// control loop time period
......
......@@ -176,7 +176,7 @@ namespace dynamicgraph
DIST normalDistribution_;
GEN normalRandomNumberGenerator_;
RobotUtil * m_robot_util;
RobotUtilShrPtr m_robot_util;
};
} // end namespace torque_control
......
......@@ -115,7 +115,7 @@ namespace dynamicgraph {
Eigen::VectorXd m_v_pin; /// robot velocities according to pinocchio convention
Eigen::VectorXd m_v_sot; /// robot velocities according to SoT convention
RobotUtil * m_robot_util;
RobotUtilShrPtr m_robot_util;
}; // class FreeFlyerLocator
......
......@@ -308,7 +308,7 @@ namespace dynamicgraph {
tsid::math::Vector6 m_v_LF_int;
unsigned int m_timeLast;
RobotUtil * m_robot_util;
RobotUtilShrPtr m_robot_util;
}; // class InverseDynamicsBalanceController
} // namespace torque_control
......
......@@ -124,7 +124,7 @@ namespace dynamicgraph {
// Eigen::VectorXd m_dqDesIntegral; /// integral of the desired velocity
Eigen::VectorXd m_dqErrIntegral; /// integral of the velocity error
RobotUtil * m_robot_util;
RobotUtilShrPtr m_robot_util;
void sendMsg(const std::string& msg, MsgType t=MSG_TYPE_INFO, const char* file="", int line=0)
{
......
......@@ -182,7 +182,7 @@ namespace dynamicgraph {
bool m_firstIter; /// true if it is the first iteration, false otherwise
double m_dt; /// control loop time period
RobotUtil *m_robot_util;
RobotUtilShrPtr m_robot_util;
std::vector<int> m_iterForceSignals;
......
......@@ -93,7 +93,7 @@ namespace dynamicgraph {
}
protected:
RobotUtil * m_robot_util; /// Robot Util
RobotUtilShrPtr m_robot_util; /// Robot Util
Eigen::VectorXd m_pwmDes;
bool m_initSucceeded; /// true if the entity has been successfully initialized
double m_dt; /// control loop time period
......
......@@ -94,7 +94,7 @@ namespace dynamicgraph {
DECLARE_SIGNAL_OUT(jointTorquesEstimated, dynamicgraph::Vector);
protected:
RobotUtil * m_robot_util;
RobotUtilShrPtr m_robot_util;
pinocchio::Model m_model; /// Pinocchio robot model
pinocchio::Data *m_data; /// Pinocchio robot data
int n_iterations; //Number of iterations to consider
......
......@@ -187,7 +187,7 @@ namespace dynamicgraph
void ControlManager::init(const double & dt,
const std::string & urdfFile,
const std::string &robotRef)
const std::string & robotRef)
{
if(dt<=0.0)
return SEND_MSG("Timestep must be positive", MSG_TYPE_ERROR);
......@@ -196,19 +196,19 @@ namespace dynamicgraph
m_initSucceeded = true;
vector<string> package_dirs;
m_robot = new robots::RobotWrapper(urdfFile, package_dirs, pinocchio::JointModelFreeFlyer());
std::string localName(robotRef);
if (!isNameInRobotUtil(localName))
{
m_robot_util = createRobotUtil(localName);
std::cout << "createRobotUtil success" << std::endl;
}
else
{
m_robot_util = getRobotUtil(localName);
std::cout << "getRobotUtil success" << std::endl;
}
std::cout << m_robot_util->m_urdf_filename << std::endl;
m_robot_util->m_urdf_filename = urdfFile;
addCommand("getJointsUrdfToSot",
makeDirectGetter(*this, &m_robot_util->m_dgv_urdf_to_sot,
docDirectSetter("Display map Joints From URDF to SoT.",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment