roch_hardware.h
Go to the documentation of this file.
1 
33 #ifndef roch_BASE_roch_HARDWARE_H
34 #define roch_BASE_roch_HARDWARE_H
35 
42 #include "ros/ros.h"
43 #include "sensor_msgs/JointState.h"
44 #include "roch_msgs/RochStatus.h"
45 #include "roch_msgs/CliffEvent.h"
46 #include "roch_msgs/UltEvent.h"
47 #include "roch_msgs/PSDEvent.h"
48 #include "roch_msgs/SensorState.h"
49 #include <sensor_msgs/Imu.h>
50 #include <tf/tf.h>
51 #include <string>
52 
53 #include <angles/angles.h>
54 #include <std_msgs/String.h>
55 #include "roch_base/core/Message.h"
56 #include "roch_base/core/serial.h"
57 namespace roch_base
58 {
59 
63  class rochHardware :
65  {
66 
67  public:
68  rochHardware(ros::NodeHandle nh, ros::NodeHandle private_nh, double target_control_freq);
69 
71 
73 
74  void updateDiagnostics();
75 
76  void reportLoopDuration(const ros::Duration &duration);
77 
79 
80  void getRangefinderData();
81 
82  void getPlatformName();
83 
84  void getPlatAccData();
85 
87 
88  void showRawData();
89 
90  void publishRawData();
91 
92  public:
93 
95  double orientation[4];
99  double angular_velocity[3] ;
101  private:
102 
103  void initializeDiagnostics();
104 
105  void resetTravelOffset();
106 
108 
109  double linearToAngular(const double &travel) const;
110 
111  double angularToLinear(const double &angle) const;
112 
113  void limitDifferentialSpeed(double &travel_speed_left, double &travel_speed_right);
114 
115  void publishCliffEvent(const double &left, const double &right);
116 
117  void publishUltEvent(const double &left, const double &center, const double &right);
118 
119  void publishPSDEvent(const double &left, const double &center, const double &right);
120 
121  void publishWheelEvent(const float &leftOffset, const float &rightOffset);
122 
123  void publishSensorState();
124 
126 
127  // ROS Control interfaces
131 
132  // Diagnostics
137  roch_msgs::RochStatus roch_status_msg_;
143 
144  // ROS Parameters
146 
148 
149  double cliff_height_; //the height of cliff can scan (meter)
150 
151 
152  double ult_length_; //the lengthh of ult can detection (meter)
153 
154  double PSD_length_; //the lengthh of PSD can detection (meter)
155  std::string gyro_link_frame_;
156  std::vector<double> cliffbottom;
157  std::vector<double> ultbottom;
158  std::vector<double> psdbottom;
162  struct Joint
163  {
164  double position;
166  double velocity;
167  double effort;
169 
170  Joint() :
171  position(0), velocity(0), effort(0), velocity_command(0)
172  { }
173  } joints_[2];
174 
176  double X;
177  double X_Offset;
178  double Y;
179  double Y_Offset;
180  double Z;
181  double Z_Offset;
182 
184  X(0), X_Offset(0), Y(0), Y_Offset(0), Z(0), Z_Offset(0)
185  { }
186  }gyroData;
187 
188  struct SixAxisGyro{
189  double angle;
190  double angle_rate; // rad/s
192  double angle_offset;
194 
196  angle(0), angle_rate(0), angle_rate_offset(0), angle_offset(0)
197  { }
198  }sixGyro;
199 
200  struct CliffEvent{
201  enum State {
203  Cliff
204  } state;
205  enum Sensor {
207  Right
208  } sensor;
209  double leftbottom;
210  double rightbottom;
211  };
212 
213  struct UltEvent{
214  enum State {
216  Near
217  } state;
218  enum Sensor {
221  Right
222  } sensor;
223  double leftbottom;
224  double centerbottom;
225  double rightbottom;
226  };
227 
228  struct PSDEvent{
229  enum State {
231  Near
232  } state;
233  enum Sensor {
236  Right
237  } sensor;
238  double leftbottom;
239  double centerbottom;
240  double rightbottom;
241  };
242 
244 
246 
248 };
249 
250 };
251 
252  // namespace roch_base
253 #endif // ROCH_BASE_ROCH_HARDWARE_H
void publishPSDEvent(const double &left, const double &center, const double &right)
hardware_interface::JointStateInterface joint_state_interface_
ros::Publisher raw_data_command_publisher_
rochSoftwareDiagnosticTask software_status_task_
ros::Publisher diagnostic_publisher_
void reportLoopDuration(const ros::Duration &duration)
void publishUltEvent(const double &left, const double &center, const double &right)
double linearToAngular(const double &travel) const
ros::Publisher ult_event_publisher_
void limitDifferentialSpeed(double &travel_speed_left, double &travel_speed_right)
hardware_interface::VelocityJointInterface velocity_joint_interface_
ros::Publisher cliff_event_publisher_
std::vector< double > psdbottom
double angularToLinear(const double &angle) const
void publishWheelEvent(const float &leftOffset, const float &rightOffset)
double angular_velocity_covariance[9]
Definition: roch_hardware.h:97
ros::Publisher psd_event_publisher_
struct roch_base::rochHardware::ThreeAxisGyro gyroData
struct roch_base::rochHardware::SixAxisGyro sixGyro
double linear_acceleration_covariance[9]
Definition: roch_hardware.h:98
roch_msgs::RochStatus roch_status_msg_
std::string gyro_link_frame_
rochHardwareDiagnosticTask< sawyer::DataPowerSystem > power_status_task_
void writeOverallSpeedCommandsToHardware()
diagnostic_updater::Updater diagnostic_updater_
std::vector< double > ultbottom
rochHardwareDiagnosticTask< sawyer::DataSystemStatus > system_status_task_
double orientation_covariance[9]
Definition: roch_hardware.h:96
void publishCliffEvent(const double &left, const double &right)
ros::Publisher sensor_state_publisher_
hardware_interface::ImuSensorHandle::Data imuMsgData
Definition: roch_hardware.h:94
ros::NodeHandle private_nh_
hardware_interface::ImuSensorInterface imu_sensor_interface_
rochHardwareDiagnosticTask< sawyer::DataSafetySystemStatus > safety_status_task_
std::vector< double > cliffbottom
struct roch_base::rochHardware::Joint joints_[2]
rochHardware(ros::NodeHandle nh, ros::NodeHandle private_nh, double target_control_freq)


roch_base
Author(s): Mike Purvis , Paul Bovbel , Chen
autogenerated on Mon Jun 10 2019 14:41:14