Go to the documentation of this file.00001
00028 #ifndef _SR_MOTOR_HAND_LIB_HPP_
00029 #define _SR_MOTOR_HAND_LIB_HPP_
00030
00031 #include "sr_robot_lib/sr_motor_robot_lib.hpp"
00032 #include <std_srvs/Empty.h>
00033
00034
00035
00036 #include <ros/ros.h>
00037 #include <string>
00038
00039 namespace shadow_robot
00040 {
00041 template <class StatusType, class CommandType>
00042 class SrMotorHandLib : public SrMotorRobotLib<StatusType, CommandType>
00043 {
00044 public:
00045 SrMotorHandLib(pr2_hardware_interface::HardwareInterface *hw);
00046 ~SrMotorHandLib();
00047
00059 bool force_pid_callback(sr_robot_msgs::ForceController::Request& request,
00060 sr_robot_msgs::ForceController::Response& response,
00061 int motor_index);
00062
00073 bool reset_motor_callback(std_srvs::Empty::Request& request,
00074 std_srvs::Empty::Response& response,
00075 std::pair<int,std::string> joint);
00076
00077 #ifdef DEBUG_PUBLISHER
00078
00087 bool set_debug_data_to_publish(sr_robot_msgs::SetDebugData::Request& request,
00088 sr_robot_msgs::SetDebugData::Response& response);
00089 #endif
00090
00091 protected:
00100 virtual void initialize(std::vector<std::string> joint_names, std::vector<int> actuator_ids,
00101 std::vector<shadow_joints::JointToSensor> joint_to_sensors,
00102 std::vector<sr_actuator::SrGenericActuator*> actuators);
00103
00119 void update_force_control_in_param_server(std::string joint_name, int max_pwm, int sg_left, int sg_right, int f, int p,
00120 int i, int d, int imax, int deadband, int sign);
00121
00127 std::string find_joint_name(int motor_index);
00128
00129 private:
00130
00139 std::vector<int> read_joint_to_motor_mapping();
00140
00141
00142 static const int nb_motor_data;
00143 static const char* human_readable_motor_data_types[];
00144 static const int32u motor_data_types[];
00145
00147 ros::ServiceServer debug_service;
00148
00156 void resend_pids(std::string joint_name, int motor_index);
00157
00162 std::map<std::string, ros::Timer> pid_timers;
00163 };
00164
00165 }
00166
00167
00168
00169
00170
00171
00172
00173 #endif