33 #include <boost/assign/list_of.hpp> 37 const uint8_t LEFT = 0, RIGHT = 1;
49 private_nh_(private_nh),
50 system_status_task_(husky_status_msg_),
51 power_status_task_(husky_status_msg_),
52 safety_status_task_(husky_status_msg_),
53 software_status_task_(husky_status_msg_, target_control_freq)
79 for (
int i = 0; i < 4; i++)
86 ROS_ERROR(
"Could not get encoder data to calibrate travel offset");
97 std::ostringstream hardware_id_stream;
98 hardware_id_stream <<
"Husky " << info->getModel() <<
"-" << info->getSerial();
114 ros::V_string joint_names = boost::assign::list_of(
"front_left_wheel")
115 (
"front_right_wheel")(
"rear_left_wheel")(
"rear_right_wheel");
116 for (
unsigned int i = 0; i < joint_names.size(); i++)
124 joint_state_handle, &
joints_[i].velocity_command);
151 ROS_DEBUG_STREAM(
"Received travel information (L:" << enc->getTravel(LEFT) <<
" R:" << enc->getTravel(RIGHT) <<
")");
152 for (
int i = 0; i < 4; i++)
157 if (std::abs(delta) < 1.0)
165 ROS_DEBUG(
"Dropping overflow measurement from encoder");
174 ROS_DEBUG_STREAM(
"Received linear speed information (L:" << speed->getLeftSpeed() <<
" R:" << speed->getRightSpeed() <<
")");
175 for (
int i = 0; i < 4; i++)
215 double large_speed = std::max(std::abs(diff_speed_left), std::abs(diff_speed_right));
void registerInterface(T *iface)
void connect(std::string port)
ros::Publisher diagnostic_publisher_
HuskySoftwareDiagnosticTask software_status_task_
void publish(const boost::shared_ptr< M > &message) const
HuskyHardwareDiagnosticTask< clearpath::DataSafetySystemStatus > safety_status_task_
husky_msgs::HuskyStatus husky_status_msg_
void setHardwareID(const std::string &hwid)
void add(const std::string &name, TaskFunction f)
void reportLoopDuration(const ros::Duration &duration)
void initializeDiagnostics()
struct husky_base::HuskyHardware::Joint joints_[4]
void registerControlInterfaces()
hardware_interface::JointStateInterface joint_state_interface_
std::vector< std::string > V_string
diagnostic_updater::Updater diagnostic_updater_
void updateControlFrequency(double frequency)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
ros::NodeHandle private_nh_
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
HuskyHardwareDiagnosticTask< clearpath::DataSystemStatus > system_status_task_
#define ROS_DEBUG_STREAM(args)
void registerHandle(const JointStateHandle &handle)
double linearToAngular(const double &travel) const
void updateJointsFromHardware()
hardware_interface::VelocityJointInterface velocity_joint_interface_
double angularToLinear(const double &angle) const
void configureLimits(double max_speed, double max_accel)
static Ptr requestData(double timeout)
HuskyHardware(ros::NodeHandle nh, ros::NodeHandle private_nh, double target_control_freq)
void writeCommandsToHardware()
void limitDifferentialSpeed(double &travel_speed_left, double &travel_speed_right)
HuskyHardwareDiagnosticTask< clearpath::DataPowerSystem > power_status_task_
void controlSpeed(double speed_left, double speed_right, double accel_left, double accel_right)