sr_hand_lib.hpp
Go to the documentation of this file.
00001 
00028 #ifndef _SR_HAND_LIB_HPP_
00029 #define _SR_HAND_LIB_HPP_
00030 
00031 #include "sr_robot_lib/sr_robot_lib.hpp"
00032 #include <std_srvs/Empty.h>
00033 
00034 //to be able to load the configuration from the
00035 //parameter server
00036 #include <ros/ros.h>
00037 #include <string>
00038 
00039 namespace shadow_robot
00040 {
00041   class SrHandLib : public SrRobotLib
00042   {
00043   public:
00044     SrHandLib(pr2_hardware_interface::HardwareInterface *hw);
00045     ~SrHandLib();
00046 
00058     bool force_pid_callback(sr_robot_msgs::ForceController::Request& request,
00059                             sr_robot_msgs::ForceController::Response& response,
00060                             int motor_index);
00061 
00072     bool reset_motor_callback(std_srvs::Empty::Request& request,
00073                               std_srvs::Empty::Response& response,
00074                               std::pair<int,std::string> joint);
00075 
00076 #ifdef DEBUG_PUBLISHER
00077 
00086     bool set_debug_data_to_publish(sr_robot_msgs::SetDebugData::Request& request,
00087                                    sr_robot_msgs::SetDebugData::Response& response);
00088 #endif
00089 
00090   protected:
00099     virtual void initialize(std::vector<std::string> joint_names, std::vector<int> motor_ids,
00100                             std::vector<shadow_joints::JointToSensor> joint_to_sensors,
00101                             std::vector<sr_actuator::SrActuator*> actuators);
00102 
00118     void update_force_control_in_param_server(std::string joint_name, int max_pwm, int sg_left, int sg_right, int f, int p,
00119                                                        int i, int d, int imax, int deadband, int sign);
00120 
00126     std::string find_joint_name(int motor_index);
00127 
00128   private:
00129     ros::NodeHandle nodehandle_;
00130 
00138     std::vector<shadow_joints::JointToSensor> read_joint_to_sensor_mapping();
00139 
00146     shadow_joints::CalibrationMap read_joint_calibration();
00147 
00156     std::vector<int> read_joint_to_motor_mapping();
00157 
00168     std::vector<generic_updater::UpdateConfig> read_update_rate_configs(std::string base_param, int nb_data_defined, const char* human_readable_data_types[], const int32u data_types[]);
00169 
00170 
00171     static const int nb_motor_data;
00172     static const char* human_readable_motor_data_types[];
00173     static const int32u motor_data_types[];
00174 
00175     static const int nb_sensor_data;
00176     static const char* human_readable_sensor_data_types[];
00177     static const int32u sensor_data_types[];
00178 
00180     ros::ServiceServer debug_service;
00181 
00189     void resend_pids(std::string joint_name, int motor_index);
00190 
00195     std::map<std::string, ros::Timer> pid_timers;
00196   };
00197 
00198 }
00199 
00200 /* For the emacs weenies in the crowd.
00201 Local Variables:
00202    c-basic-offset: 2
00203 End:
00204 */
00205 
00206 #endif


sr_robot_lib
Author(s): Ugo Cupcic / ugo@shadowrobot.com , software@shadowrobot.com
autogenerated on Thu Jan 2 2014 12:02:17