38 #include <nav_msgs/Path.h> 39 #include <geometry_msgs/Twist.h> 46 std::string topic, publish_type;
47 nh.
param(
"global_plan_topic", topic, std::string(
"global_plan"));
48 nh.
param(
"global_plan_type", publish_type, std::string(
"Path3D"));
51 if (publish_type ==
"Path2D")
56 else if (publish_type ==
"")
62 if (publish_type !=
"Path3D")
64 ROS_ERROR_NAMED(
"Locomotor",
"Unknown global_plan_type \"%s\". Using Path3D instead.", publish_type.c_str());
75 nav_2d_msgs::Path2D to_publish = global_plan;
95 std::string topic, publish_type;
96 nh.
param(
"twist_topic", topic, std::string(
"cmd_vel"));
97 nh.
param(
"twist_type", publish_type, std::string(
"Twist3D"));
100 if (publish_type ==
"Twist2D")
105 else if (publish_type ==
"Twist2DStamped")
108 pub_ = global_nh.
advertise<nav_2d_msgs::Twist2DStamped>(topic, 1);
110 else if (publish_type ==
"")
116 if (publish_type !=
"Twist3D")
118 ROS_ERROR_NAMED(
"Locomotor",
"Unknown twist_type \"%s\". Using Twist3D instead.", publish_type.c_str());
void publish(const boost::shared_ptr< M > &message) const
TwistPublisher(ros::NodeHandle &nh)
double global_plan_epsilon_
nav_2d_msgs::Path2D pathToPath(const nav_msgs::Path &path)
void publishPath(const nav_2d_msgs::Path2D &global_plan)
geometry_msgs::Twist twist2Dto3D(const nav_2d_msgs::Twist2D &cmd_vel_2d)
PathPublisher(ros::NodeHandle &nh)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
nav_2d_msgs::Path2D compressPlan(const nav_2d_msgs::Path2D &input_path, double epsilon=0.1)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
uint32_t getNumSubscribers() const
#define ROS_ERROR_NAMED(name,...)
void publishTwist(const nav_2d_msgs::Twist2DStamped &command)