TLDR
:These are a quick list of instructions to quickly install and run nav_rest_api_turtlebot
on your local workstation.
- Ubuntu
22.04.4
LTS - ROS 2
Humble
- Docker version
26.1.1
, build4cf5afa
Download nav_rest_api_turtlebot
repository locally:
cd $HOME
git clone https://github.com/cardboardcode/nav_rest_api_turtlebot --single-branch --depth 1
cd nav_rest_api_turtlebot
Build docker image using provided Dockerfile
:
docker build -t ros1_turtlebot3_rest_api .
Enable gui display forwarding for applications within docker:
xhost +local:docker
Create docker container from newly built docker image:
docker run -it --rm \
--name ros1_turtlebot3_rest_api_c \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--net=host \
ros1_turtlebot3_rest_api:latest /bin/bash
Run the following command to launch the REST API in the docker container:
source devel/setup.bash && roslaunch nav_rest_api server.launch
Run the turtlebot3 simulation in a new terminal within the docker container:
docker exec -it ros1_turtlebot3_rest_api_c bash
export TURTLEBOT3_MODEL=waffle
source devel/setup.bash && roslaunch nav_rest_api_turtlebot test.launch
Send a nav goal command to move the Turtlebot3 Waffle in simulation via REST API call:
curl --header "Content-Type: application/json" \
--request POST \
--data '{"robot_name": "robot0","location_x": "3","location_y": "0","location_th": "1.5707"}' \
http://localhost:8080/api/goal