ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
As this tutorial shows, you need to subscribe to your topic /joy
and then assign the data from the joystick (with a proper normalization/scaling) to a Twist
message which you then can publish to your /cmd_vel
topic in order to move your youBot.
The tutorial shows an example of the callback, i.e. where you listen to the joystick data and then assign it to the Twist
message:
void TeleopTurtle::joyCallback(const sensor_msgs::Joy::ConstPtr& joy)
{
geometry_msgs::Twist twist;
twist.angular.z = a_scale_*joy->axes[angular_];
twist.linear.x = l_scale_*joy->axes[linear_];
vel_pub_.publish(twist);
}