25 #include "geometry_msgs/Twist.h" 27 #include "sensor_msgs/Joy.h" 44 void joyCallback(
const sensor_msgs::Joy::ConstPtr& joy);
45 void sendCmdVelMsg(
const sensor_msgs::Joy::ConstPtr& joy_msg,
const std::string& which_map);
98 nh_param->
param<
double>(
"scale_angular_turbo",
109 ROS_INFO_NAMED(
"TeleopTwistJoy",
"Linear axis %s on %i at scale %f.",
112 "Turbo for linear axis %s is scale %f.", it->first.c_str(),
pimpl_->
scale_linear_map[
"turbo"][it->first]);
118 ROS_INFO_NAMED(
"TeleopTwistJoy",
"Angular axis %s on %i at scale %f.",
127 double getVal(
const sensor_msgs::Joy::ConstPtr& joy_msg,
const std::map<std::string, int>& axis_map,
128 const std::map<std::string, double>& scale_map,
const std::string& fieldname)
130 if (axis_map.find(fieldname) == axis_map.end() ||
131 scale_map.find(fieldname) == scale_map.end() ||
132 joy_msg->axes.size() <= axis_map.at(fieldname))
137 return joy_msg->axes[axis_map.at(fieldname)] * scale_map.at(fieldname);
141 const std::string& which_map)
144 geometry_msgs::Twist cmd_vel_msg;
177 geometry_msgs::Twist cmd_vel_msg;
#define ROS_INFO_NAMED(name,...)
#define ROS_INFO_COND_NAMED(cond, name,...)
void publish(const boost::shared_ptr< M > &message) const
std::map< std::string, std::map< std::string, double > > scale_linear_map
std::map< std::string, int > axis_angular_map
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
double getVal(const sensor_msgs::Joy::ConstPtr &joy_msg, const std::map< std::string, int > &axis_map, const std::map< std::string, double > &scale_map, const std::string &fieldname)
std::map< std::string, std::map< std::string, double > > scale_angular_map
TeleopTwistJoy(ros::NodeHandle *nh, ros::NodeHandle *nh_param)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
std::map< std::string, int > axis_linear_map
ros::Publisher cmd_vel_pub
bool getParam(const std::string &key, std::string &s) const
void sendCmdVelMsg(const sensor_msgs::Joy::ConstPtr &joy_msg, const std::string &which_map)
void joyCallback(const sensor_msgs::Joy::ConstPtr &joy)