husky_hardware.h
Go to the documentation of this file.
00001 
00032 #ifndef HUSKY_BASE_HUSKY_HARDWARE_H
00033 #define HUSKY_BASE_HUSKY_HARDWARE_H
00034 
00035 #include "husky_base/husky_diagnostics.h"
00036 #include "diagnostic_updater/diagnostic_updater.h"
00037 #include "hardware_interface/joint_state_interface.h"
00038 #include "hardware_interface/joint_command_interface.h"
00039 #include "hardware_interface/robot_hw.h"
00040 #include "ros/ros.h"
00041 #include "sensor_msgs/JointState.h"
00042 #include "husky_msgs/HuskyStatus.h"
00043 #include <string>
00044 
00045 namespace husky_base
00046 {
00047 
00051   class HuskyHardware :
00052     public hardware_interface::RobotHW
00053   {
00054   public:
00055     HuskyHardware(ros::NodeHandle nh, ros::NodeHandle private_nh, double target_control_freq);
00056 
00057     void updateJointsFromHardware();
00058 
00059     void writeCommandsToHardware();
00060 
00061     void updateDiagnostics();
00062 
00063     void reportLoopDuration(const ros::Duration &duration);
00064 
00065   private:
00066 
00067     void initializeDiagnostics();
00068 
00069     void resetTravelOffset();
00070 
00071     void registerControlInterfaces();
00072 
00073     double linearToAngular(const double &travel) const;
00074 
00075     double angularToLinear(const double &angle) const;
00076 
00077     void limitDifferentialSpeed(double &travel_speed_left, double &travel_speed_right);
00078 
00079     ros::NodeHandle nh_, private_nh_;
00080 
00081     // ROS Control interfaces
00082     hardware_interface::JointStateInterface joint_state_interface_;
00083     hardware_interface::VelocityJointInterface velocity_joint_interface_;
00084 
00085     // Diagnostics
00086     ros::Publisher diagnostic_publisher_;
00087     husky_msgs::HuskyStatus husky_status_msg_;
00088     diagnostic_updater::Updater diagnostic_updater_;
00089     HuskyHardwareDiagnosticTask<clearpath::DataSystemStatus> system_status_task_;
00090     HuskyHardwareDiagnosticTask<clearpath::DataPowerSystem> power_status_task_;
00091     HuskyHardwareDiagnosticTask<clearpath::DataSafetySystemStatus> safety_status_task_;
00092     HuskySoftwareDiagnosticTask software_status_task_;
00093 
00094     // ROS Parameters
00095     double wheel_diameter_, max_accel_, max_speed_;
00096 
00097     double polling_timeout_;
00098 
00102     struct Joint
00103     {
00104       double position;
00105       double position_offset;
00106       double velocity;
00107       double effort;
00108       double velocity_command;
00109 
00110       Joint() :
00111         position(0), velocity(0), effort(0), velocity_command(0)
00112       { }
00113     } joints_[4];
00114   };
00115 
00116 }  // namespace husky_base
00117 #endif  // HUSKY_BASE_HUSKY_HARDWARE_H


husky_base
Author(s): Mike Purvis , Paul Bovbel
autogenerated on Sat Jun 8 2019 18:26:01