These are instructions for running ROS code on a physical Turtlebot4 in the John Crerar Library.
Each Turtlebot4 has two main components (1) an iRobot Create base and (2) a RaspberryPi. The RaspberryPi is connected to and controls the robot's sensors and arm and is the main interface between the user PC and the Create base. We have configured the Turtlebot4 robots with the Discovery Server network protocol.
To start the robot boot process, pick up the Turtlebot4 robot by its base and place it on a charger. The robot should power on automatically. WAIT for the robot to finish its boot process before trying to connect - it should take about 2.5 minutes and the robot will make a "chime" noise once the boot process is complete.
You will need to ensure your computer is connected to the correct wifi network:
eduroam
for best performance.intro_robo
wifi network (ask teaching team for the network password).
Next, you'll have to setup some environment variables to establish communication between your PC and the specific robot you wish to control: ROS_DOMAIN_ID
, ROS_DISCOVERY_SERVER
, and ROS_LOCALHOST_ONLY
.
$ set_robot_num [robot-num]
The set_robot_num
bash function is one that we wrote to automatically set the ROS_DISCOVERY_SERVER
to the IP address of the desired robot and to set ROS_DOMAIN_ID
to the number of the robot.
$ echo $ROS_DOMAIN_ID
~/intro_robo_ws/src/intro_robo/intro_robo_utils/discover_server_env_variables.sh
which is sourced in your .bashrc
file.ROS_LOCALHOST_ONLY=1
, otherwise, if you're using the physical Turtlebot4 robot, you'll want ROS_LOCALHOST_ONLY=0
. You can change this variable by editing your .bashrc
file:
$ nano ~/.bashrc
After editing it to set ROS_LOCALHOST_ONLY
to your desired value, source the .bashrc
so your changes take effect:
$ source ~/.bashrc
In order to work properly, your Turtlebot4 it needs to have established a connection between its RaspberryPi and Create base. To check to make sure everything is working correctly, check the 5 LEDs on the robot. All 5 LEDs should be green. If the COMM and BATT lights are off, you'll need to reboot the RaspberryPi to properly establish a connection with the Create base.
If all 5 LEDs are green, you're all set and can continue to the next step!
If the COMM and BATT LEDs are off, you'll need to reboot the RaspberryPi to re-establish a connection with the Create base. First SSH into the robot (password: turtlebot4
)
$ ssh ubuntu@$ROBOT_IP
Then, in the same terminal, run the command:
$ sudo reboot
Finally, wait for the RaspberryPi to reboot, after which all 5 LEDs should be green.
There are a few different ways to test your computer's connection to your specific Turtlebot4. Here are a few options:
/tb11
, for example, if you're trying to connect to Turtlebot 11.
tb11
below) with the one that you're currently working with:
$ ros2 topic pub /tb11/cmd_vel geometry_msgs/msg/Twist \
"linear:
x: 1.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
TODO
Unlike the Turtlebot4, the OpenManipulatorX arm does not automatically start publishing and subscribing to ROS2 topics as soon as it turns on. You'll have to run the bringup code for the arm and start up MoveIt! every time you want to work with it. Follow the steps below:
turtlebot4
), check USB port number, and run bringup:
$ set_robot_num [robot_num]
$ ssh ubuntu@$ROBOT_IP
$ sudo dmesg | grep ttyUSB
After running sudo dmesg | grep ttyUSB look for which USB port the FTDI USB Serial Device
is connected to, it should be either ttyUSB0
or ttyUSB1
.
Now run the bringup command for the arm by specifying the USB port you identified in the prior step.
$ bringup_arm port_name:=/dev/ttyUSB1
bringup_arm
is an alias for the command ros2 launch open_manipulator_x_bringup hardware.launch.py
.
$ ssh ubuntu@$ROBOT_IP
$ start_moveit
start_moveit
is an alias for the command ros2 launch open_manipulator_x_moveit_config move_group.launch.py
.
$ ros2 launch open_manipulator_x_gui open_manipulator_x_gui.launch.py
$ ros2 run [package-name] [file-name]