-
Notifications
You must be signed in to change notification settings - Fork 4
iRobot control with a keyboard
First, run a roscore, which will act as master and establishes connections between all ROS nodes.
roscore
For Create2 robot (Roomba 600/700 series), launch the ROS drive using the following command:
$ roslaunch ca_driver create_2.launch
Check the ROS Topics list to see if the robot drivers are publishing the state such as the odometry output in /odom, bumper sensor readings, etc.
$ rostopic
$ rostopic list
You can use $ rostopic pub /cmd_vel geometry_msgs/Twist <value>
as shown in the below image to see if your robot is responding to the velocity commands.
If you change z: 0.0
to z: 5.0" -r 10
, you rotate the robot. The mechanism behind is, you send geometry_msgs/Twist
messages to the topic cmd_vel
, which the robot listens to to get forward and angular velocity inputs.
Assuming you have installed the Teleoperation Twist Keyboard ROS package, run the ROS node for the Teleoperation Twist Keyboard
$ rosrun teleop_twist_keyboard teleop_twist_keyboard.py
Now you could use keys listed on the terminal interface to control the robot.
teleop_twist_keyboard
is to enable keyboard control to iRobot, reading from the keyboard input and publishing it to /cmd_vel topic with the message type geometry_msgs/Twist. For more details on this package, visit http://wiki.ros.org/teleop_twist_keyboard.
If you do not have a physical robot like create2, then you can still test the tutorial using a simulated turtle robot using
rosrun turtlesim turtlesim_node
Note, you will have to remap the /cmd_vel topic to /turtle1/cmd_vel if you use the turtlesim.