ROS2 implementation of the official gym-duckietown-ros-agent.
The gym-duckietown-ros2-agent package has been tested under ROS2 Eloquent and Ubuntu 18.04.
If you haven't installed ROS2 already, please follow this tutorial to set up your system. ROS2 is required to use this package.
Besides a working ROS2 installation, the duckietown-gym-daffy package is required. You can install it as described here or via pip.
pip3 install duckietown-gym-daffy
(optional) To fully leverage the simulation ensure to have the ros-eloquent-image-transport
and ros-eloquent-image-transport-plugins
packages installed:
sudo apt install ros-eloquent-image-transport ros-eloquent-image-transport-plugins
In order to build this package you have to clone this repository and the duckietown_msgs repository in your workspace.
cd <ros2-workspace>/src
git clone https://github.com/nlimpert/gym_duckietown_ros2_agent
git clone https://github.com/nlimpert/duckietown_msgs
After that's done, go to your workspace folder and build the packages.
cd <ros2-workspace>
colcon build --symlink-install
After building the packages and sourcing your workspaces setup.bash
you can start the agent as follows.
ros2 run gym_duckietown_ros2_agent rosagent
You are now able to receive the camera image via the /None/corrected_image/compressed
topic. By sending velocity commands for the left and right wheel through the /None/wheels_driver_node/wheels_cmd
topic, you are able to make the duckiebot move.
To test out you can view the camera image as follows.
ros2 run rqt_image_view rqt_image_view /None/corrected_image/compressed
Using a graphical tool called rqt_publisher
you can send some velocity commands. To start this tool execute the following command.
ros2 run rqt_publisher rqt_publisher