sr_motor_hand_lib.hpp
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 // to be able to load the configuration from the
00035 // parameter server
00036 #include <ros/ros.h>
00037 #include <string>
00038 #include <utility>
00039 #include <map>
00040 #include <vector>
00041 
00042 namespace shadow_robot
00043 {
00044 template<class StatusType, class CommandType>
00045 class SrMotorHandLib :
00046         public SrMotorRobotLib<StatusType, CommandType>
00047 {
00048 public:
00049   SrMotorHandLib(hardware_interface::HardwareInterface *hw, ros::NodeHandle nh, ros::NodeHandle nhtilde,
00050                  std::string device_id, std::string joint_prefix);
00051 
00063   bool force_pid_callback(sr_robot_msgs::ForceController::Request &request,
00064                           sr_robot_msgs::ForceController::Response &response,
00065                           int motor_index);
00066 
00077   bool reset_motor_callback(std_srvs::Empty::Request &request,
00078                             std_srvs::Empty::Response &response,
00079                             std::pair<int, std::string> joint);
00080 
00081 #ifdef DEBUG_PUBLISHER
00082 
00091   bool set_debug_data_to_publish(sr_robot_msgs::SetDebugData::Request& request,
00092                                  sr_robot_msgs::SetDebugData::Response& response);
00093 #endif
00094 
00095 protected:
00103   virtual void initialize(std::vector<std::string> joint_names, std::vector<int> actuator_ids,
00104                           std::vector<shadow_joints::JointToSensor> joint_to_sensors);
00105 
00121   void update_force_control_in_param_server(std::string joint_name, int max_pwm, int sg_left, int sg_right, int f,
00122                                             int p,
00123                                             int i, int d, int imax, int deadband, int sign);
00124 
00130   std::string find_joint_name(int motor_index);
00131 
00132 private:
00141   std::vector<int> read_joint_to_motor_mapping();
00142 
00143 
00144   static const int nb_motor_data;
00145   static const char *human_readable_motor_data_types[];
00146   static const int32u motor_data_types[];
00147 
00155   void resend_pids(std::string joint_name, int motor_index);
00156 
00161   std::map<std::string, ros::Timer> pid_timers;
00162 };
00163 }  // namespace shadow_robot
00164 
00165 /* For the emacs weenies in the crowd.
00166 Local Variables:
00167    c-basic-offset: 2
00168 End:
00169 */
00170 
00171 #endif


sr_robot_lib
Author(s): Ugo Cupcic, Toni Oliver
autogenerated on Mon Jul 1 2019 20:06:26