ROS2 package for Bittle Robot. There are launch files for Object detection based control, RQT robot controller GUI Control, and Generic USB video game controller control. All options have video streaming from Bittle to the desktop
Before you begin, ensure you have the following installed:
- Petoi Bittle Robot
- Raspberry pi (Zero 2, 4 or 5)
- ROS2 (Tested on Humble)
- Python 3.5 or higher
- Git
- Docker (On raspberry pi)
Install ros2 humble from instructions here:: https://docs.ros.org/en/humble/Installation.html
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/gravesreid/bittle_ros2.git
git clone https://github.com/gravesreid/bittle_msgs.git
git clone --branch ros2 https://github.com/ros-drivers/joystick_drivers.git
sudo apt install python3-colcon-common-extensions
sudo apt-get install ros-humble-diagnostic-updater
cd ~/ros2_ws
rosdep update
rosdep install --from-paths src -r -y
cd ~/ros2_ws
colcon build
source install/setup.bash
Configure raspberry pi as detailed here in the readme: https://github.com/gravesreid/autonomous-bittle.git
https://docs.ros.org/en/foxy/How-To-Guides/Installing-on-Raspberry-Pi.html
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
newgrp docker
Check that docker works
docker run hello-world
docker pull gravesreid/bittle_ros_humble:latest
docker images
docker run -it --net=host --privileged [image_id]
source /opt/ros/humble/setup.bash
cd ~/ros2_ws
source install/setup.bash
if you didn't pull the bittle_ros_humble docker image, this is what you need to do to set up your desktop ros2 workspace also
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone https://github.com/gravesreid/bittle_ros2.git
git clone https://github.com/gravesreid/bittle_msgs.git
git clone --branch ros2 https://github.com/ros-drivers/joystick_drivers.git
sudo apt install python3-colcon-common-extensions
cd ~/ros2_ws
rosdep update
rosdep install --from-paths src -r -y
cd ~/ros2_ws
colcon build
source install/setup.bash
from: https://medium.com/swlh/raspberry-pi-ros-2-camera-eef8f8b94304
- clone packages
cd ~/ros2_ws/src
git clone --branch humble https://gitlab.com/boldhearts/ros2_v4l2_camera.git
git clone --branch humble https://github.com/ros-perception/vision_opencv.git
git clone --branch humble https://github.com/ros-perception/image_common.git
git clone --branch humble https://github.com/ros-perception/image_transport_plugins.git
- install dependencies
cd .. rosdep install --from-paths src -r -y
- Build packages
colcon build --packages-up-to v4l2_camera image_transport_plugins
- Source workspace
source install/setup.bash
- install package
sudo apt install ros-humble-librealsense2*
- source workspace
cd ~/ros2_ws
source install/setup.bash
You may need to do some remapping of buttons. To determine your button mapping, plug your controller into your PC and run:
ros2 run joy joy_node
ros2 topic echo /joy
ros2 launch bittle_ros2 robot_joystic_launch.py
ros2 launch bittle_ros2 server_joystick_launch.py
- make sure you source your build
source ~/ros2_ws/install/setup.bash
- make sure your domain is set
export ROS_DOMAIN_ID=1
- launch the server node
ros2 launch bittle_ros2 bittle_teleop_server_launch.py
An rqt GUI should open up on your desktop
- source the build on the pi
source ~/ros2_ws/install/setup.bash
- make sure your domain is set
export ROS_DOMAIN_ID=1
- launch the robot node
ros2 launch bittle_ros2 bittle_teleop_robot_launch.py
To list which port the camera is attached to:
v4l2-ctl --list-devices
ros2 run usb_cam usb_cam_node_exe --ros-args --params-file src/usb_cam/config/params.yaml
- Source build
cd ~/ros2_ws source install/setup.bash
- Make sure domain is set (on pc and pi-same domain id for both)
export ROS_DOMAIN_ID=1
- run camera node on pi
ros2 run v4l2_camera v4l2_camera_node
- run visualization tool on desktop/pc
ros2 run rqt_image_view rqt_image_view
- select image view in GUI that pops up. Choose /image_raw/compressed topic for low latency streaming. Make sure you have compressed image transport on your desktop:
sudo apt-get install ros-humble-compressed-image-transport