60 ds_pid->setCallback(cb_pid);
69 int pos_vel = boost::lexical_cast<
unsigned int>(str_pos_vel);
75 unsigned int tmp_mxtrn = boost::lexical_cast<
unsigned int>(str_mxtrn);
76 double mxtrn = ((double) tmp_mxtrn) / 100.0;
82 unsigned int tmp_kp = boost::lexical_cast<
unsigned int>(str_kp);
83 double kp = ((double) tmp_kp) / 10.0;
89 unsigned int tmp_ki = boost::lexical_cast<
unsigned int>(str_ki);
90 double ki = ((double) tmp_ki) / 10.0;
96 unsigned int tmp_kd = boost::lexical_cast<
unsigned int>(str_kd);
97 double kd = ((double) tmp_kd) / 10.0;
103 int icap = boost::lexical_cast<
unsigned int>(str_icap);
109 int clerd = boost::lexical_cast<
unsigned int>(str_clred);
113 }
catch (std::bad_cast& e)
115 ROS_WARN_STREAM(
"Failure parsing feedback data. Dropping message." << e.what());
188 int mode = boost::lexical_cast<
int>(str_mode);
190 bool check1 = (
mType.compare(
"velocity") == 0 && ((mode == 1) || (mode == 6)));
191 bool check2 = (
mType.compare(
"position") == 0 && ((mode == 2) || (mode == 3) || (mode == 4)));
192 bool check3 = (
mType.compare(
"torque") == 0 && ((mode == 5)));
193 bool status = check1 | check2 | check3;
202 if(config.restore_defaults)
205 config.restore_defaults =
false;
210 if(config.load_roboteq)
213 config.load_roboteq =
false;
221 if(
_last_pid_config.position_mode_velocity != config.position_mode_velocity)
230 int gain = config.turn_min_to_max * 100;
237 int gain = config.Kp * 10;
244 int gain = config.Ki * 10;
251 int gain = config.Kd * 10;
void reconfigureCBPID(roboteq_control::RoboteqPIDConfig &config, uint32_t level)
reconfigureCBEncoder when the dynamic reconfigurator change some values start this method ...
dynamic_reconfigure::Server< roboteq_control::RoboteqPIDConfig > * ds_pid
Dynamic reconfigure PID.
bool setParam(string msg, string params="")
ros::NodeHandle nh_
Private namespace.
const std::string & getNamespace() const
roboteq_control::RoboteqPIDConfig _last_pid_config
roboteq::serial_controller * mSerial
Serial port.
#define ROS_WARN_STREAM(args)
#define ROS_DEBUG_STREAM(args)
void setPIDconfiguration()
string getParam(string msg, string params="")
string mName
Associate name space.
bool getParam(const std::string &key, std::string &s) const
void getPIDFromRoboteq()
getPIDFromRoboteq Load PID parameters from Roboteq board
roboteq_control::RoboteqPIDConfig default_pid_config
unsigned int mNumber
Number motor.
void setParam(const std::string &key, const XmlRpc::XmlRpcValue &v) const
MotorPIDConfigurator(const ros::NodeHandle &nh, roboteq::serial_controller *serial, string path, string name, unsigned int number)
MotorPIDConfigurator Initialize the dynamic reconfigurator.
bool setup_pid
Setup variable.
void initConfigurator(bool load_from_board)