00001 00002 #include <ros/ros.h> 00003 #include <string> 00004 00005 namespace roboteq_msgs { 00006 ROS_DECLARE_MESSAGE(Feedback); 00007 ROS_DECLARE_MESSAGE(Status); 00008 } 00009 00010 00011 class MotorsMonitor { 00012 public: 00013 MotorsMonitor(ros::NodeHandle* nh); 00014 00015 bool ok(); 00016 00017 protected: 00018 ros::NodeHandle nh_; 00019 00020 // Callbacks receive inbound data 00021 void motor_feedback(const roboteq_msgs::FeedbackConstPtr, const int); 00022 void motor_status(const roboteq_msgs::StatusConstPtr&, const int); 00023 void msg_watchdog(const ros::TimerEvent&); 00024 int lookForSeriousFault(uint8_t, const int); 00025 00026 int fault_level_[4]; 00027 00028 ros::Subscriber fb_sub_[4], stat_sub_[4]; 00029 ros::Publisher estop_pub_; 00030 ros::Duration motors_timeout_; 00031 roboteq_msgs::StatusConstPtr last_received_status_[4]; 00032 roboteq_msgs::FeedbackConstPtr last_received_feedback_[4]; 00033 };