NimbRo ROS Soccer Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
robotinterface.h
1 // NimbRo-OP robot hardware interface
2 // Author: Philipp Allgeuer <pallgeuer@ais.uni-bonn.de>
3 // Sebastian Schueller <schuell1@cs.uni-bonn.de>
4 // Max Schwarz <max.schwarz@uni-bonn.de>
5 
6 // Ensure header is only included once
7 #ifndef RC_ROBOTINTERFACE_H
8 #define RC_ROBOTINTERFACE_H
9 
10 // Includes
11 #include <robotcontrol/model/robotmodel.h>
12 #include <robotcontrol/hw/hardwareinterface.h>
13 #include <robotcontrol/hw/magfilter.h>
14 #include <robotcontrol/FadeTorqueAction.h>
15 #include <rc_utils/attitude_estimator.h>
16 #include <rc_utils/angle_estimator.h>
17 #include <rc_utils/firfilter.h>
18 #include <rc_utils/golay.h>
19 #include <robotcontrol/ServoDiag.h>
20 #include <rc_utils/low_pass_filter.h>
21 #include <rc_utils/spike_filter.h>
22 #include <nimbro_op_interface/Buzzer.h>
23 #include <nimbro_op_interface/LEDCommand.h>
24 #include <nimbro_op_interface/ReadOffset.h>
25 #include <nimbro_op_interface/AttEstCalib.h>
26 #include <nimbro_op_interface/CalibGyroStop.h>
27 #include <nimbro_op_interface/CalibGyroStart.h>
28 #include <nimbro_op_interface/CalibGyroReturn.h>
29 #include <nimbro_op_interface/CalibGyroAccNow.h>
30 #include <nimbro_op_interface/CalibGyroAccStop.h>
31 #include <actionlib/client/simple_action_client.h>
32 #include <rrlogger/LoggerHeartbeat.h>
33 #include <config_server/parameter.h>
34 #include <plot_msgs/plot_manager.h>
35 #include <ros/service_server.h>
36 #include <std_srvs/Empty.h>
37 #include <cm730/CM730.h>
38 #include <ros/timer.h>
39 
40 // Class forward declarations
41 namespace urdf { class Joint; }
42 namespace robotcontrol
43 {
44  class RobotModel;
45  class DynamicCommandGenerator;
46  typedef boost::shared_ptr<DynamicCommandGenerator> CommandGeneratorPtr;
47 }
48 
49 // NimbRo-OP interface namespace
50 namespace nimbro_op_interface
51 {
52 
74 class RobotInterface : public robotcontrol::HardwareInterface
75 {
76 public:
77  // Constructor/destructor
79  virtual ~RobotInterface();
80 
81  // Virtual function overrides
82  virtual bool init(robotcontrol::RobotModel* model);
83  virtual void deinit();
84  virtual boost::shared_ptr<robotcontrol::Joint> createJoint(const std::string& name);
85  virtual bool sendJointTargets();
86  virtual bool readJointStates();
87  virtual bool setStiffness(float torque);
88  virtual void getDiagnostics(robotcontrol::DiagnosticsPtr ptr);
89 
90 protected:
91  // Virtual functions for hardware abstraction
92  virtual bool initCM730();
93  virtual int readFeedbackData(bool onlyTryCM730);
94  virtual bool syncWriteJointTargets(size_t numDevices, const uint8_t* data);
95  virtual bool syncWriteTorqueEnable(size_t numDevices, const uint8_t* data);
96  virtual bool syncWriteTorqueLimit(size_t numDevices, const uint8_t* data);
97  virtual bool useModel() const { return m_useModel(); }
98 
99  // Scaling constants
100  static const double TICKS_PER_RAD = 2048.0 / M_PI; // From the fact that a complete revolution is 4096 ticks
101  static const double FULL_TORQUE = 1023.0; // The torque limit value that corresponds to full torque
102  static const double FULL_EFFORT = 32.0; // The P gain value that an effort of 1.0 corresponds to
103  static const double INT_TO_VOLTS = 0.1; // Multiply a voltage value read from the CM730 by this to convert it into volts (see 'cm730/firmware/CM730_HW/src/adc.c')
104  static const double GYRO_SCALE = (M_PI / 180) * (2 * 250) / 65536; // From control register CTRL_REG4 in "cm730/firmware/CM730_HW/src/gyro_acc.c": +-250dps is 65536 LSb
105  static const double ACC_SCALE = (2 * (4 * 9.81)) / 65536; // From control register CTRL_REG4 in "cm730/firmware/CM730_HW/src/gyro_acc.c": +-4g is 65536 LSb
106  static const double MAG_SCALE = 1 / 820.0; // From Config Register B in "cm730/firmware/CM730_APP/src/compass.c": 820 LSb/gauss
107 
109  robotcontrol::RobotModel* m_model;
110 
112  std::vector<cm730::BRData> m_servoData;
113 
115  cm730::BRBoard m_boardData;
116 
118  std::string m_robotNameStr;
119 
121  std::string m_robotTypeStr;
122 
130  struct CM730LedWriteData
131  {
132  uint8_t id;
133  uint8_t led_panel;
134  uint16_t rgbled5;
135  } __attribute__((packed));
136 
140  struct CM730BuzzerWriteData
141  {
142  uint8_t playLength;
143  uint8_t data;
144  } __attribute__((packed));
145 
151  struct JointCmdSyncWriteData
152  {
153  uint8_t id;
154  uint8_t p_gain;
155  uint8_t nothing;
156  uint16_t goal_position;
157  } __attribute__((packed));
158 
164  struct TorqueEnableSyncWriteData
165  {
166  uint8_t id;
167  uint8_t torque_enable;
168  } __attribute__((packed));
169 
174  struct TorqueLimitSyncWriteData
175  {
176  uint8_t id;
177  uint16_t torque_limit;
178  } __attribute__((packed));
179 
183  struct StatisticsReadData
184  {
185  uint8_t voltage;
186  uint8_t temperature;
187  } __attribute__((packed));
188 
189 private:
190  // Constants
191  const std::string CONFIG_PARAM_PATH;
192 
193  // Flag whether the real hardware is present (assumes no unless otherwise told)
194  bool m_haveHardware;
195 
199  struct DXLJoint : public robotcontrol::Joint
200  {
201  DXLJoint(const std::string& name);
202 
204  robotcontrol::CommandGeneratorPtr commandGenerator;
205 
206  // Constants
207  const std::string CONFIG_PARAM_PATH;
208 
210 
211  config_server::Parameter<std::string> type;
212  config_server::Parameter<int> id;
213  config_server::Parameter<int> tickOffset;
214  config_server::Parameter<bool> invert;
215  config_server::Parameter<bool> readFeedback;
216 
217 
219 
220  int voltage;
221  int temperature;
223 
225 
226  double realEffort;
227  double rawState;
229 
231  robotcontrol::ServoDiag diag;
232  };
233 
235  void updateJointSettings(DXLJoint* joint);
236  void setJointFeedbackTime(const ros::Time stamp);
237 
239  robotcontrol::CommandGeneratorPtr commandGenerator(const std::string& type);
240 
241  // Topic handlers
242  void handleStatistics(const ros::TimerEvent&);
243  void handleLEDCommand(const LEDCommandConstPtr& cmd);
244 
246  void handleButton(int number, bool longPress);
247  config_server::Parameter<bool> m_buttonPress0;
248  config_server::Parameter<bool> m_buttonPress1;
249  config_server::Parameter<bool> m_buttonPress2;
250 
256  inline DXLJoint* dxlJoint(size_t idx) { return (DXLJoint*) m_model->joint(idx).get(); }
257 
258  void sendCM730LedCommand();
259 
260  void waitForRelaxedServos();
261 
262  DXLJoint* dxlJointForID(int id);
263 
265  boost::shared_ptr<cm730::CM730> m_board;
266 
268  std::map<std::string, robotcontrol::CommandGeneratorPtr> m_generators;
269 
271  bool m_relaxed;
272 
274  ros::Timer m_statisticsTimer;
275 
277  size_t m_statIndex;
278 
280  double m_statVoltage;
281 
283  ros::ServiceServer m_srv_readOffsets;
284  ros::ServiceServer m_srv_readOffset;
285  bool handleReadOffsets(std_srvs::EmptyRequest& req, std_srvs::EmptyResponse& resp);
286  bool handleReadOffset(ReadOffsetRequest& req, ReadOffsetResponse& resp);
287 
288  // IMU orientation offsets
289  enum GyroAccOffsetMeasType
290  {
291  GAOMT_UPRIGHT = 0,
292  GAOMT_FRONT,
293  GAOMT_RIGHT,
294  GAOMT_BACK,
295  GAOMT_LEFT,
296  GAOMT_COUNT
297  };
298  struct GyroAccOffsetMeas
299  {
300  GyroAccOffsetMeasType type;
301  Eigen::Vector3d acc;
302  };
303  config_server::Parameter<bool> m_resetGyroAccOffset; // Trigger to reset the gyro/acc orientation offset to the identity rotation
304  config_server::Parameter<bool> m_resetMagOffset; // Trigger to reset the magnetometer orientation offset to the identity rotation
305  config_server::Parameter<float> m_gyroAccFusedYaw; // The fused yaw of the mounting orientation of the gyro/acc sensors
306  config_server::Parameter<float> m_gyroAccTiltAngle; // The tilt angle of the mounting orientation of the gyro/acc sensors
307  config_server::Parameter<float> m_gyroAccTiltAxisAngle; // The tilt axis angle of the mounting orientation of the gyro/acc sensors
308  config_server::Parameter<bool> m_magFlip; // A boolean flag whether the configured mounting orientation of the magnetometer sensor should be flipped by 180 degrees to ensure real CW rotations produce measured CW rotations, and the same for CCW rotations
309  config_server::Parameter<float> m_magFusedYaw; // The fused yaw of the mounting orientation of the magnetometer sensor
310  config_server::Parameter<float> m_magTiltAngle; // The tilt angle of the mounting orientation of the magnetometer sensor
311  config_server::Parameter<float> m_magTiltAxisAngle; // The tilt axis angle of the mounting orientation of the magnetometer sensor
312  config_server::Parameter<float> m_gyroAccMaxRelAccScale; // The maximum relative error in the norm of the gyro/acc calibration acc values relative to the norm of the upright measured value (0 => Norms from 100% to 100% are allowed, 1 => Norms from 0% to 200% are allowed)
313  config_server::Parameter<float> m_gyroAccMinYawAgreement; // The minimum level of required agreement in the fused yaw for the gyro/acc calibration (0 => No agreement required, 1 => Every data type average must point in the exact same direction)
314  ros::ServiceServer m_srv_imuOffsetsCalibGyroAccStart;
315  ros::ServiceServer m_srv_imuOffsetsCalibGyroAccNow;
316  ros::ServiceServer m_srv_imuOffsetsCalibGyroAccStop;
317  void handleResetGyroAccOffset();
318  void handleResetMagOffset();
319  bool handleCalibGyroAccStart(std_srvs::EmptyRequest& req, std_srvs::EmptyResponse& resp);
320  bool handleCalibGyroAccNow(CalibGyroAccNowRequest& req, CalibGyroAccNowResponse& resp);
321  bool handleCalibGyroAccStop(CalibGyroAccStopRequest& req, CalibGyroAccStopResponse& resp);
322  bool m_imuOffsetsGACalib;
323  std::vector<GyroAccOffsetMeas> m_imuOffsetsGAData;
324 
326  stateestimation::AttitudeEstimator m_attitudeEstimator; // Attitude estimator instance
327  stateestimation::AttitudeEstimator m_attEstNoMag; // Attitude estimator instance (no magnetometer)
328  stateestimation::AttitudeEstimator m_attEstYaw; // Attitude estimator instance (yaw without magnetometer)
329  config_server::Parameter<bool> m_attEstUseFusedMethod; // Boolean flag specifying which acc-only resolution method to use
330  void updateAttEstMethod(); // Transcribes the value from the config server parameters to the internals of the attitude estimator
331  config_server::Parameter<float> m_attEstKp; // Kp parameter (P gain) to use for the attitude estimator
332  config_server::Parameter<float> m_attEstTi; // Ti parameter (integral time constant) to use for the attitude estimator
333  config_server::Parameter<float> m_attEstKpQuick; // Maximum Kp parameter (P gain) to use for the attitude estimator during quick learning
334  config_server::Parameter<float> m_attEstTiQuick; // Maximum Ti parameter (integral time constant) to use for the attitude estimator during quick learning
335  config_server::Parameter<float> m_attEstKpYaw; // Kp parameter (P gain) to use for the yaw-integrating attitude estimator (Ti is essentially infinite)
336  config_server::Parameter<float> m_attEstKpYawQuick; // Maximum Kp parameter (P gain) to use for the yaw-integrating attitude estimator during quick learning (Ti is essentially infinite)
337  void updateAttEstPIGains(); // Transcribes the values from the config server parameters to the internals of the attitude estimator
338  config_server::Parameter<float> m_attEstMagCalibX; // m_attEstMagCalib_xyz should be equal to the vector value of m_magFilter.value() [i.e. RobotModel::magneticFieldVector()]
339  config_server::Parameter<float> m_attEstMagCalibY; // when the robot is completely upright and with its coordinate axes perfectly aligned with the global coordinate frame.
340  config_server::Parameter<float> m_attEstMagCalibZ; // Nominally this is when the robot has zero pitch/roll and is facing in the direction of the positive goal.
341  void updateAttEstMagCalib(); // Transcribes the values from the config server parameters to the internals of the attitude estimator
342  config_server::Parameter<float> m_attEstGyroBiasX; // An estimate of the gyro bias along the x axis (only modifies the attitude estimator whenever the config server parameter is updated in value)
343  config_server::Parameter<float> m_attEstGyroBiasY; // An estimate of the gyro bias along the y axis (only modifies the attitude estimator whenever the config server parameter is updated in value)
344  config_server::Parameter<float> m_attEstGyroBiasZ; // An estimate of the gyro bias along the z axis (only modifies the attitude estimator whenever the config server parameter is updated in value)
345  config_server::Parameter<bool> m_attEstGyroBiasUpdate; // Boolean config parameter to force a write of the config parameter gyro biases to the attitude estimators
346  config_server::Parameter<bool> m_attEstGyroBiasSetFM; // Boolean config parameter to trigger setting of the gyro bias estimate to the current gyro mean
347  config_server::Parameter<bool> m_attEstGyroBiasSetFSM; // Boolean config parameter to trigger setting of the gyro bias estimate to the current gyro smooth mean
348  Eigen::Vector3f m_attEstGyroBiasLast; // Variable used to check whether the gyro bias config server parameters have changed
349  void updateAttEstGyroCalib(); // Checks whether the value of the gyro bias on the config server has changed, and if so transcribes the gyro bias to the internals of the attitude estimator
350  void setAttEstGyroCalib(const Eigen::Vector3f& bias); // Writes the given gyro bias to the internals of the attitude estimator
351  void setAttEstGyroBiasFromMean(); // Writes the current gyro mean into the attitude estimator gyro bias config variables
352  void setAttEstGyroBiasFromSmoothMean(); // Writes the current gyro smooth mean into the attitude estimator gyro bias config variables
353 
355  ros::ServiceServer m_srv_attEstCalibrate;
356  bool handleAttEstCalibrate(nimbro_op_interface::AttEstCalibRequest& req, nimbro_op_interface::AttEstCalibResponse& resp);
357 
359  stateestimation::AngleEstimator m_angleEstimator;
360 
361  // Temperature processing
362  config_server::Parameter<float> m_temperatureLowPassTs;
363  rc_utils::LowPassFilter m_temperatureLowPass;
364  double m_temperature;
365  void updateTempLowPassTs();
366 
367  // Voltage processing
368  config_server::Parameter<float> m_voltageLowPassTs;
369  rc_utils::LowPassFilter m_voltageLowPass;
370  bool m_initedVoltage;
371  double m_voltage;
372  void updateVoltageLowPassTs();
373 
374  // Acc data processing
375  config_server::Parameter<float> m_accLowPassMeanTs;
376  rc_utils::LowPassFilterT<Eigen::Vector3d> m_accLowPassMean;
377  Eigen::Vector3d m_accMean;
378  void updateAccLowPassMeanTs();
379 
380  // FIR filters for accelerometer data smoothing
381  rc_utils::FIRFilter<9> m_fir_accX;
382  rc_utils::FIRFilter<9> m_fir_accY;
383  rc_utils::FIRFilter<11> m_fir_accZ;
384 
385  // Gyro data processing
386  config_server::Parameter<bool> m_gyroEnableAutoCalib;
387  config_server::Parameter<float> m_gyroScaleFactorHT;
388  config_server::Parameter<float> m_gyroScaleFactorLT;
389  config_server::Parameter<float> m_gyroTemperatureHigh;
390  config_server::Parameter<float> m_gyroTemperatureLow;
391  config_server::Parameter<float> m_gyroLowPassMeanTs;
392  config_server::Parameter<float> m_gyroLowPassMeanTsHigh;
393  config_server::Parameter<float> m_gyroStabilityBound;
394  config_server::Parameter<float> m_gyroCalibFadeTimeStart;
395  config_server::Parameter<float> m_gyroCalibFadeTimeDur;
396  config_server::Parameter<float> m_gyroCalibTsSlow;
397  config_server::Parameter<float> m_gyroCalibTsFast;
398  rc_utils::LowPassFilterT<Eigen::Vector3d> m_gyroLowPassMean;
399  rc_utils::LowPassFilterT<Eigen::Vector3d> m_gyroVeryLowPassMean;
400  Eigen::Vector3d m_gyroMean;
401  Eigen::Vector3d m_gyroMeanSmooth;
402  unsigned int m_gyroStableCount;
403  bool m_gyroBiasAdjusting;
404  void updateGyroLowPassMeanTs();
405  void updateGyroVeryLowPassMeanTs();
406 
407  // Gyro calibration
408  bool handleCalibrateGyroStart(nimbro_op_interface::CalibGyroStartRequest& req, nimbro_op_interface::CalibGyroStartResponse& resp);
409  bool handleCalibrateGyroReturn(nimbro_op_interface::CalibGyroReturnRequest& req, nimbro_op_interface::CalibGyroReturnResponse& resp);
410  bool handleCalibrateGyroStop(nimbro_op_interface::CalibGyroStopRequest& req, nimbro_op_interface::CalibGyroStopResponse& resp);
411  bool handleCalibrateGyroAbort(std_srvs::EmptyRequest& req, std_srvs::EmptyResponse& resp);
412  ros::ServiceServer m_srv_calibrateGyroStart;
413  ros::ServiceServer m_srv_calibrateGyroReturn;
414  ros::ServiceServer m_srv_calibrateGyroStop;
415  ros::ServiceServer m_srv_calibrateGyroAbort;
416  int m_gyroCalibrating;
417  int m_gyroCalibType;
418  int m_gyroCalibNumTurns;
419  int m_gyroCalibLoopCount;
420  int m_gyroCalibLoopCountFirst;
421  int m_gyroCalibUpdateCount;
422  int m_gyroCalibUpdateCountFirst;
423  double m_gyroCalibScaleFactor;
424  double m_gyroCalibInitYaw;
425  double m_gyroCalibInitTemp;
426  double m_gyroCalibMiddleYaw;
427  double m_gyroCalibMiddleTemp;
428  double m_gyroCalibCurYaw;
429 
430  // Magnetometer data processing
431  config_server::Parameter<bool> m_useMagnetometer;
432  config_server::Parameter<float> m_magSpikeMaxDelta;
433  rc_utils::SpikeFilter m_magSpikeFilterX;
434  rc_utils::SpikeFilter m_magSpikeFilterY;
435  rc_utils::SpikeFilter m_magSpikeFilterZ;
436  rc_utils::FIRFilter<9> m_magFirFilterX;
437  rc_utils::FIRFilter<9> m_magFirFilterY;
438  rc_utils::FIRFilter<9> m_magFirFilterZ;
439  stateestimation::MagFilter m_magHardIronFilter;
440  void updateMagSpikeMaxDelta();
441 
443  config_server::Parameter<bool> m_useModel;
444 
446  config_server::Parameter<float> m_effortSlopeLimit;
447 
449  config_server::Parameter<float> m_rawStateSlopeLimit;
450 
452  config_server::Parameter<bool> m_useServos;
453 
455  enum PMIDs
456  {
457  PM_ANGEST_PPITCH = 0,
458  PM_ANGEST_PROLL,
459  PM_ATTEST_FYAW,
460  PM_ATTEST_FPITCH,
461  PM_ATTEST_FROLL,
462  PM_ATTEST_FHEMI,
463  PM_ATTEST_BIAS_X,
464  PM_ATTEST_BIAS_Y,
465  PM_ATTEST_BIAS_Z,
466  PM_ATTEST_NOMAG_FYAW,
467  PM_ATTEST_NOMAG_FPITCH,
468  PM_ATTEST_NOMAG_FROLL,
469  PM_ATTEST_NOMAG_FHEMI,
470  PM_ATTEST_NOMAG_BIAS_X,
471  PM_ATTEST_NOMAG_BIAS_Y,
472  PM_ATTEST_NOMAG_BIAS_Z,
473  PM_ATTEST_YAW_FYAW,
474  PM_ATTEST_YAW_FPITCH,
475  PM_ATTEST_YAW_FROLL,
476  PM_ATTEST_YAW_FHEMI,
477  PM_ATTEST_YAW_BIAS_X,
478  PM_ATTEST_YAW_BIAS_Y,
479  PM_ATTEST_YAW_BIAS_Z,
480  PM_GYRO_X,
481  PM_GYRO_Y,
482  PM_GYRO_Z,
483  PM_GYRO_N,
484  PM_GYROMEAN_X,
485  PM_GYROMEAN_Y,
486  PM_GYROMEAN_Z,
487  PM_GYROMEAN_N,
488  PM_GYROMEAN_SMOOTH_X,
489  PM_GYROMEAN_SMOOTH_Y,
490  PM_GYROMEAN_SMOOTH_Z,
491  PM_GYROMEAN_SMOOTH_N,
492  PM_GYRO_MEAN_OFFSET,
493  PM_GYRO_STABLE_TIME,
494  PM_GYRO_BIAS_TS,
495  PM_GYRO_BIAS_ALPHA,
496  PM_GYRO_SCALE_FACTOR,
497  PM_ACC_XRAW,
498  PM_ACC_YRAW,
499  PM_ACC_ZRAW,
500  PM_ACC_NRAW,
501  PM_ACC_X,
502  PM_ACC_Y,
503  PM_ACC_Z,
504  PM_ACC_N,
505  PM_ACCMEAN_X,
506  PM_ACCMEAN_Y,
507  PM_ACCMEAN_Z,
508  PM_ACCMEAN_N,
509  PM_MAG_XRAW,
510  PM_MAG_YRAW,
511  PM_MAG_ZRAW,
512  PM_MAG_XSPIKE,
513  PM_MAG_YSPIKE,
514  PM_MAG_ZSPIKE,
515  PM_MAG_XIRON,
516  PM_MAG_YIRON,
517  PM_MAG_ZIRON,
518  PM_MAG_X,
519  PM_MAG_Y,
520  PM_MAG_Z,
521  PM_MAG_N,
522  PM_TEMPERATURE,
523  PM_VOLTAGE,
524  PM_SENSOR_DT,
525  PM_COUNT
526  };
527  plot_msgs::PlotManagerFS m_PM;
528  config_server::Parameter<bool> m_plotRobotInterfaceData;
529  void configurePlotManager();
530 
532  ros::Publisher m_pub_buttons;
533 
535  ros::Publisher m_pub_led_state;
536 
538  actionlib::SimpleActionClient<robotcontrol::FadeTorqueAction> m_act_fadeTorque;
539 
540  // Button variables
541  enum ButtonPressState
542  {
543  BPS_RELEASED = 0,
544  BPS_SHORT_PRESS,
545  BPS_LONG_PRESS,
546  BPS_DO_RELAX,
547  BPS_DO_UNRELAX,
548  BPS_COUNT
549  };
550  uint8_t m_lastButtons;
551  ros::Time m_buttonTime0;
552  ros::Time m_buttonTime1;
553  ros::Time m_buttonLastRec0;
554  ButtonPressState m_buttonState0;
555  ButtonPressState m_buttonState1;
556  config_server::Parameter<bool> m_showButtonPresses;
557 
558  // Query set for the CM730
559  std::vector<int> m_cm730_queryset;
560 
561  // Servo failure management
562  bool m_commsOk;
563  int m_totalFailCount;
564  int m_consecFailCount;
565  int m_commsSuspCount;
566  int m_lastFailCount;
567  int m_lastFailCountSev;
568  int m_lastCommsSuspCount;
569  bool m_enableCommsSusp;
570  ros::Time m_timeLastFailCount;
571  ros::Time m_timeLastFailCountSev;
572  ros::Time m_timeLastCommsSusp;
573  ros::Time m_timeLastSuspCheck;
574  config_server::Parameter<bool> m_showServoFailures;
575 
576  // CM730 variables
577  bool m_skipStep;
578  bool m_cm730Suspend;
579  ros::Time m_lastSensorTime;
580  ros::Time m_lastCM730Time;
581 
582  // LED variables
583  LEDCommand m_ledCommand;
584  bool m_hadRX;
585  bool m_hadTX;
586  ros::Subscriber m_sub_led;
587  config_server::Parameter<bool> m_robPause; // This shadows the robotcontrol pause configuration to pause the statistics timer when robotcontrol is paused
588 
589  // Buzzer variables
590  ros::Subscriber m_sub_buzzer;
591  bool m_haveBuzzerData;
592  CM730BuzzerWriteData m_buzzerData;
593  void handleBuzzerCommand(const BuzzerConstPtr& cmd);
594 
595  // Fade in/out on button press
596  robotcontrol::RobotModel::State m_state_relaxed;
597  robotcontrol::RobotModel::State m_state_setting_pose;
598  actionlib::SimpleActionClient<robotcontrol::FadeTorqueAction> m_fadeTorqueClient;
599  bool m_fadingIsTriggered;
600  void sendFadeTorqueGoal(float torque);
601  void resetFadingTriggered();
602 
603  // Logger heartbeat
604  void sendLoggerHeartbeat();
605  void sendLoggerHeartbeat(bool log);
606  ros::Publisher m_pub_logger;
607  rrlogger::LoggerHeartbeat m_loggerMsg;
608  ros::Time m_loggerStamp;
609 };
610 
611 }
612 
613 #endif
614 
615 // EOF
robotcontrol::RobotModel * m_model
The robot model.
Definition: robotinterface.h:109
virtual void getDiagnostics(robotcontrol::DiagnosticsPtr ptr)
Definition: robotinterface.cpp:1888
virtual bool init(robotcontrol::RobotModel *model)
Definition: robotinterface.cpp:435
RobotInterface()
Definition: robotinterface.cpp:109
std::string m_robotTypeStr
Robot type.
Definition: robotinterface.h:121
virtual void deinit()
Definition: robotinterface.cpp:344
virtual boost::shared_ptr< robotcontrol::Joint > createJoint(const std::string &name)
Definition: robotinterface.cpp:356
virtual bool readJointStates()
Definition: robotinterface.cpp:759
virtual ~RobotInterface()
Definition: robotinterface.cpp:337
cm730::BRBoard m_boardData
Bulk read buffer for CM730 feedback (e.g. IMU)
Definition: robotinterface.h:115
std::string m_robotNameStr
Robot name.
Definition: robotinterface.h:118
std::vector< cm730::BRData > m_servoData
Bulk read buffer for servo feedback.
Definition: robotinterface.h:112
Real robot interface.
Definition: robotinterface.h:74