26 #ifndef _SR_MOTOR_ROBOT_LIB_HPP_ 27 #define _SR_MOTOR_ROBOT_LIB_HPP_ 31 #include <sr_robot_msgs/ForceController.h> 32 #include <sr_robot_msgs/ControlType.h> 33 #include <sr_robot_msgs/ChangeControlType.h> 34 #include <sr_robot_msgs/MotorSystemControls.h> 35 #include <sr_robot_msgs/ChangeMotorSystemControls.h> 48 template<
class StatusType,
class CommandType>
54 std::string device_id, std::string joint_prefix);
64 void update(StatusType *status_data);
78 void add_diagnostics(std::vector<diagnostic_msgs::DiagnosticStatus> &vec,
99 virtual void initialize(std::vector<std::string> joint_names, std::vector<int> actuator_ids,
100 std::vector<shadow_joints::JointToSensor> joint_to_sensors) = 0;
109 void calibrate_joint(std::vector<shadow_joints::Joint>::iterator joint_tmp, StatusType *status_data);
118 void read_additional_data(std::vector<shadow_joints::Joint>::iterator joint_tmp, StatusType *status_data);
139 std::vector<std::pair<std::string, bool> >
humanize_flags(
int flag);
158 int motor_index,
int max_pwm,
int sg_left,
int sg_right,
int f,
int p,
int i,
int d,
159 int imax,
int deadband,
int sign,
int torque_limit,
int torque_limiter_gain);
168 sr_actuator::SrMotorActuator *
get_joint_actuator(std::vector<shadow_joints::Joint>::iterator joint_tmp)
170 return static_cast<sr_actuator::SrMotorActuator *
>(joint_tmp->actuator_wrapper->actuator);
186 typedef std::pair<int, std::vector<crc_unions::union16> >
ForceConfig;
241 sr_robot_msgs::ChangeControlType::Response &response);
255 std::queue<std::vector<sr_robot_msgs::MotorSystemControls>,
271 sr_robot_msgs::ChangeMotorSystemControls::Response &response);
void reinitialize_motors()
void generate_force_control_config(int motor_index, int max_pwm, int sg_left, int sg_right, int f, int p, int i, int d, int imax, int deadband, int sign, int torque_limit, int torque_limiter_gain)
std::pair< int, std::vector< crc_unions::union16 > > ForceConfig
ros::ServiceServer change_control_type_
virtual void initialize(std::vector< std::string > joint_names, std::vector< int > actuator_ids, std::vector< shadow_joints::JointToSensor > joint_to_sensors)=0
SrMotorRobotLib(hardware_interface::HardwareInterface *hw, ros::NodeHandle nh, ros::NodeHandle nhtilde, std::string device_id, std::string joint_prefix)
void read_additional_data(std::vector< shadow_joints::Joint >::iterator joint_tmp, StatusType *status_data)
sr_robot_msgs::ControlType control_type_
std::vector< generic_updater::UpdateConfig > motor_update_rate_configs_vector
ROSLIB_DECL std::string command(const std::string &cmd)
boost::shared_ptr< generic_updater::MotorUpdater< CommandType > > motor_updater_
std::queue< int16_t, std::list< int16_t > > reset_motors_queue
boost::shared_ptr< generic_updater::MotorDataChecker > motor_data_checker
sr_actuator::SrMotorActuator * get_joint_actuator(std::vector< shadow_joints::Joint >::iterator joint_tmp)
bool control_type_changed_flag_
bool motor_system_controls_callback_(sr_robot_msgs::ChangeMotorSystemControls::Request &request, sr_robot_msgs::ChangeMotorSystemControls::Response &response)
bool change_control_parameters(int16_t control_type)
bool check_if_joint_coupled(string joint_name)
boost::shared_ptr< boost::mutex > lock_command_sending_
ros::ServiceServer motor_system_control_server_
bool change_control_type_callback_(sr_robot_msgs::ChangeControlType::Request &request, sr_robot_msgs::ChangeControlType::Response &response)
void build_command(CommandType *command)
void add_diagnostics(std::vector< diagnostic_msgs::DiagnosticStatus > &vec, diagnostic_updater::DiagnosticStatusWrapper &d)
void calibrate_joint(std::vector< shadow_joints::Joint >::iterator joint_tmp, StatusType *status_data)
operation_mode::device_update_state::DeviceUpdateState motor_current_state
void update(StatusType *status_data)
std::queue< std::vector< sr_robot_msgs::MotorSystemControls >, std::list< std::vector< sr_robot_msgs::MotorSystemControls > > > motor_system_control_flags_
int find_joint_by_name(string joint_name)
void process_position_sensor_data(std::vector< shadow_joints::Joint >::iterator joint_tmp, StatusType *status_data, double timestamp)
std::vector< std::pair< std::string, bool > > humanize_flags(int flag)
std::queue< ForceConfig, std::list< ForceConfig > > reconfig_queue