This repository contains the complete ROS 2 workspace for TurtleBot 3 robots, including sensor drivers.
New users experimenting with physical robots should read section Using Docker for Development on Physical Robots.
Follow the steps below to install this repository:
-
Clone the git repository. Be sure to include the
--recurseoption.git clone --recurse git@github.com:NU-IDEAS-Lab/robot_turtlebot3.git
-
Source ROS 2.
source /opt/ros/humble/setup.bash -
Build the workspace.
cd ./robot_turtlebot3/ colcon build -
Source the newly-built workspace.
source ./install/setup.bash
The TurtleBot 3 software should now be ready for use by other ROS 2 packages. You may wish to source the robot_turtlebot3 workspace automatically so that it does not need to be re-sourced in every new terminal.
Docker may be used for easy deployment of the robot software.
To manually build:
docker build --platform=linux/arm64 -t robot:arm64 -f robot.dockerfile .
To pull pre-built image automatically from the container repository:
docker pull ghcr.io/nu-ideas-lab/robot_turtlebot3:latest
To run the built Docker container:
docker run --privileged --net=host -v /dev:/dev --rm -it ghcr.io/nu-ideas-lab/robot_turtlebot3:latest /bin/bash
The robot_configuration repository may be used for automatic deployment of Docker images to the robots. Follow the instructions at that repository to set up, and then run the following command from your computer:
ansible-playbook -i ./inventory/ ./deploy-software.yml -l YOUR_ROBOT_NAMEThe latest robot production (robot) and development (robot_dev) containers will then be deployed to the robot.
This is a very basic workflow. Please feel free to modify/improve it.
-
Clone the repository onto your development computer.
-
Copy the repository to the
/home/ideas/robot_turtlebot3folder on the robot. See the VS Code Development Workflow section below for an automatic way to do this. -
We recommend to kill any currently-running Docker containers on the robot:
docker kill robot robot_dev -
Start the Docker container. If you used the Automatic Deployment for Physical Robots, run the following:
docker start -i robot_dev
If not, you may achieve the same effect manually:
docker run --privileged --net=host -v /dev:/dev -v ./robot_turtlebot3:/opt/robot_dev --rm -it ghcr.io/nu-ideas-lab/robot_turtlebot3:latest /bin/bash
Both commands should be equivalent, though the first is slightly easier to remember.
-
Inside the Docker container, change to the
/opt/robot_devdirectory:cd /opt/robot_dev -
Build the robot software:
colcon build
Certain packages are skipped when building on the robot (such as STVL) because the Raspberry Pi will run out of memory. See
colcon_defaults.yamlfor more details. -
Source the newly-built robot software:
source /opt/robot_dev/install/setup.bash -
Run the robot software:
ros2 launch robot_turtlebot3 robot.launch.yaml
We provide a VS Code workspace configuration which greatly simplifies development on physical platforms. Using the recommended SFTP extension, one can easily upload changes to the physical robots.
First, select the robot to which you wish to upload by pressing Ctrl+Shift+P and running the SFTP: Set Profile command. You should see a list of robots. Select the one you are using.
If you have never uploaded code to the robot before, or are unsure of the robot state, right-click on the robot_turtlebot3 folder in VS Code's left-hand pane and select Sync Local -> Remote.
After the initial synchronization, files will be uploaded automatically to the robot when you save them.