sr_actuator.hpp
Go to the documentation of this file.
00001 
00027 #ifndef _SR_ACTUATOR_HPP_
00028 #define _SR_ACTUATOR_HPP_
00029 
00030 #include "sr_hardware_interface/tactile_sensors.hpp"
00031 #include <pr2_hardware_interface/hardware_interface.h>
00032 
00033 namespace sr_actuator
00034 {
00035   class SrActuatorState : public pr2_hardware_interface::ActuatorState
00036   {
00037   public:
00038     SrActuatorState() :
00039       pr2_hardware_interface::ActuatorState(),
00040       temperature_(0),
00041       position_unfiltered_(0.0),
00042       can_msgs_received_(0),
00043       can_msgs_transmitted_(0),
00044       pic_firmware_svn_revision_(0),
00045       server_firmware_svn_revision_(0),
00046       firmware_modified_(0),
00047       serial_number_low_set(false),
00048       serial_number_high_set(false),
00049       serial_number_low(0),
00050       serial_number_high(0),
00051       serial_number(0),
00052       assembly_data_year(0),
00053       assembly_data_month(0),
00054       assembly_data_day(0),
00055       tests_(0),
00056       can_error_counters(0)
00057     {}
00058 
00059 
00060     std::vector<int> raw_sensor_values_;
00061     std::vector<double> calibrated_sensor_values_;
00062 
00070     std::vector<std::pair<std::string, bool> > flags_;
00071 
00072     double temperature_;
00073 
00074     double position_unfiltered_;
00075 
00076     uint64_t can_msgs_received_;
00077     uint64_t can_msgs_transmitted_;
00078 
00079     unsigned int pic_firmware_svn_revision_;
00080     unsigned int server_firmware_svn_revision_;
00081     bool firmware_modified_;
00082 
00083     //Serial number is composed of a low and
00084     // a high byte.
00085     void set_serial_number_low(unsigned int serial)
00086     {
00087       serial_number_low = serial;
00088 
00089       serial_number_low_set = true;
00090       if( serial_number_high_set ) //we received both bytes
00091         compute_serial();
00092     };
00093     void set_serial_number_high(unsigned int serial)
00094     {
00095       serial_number_high = serial;
00096 
00097       serial_number_high_set = true;
00098       if( serial_number_low_set ) //we received both bytes
00099         compute_serial();
00100     };
00101     void compute_serial()
00102     {
00103       serial_number = serial_number_low + (serial_number_high * 65536);
00104     };
00105 
00106     bool serial_number_low_set;
00107     bool serial_number_high_set;
00108     unsigned int serial_number_low;
00109     unsigned int serial_number_high;
00110     unsigned int serial_number;
00111 
00112     unsigned int assembly_data_year;
00113     unsigned int assembly_data_month;
00114     unsigned int assembly_data_day;
00115 
00116     int tests_;
00117     unsigned int can_error_counters;
00118 
00119     std::vector<tactiles::AllTactileData>* tactiles_;
00120   }; //end class SrActuatorState
00121 
00122   class SrMotorActuatorState : public SrActuatorState
00123   {
00124   public:
00125     SrMotorActuatorState() :
00126       SrActuatorState(),
00127       strain_gauge_left_(0),
00128       strain_gauge_right_(0),
00129       force_unfiltered_(0.0),
00130       pwm_(0),
00131       motor_gear_ratio(0),
00132       force_control_f_(0),
00133       force_control_p_(0),
00134       force_control_i_(0),
00135       force_control_d_(0),
00136       force_control_imax_(0),
00137       force_control_deadband_(0),
00138       force_control_sign_(0),
00139       force_control_frequency_(0)
00140     {}
00141 
00142     signed short strain_gauge_left_;
00143     signed short strain_gauge_right_;
00144 
00145 
00146     double force_unfiltered_;
00147 
00148     int pwm_;
00149 
00150     unsigned int motor_gear_ratio;
00151 
00152     int force_control_f_;
00153     int force_control_p_;
00154     int force_control_i_;
00155     int force_control_d_;
00156     int force_control_imax_;
00157     int force_control_deadband_;
00158     int force_control_sign_;
00159     int force_control_frequency_;
00160 
00161     int force_control_pterm;
00162     int force_control_iterm;
00163     int force_control_dterm;
00164   }; //end class SrMotorActuatorState
00165 
00166   class SrMuscleActuatorState : public SrActuatorState
00167   {
00168   public:
00169     SrMuscleActuatorState() :
00170       SrActuatorState()
00171     {}
00172 
00174     uint16_t pressure_[2];
00175     int8_t last_commanded_valve_[2];
00176   }; //end class SrMuscleActuatorState
00177 
00178   class SrMuscleActuatorCommand : public pr2_hardware_interface::ActuatorCommand
00179   {
00180   public:
00181     SrMuscleActuatorCommand() :
00182       pr2_hardware_interface::ActuatorCommand()
00183     {
00184       valve_[0] = 0;
00185       valve_[1] = 0;
00186     }
00187 
00188     int8_t valve_[2];
00189   }; //end class SrMuscleActuatorCommand
00190 
00191 
00192   class SrGenericActuator : public pr2_hardware_interface::Actuator
00193   {
00194   public:
00195     SrGenericActuator()
00196       : pr2_hardware_interface::Actuator()
00197     {}
00198 
00199     SrGenericActuator(std::string name)
00200       : pr2_hardware_interface::Actuator(name)
00201     {}
00202 
00203     //A virtual destructor to make the class polymorphic (the compiler is picky about trying to dynamic_cast non-polymorphic classes)
00204     virtual ~SrGenericActuator()
00205     {}
00206 
00207     //SrActuatorState state_;
00208   }; //end class SrGenericActuator
00209 
00213   class SrActuator : public SrGenericActuator
00214   {
00215   public:
00216     SrActuator()
00217       : SrGenericActuator()
00218     {}
00219 
00220     SrActuator(std::string name)
00221       : SrGenericActuator(name)
00222     {}
00223 
00224     virtual ~SrActuator()
00225     {}
00226 
00227     SrMotorActuatorState state_;
00228   }; //end class SrActuator
00229 
00233   class SrMuscleActuator : public SrGenericActuator
00234   {
00235   public:
00236     SrMuscleActuator()
00237       : SrGenericActuator()
00238     {}
00239 
00240     SrMuscleActuator(std::string name)
00241       : SrGenericActuator(name)
00242     {}
00243 
00244     virtual ~SrMuscleActuator()
00245     {}
00246 
00247     SrMuscleActuatorState state_;
00248     SrMuscleActuatorCommand command_;
00249   }; //end class SrActuator
00250 }
00251 
00252 /* For the emacs weenies in the crowd.
00253 Local Variables:
00254    c-basic-offset: 2
00255 End:
00256 */
00257 
00258 #endif
00259 


sr_hardware_interface
Author(s): Ugo Cupcic
autogenerated on Fri Aug 28 2015 13:09:09