3 #include "sensor_msgs/Joy.h" 4 #include "geometry_msgs/Twist.h" 23 void joyCallback(
const sensor_msgs::Joy::ConstPtr& msg);
42 std::ostringstream strs;
43 strs << std::endl <<
"axes: [";
44 for(
size_t i=0; i < msg->axes.size(); i++)
45 strs << msg->axes[i] <<
",";
46 strs <<
"]" << std::endl;
48 for(
size_t i=0; i < msg->buttons.size(); i++)
49 strs << msg->buttons[i] <<
",";
50 strs <<
"]" << std::endl;
61 if (msg->buttons[4] || msg->buttons[5])
66 geometry_msgs::Twist out_pioneer_cmd_vel;
67 geometry_msgs::Twist out_biclops_cmd_vel;
73 out_pioneer_cmd_vel.angular.z = msg->axes[3];
74 out_pioneer_cmd_vel.linear.x = msg->axes[4];
75 out_biclops_cmd_vel.linear.x = 0;
76 out_biclops_cmd_vel.linear.y = 0;
89 geometry_msgs::Twist out_pioneer_cmd_vel;
101 geometry_msgs::Twist out_biclops_cmd_vel;
107 int main(
int argc,
char **argv)
109 ros::init(argc, argv,
"TeleopPioneerPan");
void publish(const boost::shared_ptr< M > &message) const
void twistPioneerCallback(const geometry_msgs::Twist::ConstPtr &msg)
ros::Publisher pubTwistPioneer_
ros::Subscriber subTwistBiclops_
geometry_msgs::Twist in_pioneer_cmd_vel_
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void joyCallback(const sensor_msgs::Joy::ConstPtr &msg)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
Joy2twist(int argc, char **argv)
geometry_msgs::Twist in_biclops_cmd_vel_
ROSCPP_DECL void spin(Spinner &spinner)
ros::Publisher pubTwistBiclops_
int main(int argc, char **argv)
void twistBiclopsCallback(const geometry_msgs::Twist::ConstPtr &msg)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::Subscriber subTwistPioneer_