26 #ifndef _SR_ROBOT_LIB_HPP_ 27 #define _SR_ROBOT_LIB_HPP_ 29 #include <boost/smart_ptr.hpp> 30 #include <boost/ptr_container/ptr_vector.hpp> 31 #include <boost/thread/thread.hpp> 32 #include <boost/thread/mutex.hpp> 40 #include <std_msgs/Int16.h> 42 #include <sr_hardware_interface/sr_actuator.hpp> 44 #include <diagnostic_msgs/DiagnosticStatus.h> 47 #include <ros_ethercat_model/robot_state.hpp> 49 #include <sr_robot_msgs/NullifyDemand.h> 50 #include <sr_robot_msgs/SetDebugData.h> 52 #include <sr_utilities/sr_math_utils.hpp> 53 #include <sr_utilities/calibration.hpp> 54 #include <sr_utilities/thread_safe_map.hpp> 60 #include "sr_interpolation/pwl_interp_2d_scattered.hpp" 102 CoupledJoint(std::string joint_name, std::string joint_sibling_name,
103 std::vector<double> raw_values_coupled_vector, std::vector<double> calibrated_values_vector);
110 const int nb_surrounding_points_ = 10;
118 void process_calibration_values();
121 template<
class StatusType,
class CommandType>
126 std::string device_id, std::string joint_prefix);
140 virtual void update(StatusType *status_data) = 0;
147 virtual void build_command(CommandType *
command) = 0;
154 void build_tactile_command(CommandType *command);
161 void update_tactile_info(StatusType *status);
167 virtual void add_diagnostics(std::vector<diagnostic_msgs::DiagnosticStatus> &vec,
173 void reinitialize_sensors();
187 bool nullify_demand_callback(sr_robot_msgs::NullifyDemand::Request &request,
188 sr_robot_msgs::NullifyDemand::Response &response);
232 virtual void initialize(std::vector<std::string> joint_names, std::vector<int> actuator_ids,
233 std::vector<shadow_joints::JointToSensor> joint_to_sensors) = 0;
242 virtual void calibrate_joint(std::vector<shadow_joints::Joint>::iterator joint_tmp, StatusType *status_data) = 0;
253 virtual ros_ethercat_model::Actuator *get_joint_actuator(std::vector<shadow_joints::Joint>::iterator joint_tmp) = 0;
262 std::vector<shadow_joints::JointToSensor> read_joint_to_sensor_mapping();
272 CoupledJointMapType read_coupled_joint_calibration();
284 std::vector<generic_updater::UpdateConfig> read_update_rate_configs(std::string base_param,
int nb_data_defined,
285 const char *human_readable_data_types[],
286 const int32u data_types[]);
317 #ifdef DEBUG_PUBLISHER 319 static const int nb_debug_publishers_const;
320 std::vector<ros::Publisher> debug_publishers;
328 std::vector<boost::shared_ptr<std::pair<int, int> > > debug_motor_indexes_and_data;
332 std_msgs::Int16 msg_debug;
345 static const char *human_readable_sensor_data_types[];
350 void checkSelfTests();
std::vector< int > element_neighbor_
std::map< std::string, CoupledJoint > CoupledJointMapType
std::vector< shadow_joints::Joint > joints_vector
The vector containing all the robot joints.
boost::shared_ptr< boost::mutex > lock_tactile_init_timeout_
A mutual exclusion object to ensure that the intitialization timeout event does work without threadin...
ROSCONSOLE_DECL void initialize()
static const double tactile_timeout
Timeout handling variables for UBI sensors.
ros::NodeHandle nodehandle_
a ros nodehandle to be able to access resources out of the node namespace
std::string joint_prefix_
Prefix used to access the joints.
shadow_joints::CalibrationMap calibration_map
The map used to calibrate each joint.
boost::shared_ptr< boost::thread > self_test_thread_
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
boost::shared_ptr< tactiles::GenericTactiles< StatusType, CommandType > > tactiles
operation_mode::device_update_state::DeviceUpdateState tactile_current_state
CoupledJointMapType coupled_calibration_map
boost::shared_ptr< shadow_robot::JointCalibration > calibration_tmp
A temporary calibration for a given joint.
ROSLIB_DECL std::string command(const std::string &cmd)
ros::Duration tactile_init_max_duration
ros::NodeHandle nh_tilde
a ROS nodehandle (private naming, only inside the node namespace) to be able to advertise the Force P...
boost::shared_ptr< tactiles::GenericTactiles< StatusType, CommandType > > tactiles_init
std::vector< generic_updater::UpdateConfig > biotac_sensor_update_rate_configs_vector
static const int nb_sensor_data
std::vector< double > calibrated_values_
ros_ethercat_model::RobotState * hw_
ros::Timer tactile_check_init_timeout_timer
std::string device_id_
Id of the ethercat device (alias)
std::vector< generic_updater::UpdateConfig > generic_sensor_update_rate_configs_vector
std::string sibling_name_
threadsafe::Map< boost::shared_ptr< shadow_robot::JointCalibration > > CalibrationMap
std::vector< int > triangle_
std::vector< generic_updater::UpdateConfig > ubi0_sensor_update_rate_configs_vector
ros::ServiceServer nullify_demand_server_
std::vector< double > raw_values_coupled_
int main_pic_idle_time_min
std::vector< generic_updater::UpdateConfig > pst3_sensor_update_rate_configs_vector