Position controller to move the turtlebot3.
Just like turtlesim_controller package, this package implements a simple position controller to the turtlebot3. Given a goal position
Where
Where
Next, it's a recording of a working demonstration. Note that we just sent the turtlebot3 some random positions to go.
Demo
Just clone this project in your ROS2 workspace:
cd ~/ros_ws/src
git clone https://github.com/luizcarloscf/autonomous-robots.git
cd ~/ros_ws
Then, build this package with:
rosdep install -i --from-path src --rosdistro humble -y
colcon build --packages-select=turtlebot3_controller
source install/setup.bash
Finally, you can launch Gazebo with turtlebot3 in an empty world:
ros2 launch turtlebot3_controller turtlebot3_controller_launch.py
The above launch script also starts the turtlebot3 controller. You can test it by opening another terminal and executing (just remenber to source the workspace in this new terminal):
source install/setup.bash
ros2 action send_goal /task turtlebot3_controller/action/Task "{x: [1.0,2.0,-1.0], y: [1.0,2.0,-1.0]}"
Running with Docker
Not really safe, but it works.
sudo xhost +local:root
If you have Docker installed, you dont need to build anything. Just pull our image and test it.
docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:rw --device /dev/dri/ luizcarloscf/autonomous-robots:main /bin/bash
The first thing you'll need to do is run the gazebo inside the container:
gazebo
I haven't figured out why yet, but the first launch of the gazebo inside the container takes a long time. After the gazebo has opened the first time, you can close it and run the package launch:
ros2 launch turtlebot3_controller turtlebot3_controller_launch.py
If you want to control the robots, just open a new container in the same network and run the action client node:
docker run -it luizcarloscf/autonomous-robots:main /bin/bash
ros2 action send_goal /task turtlebot3_controller/action/Task "{x: [1.0,2.0,-1.0], y: [1.0,2.0,-1.0]}"