26 #ifndef _SR_MUSCLE_ROBOT_LIB_HPP_ 27 #define _SR_MUSCLE_ROBOT_LIB_HPP_ 32 #include <sr_utilities/calibration.hpp> 40 #define NUM_MUSCLE_DRIVERS 4 44 template<
class StatusType,
class CommandType>
50 std::string device_id, std::string joint_prefix);
60 void update(StatusType *status_data);
74 void add_diagnostics(std::vector<diagnostic_msgs::DiagnosticStatus> &vec,
95 virtual void initialize(std::vector<std::string> joint_names, std::vector<int> actuator_ids,
96 std::vector<shadow_joints::JointToSensor> joint_to_sensors) = 0;
105 void calibrate_joint(std::vector<shadow_joints::Joint>::iterator joint_tmp, StatusType *status_data);
149 StatusType *status_data);
159 std::vector<std::pair<std::string, bool> >
humanize_flags(
int flag);
168 sr_actuator::SrMuscleActuator *
get_joint_actuator(std::vector<shadow_joints::Joint>::iterator joint_tmp)
170 return static_cast<sr_actuator::SrMuscleActuator *
>(joint_tmp->actuator_wrapper->actuator);
176 unsigned int get_muscle_pressure(
int muscle_driver_id,
int muscle_id, StatusType *status_data);
191 inline void set_valve_demand(uint8_t *muscle_data_byte_to_set, int8_t valve_value, uint8_t shifting_index);
void set_muscle_driver_data_received_flags(unsigned int msg_type, int muscle_driver_id)
std::queue< int16_t, std::list< int16_t > > reset_muscle_driver_queue
void init_timer_callback(const ros::TimerEvent &event)
std::vector< shadow_joints::MuscleDriver > muscle_drivers_vector_
virtual void initialize(std::vector< std::string > joint_names, std::vector< int > actuator_ids, std::vector< shadow_joints::JointToSensor > joint_to_sensors)=0
boost::shared_ptr< shadow_robot::JointCalibration > pressure_calibration_tmp_
A temporary calibration for a given joint.
void read_additional_muscle_data(std::vector< shadow_joints::Joint >::iterator joint_tmp, StatusType *status_data)
void build_command(CommandType *command)
ros::Timer check_init_timeout_timer
virtual shadow_joints::CalibrationMap read_pressure_calibration()
bool check_muscle_driver_data_received_flags()
void set_valve_demand(uint8_t *muscle_data_byte_to_set, int8_t valve_value, uint8_t shifting_index)
SrMuscleRobotLib(hardware_interface::HardwareInterface *hw, ros::NodeHandle nh, ros::NodeHandle nhtilde, std::string device_id, std::string joint_prefix)
std::map< unsigned int, unsigned int > from_muscle_driver_data_received_flags_
ROSLIB_DECL std::string command(const std::string &cmd)
operation_mode::device_update_state::DeviceUpdateState muscle_current_state
void process_position_sensor_data(std::vector< shadow_joints::Joint >::iterator joint_tmp, StatusType *status_data, double timestamp)
void read_muscle_driver_data(std::vector< shadow_joints::MuscleDriver >::iterator muscle_driver_tmp, StatusType *status_data)
static const double timeout
ros::Duration init_max_duration
boost::shared_ptr< generic_updater::MuscleUpdater< CommandType > > muscle_updater_
std::vector< std::pair< std::string, bool > > humanize_flags(int flag)
unsigned int get_muscle_pressure(int muscle_driver_id, int muscle_id, StatusType *status_data)
shadow_joints::CalibrationMap pressure_calibration_map_
The map used to calibrate each pressure sensor.
void calibrate_joint(std::vector< shadow_joints::Joint >::iterator joint_tmp, StatusType *status_data)
threadsafe::Map< boost::shared_ptr< shadow_robot::JointCalibration > > CalibrationMap
sr_actuator::SrMuscleActuator * get_joint_actuator(std::vector< shadow_joints::Joint >::iterator joint_tmp)
void update(StatusType *status_data)
void reinitialize_motors()
std::vector< generic_updater::UpdateConfig > muscle_update_rate_configs_vector
boost::shared_ptr< boost::mutex > lock_init_timeout_
void add_diagnostics(std::vector< diagnostic_msgs::DiagnosticStatus > &vec, diagnostic_updater::DiagnosticStatusWrapper &d)