-
Notifications
You must be signed in to change notification settings - Fork 0
4. Real robot QR code follower using Zenoh
All the nodes in this section were tested using ROS2 Foxy Fitzroy distro and a turtlebot3 burger model. It's recommended to see a previous page to make the QR code follower work using the zenoh-bridge-dds first.
Zenoh is a pub/sub/query protocol unifying data in motion, data at rest and computations.
-
Considerable reduction of the network saturation (main cause of packet lost) produced by the spam of discovering UDP multicast in DDS.
-
Easier understanding and coding of the pub/sub applications (ROS2 is hard to learn from scratch).
-
Avoiding some ROS2 errors and bugs.
-
Not perfect but better official documentation and examples, since ROS2 docs redirects to their source codes very often.
-
Simpler code for a simple application.
The image on the right is a scheme of the zenoh python nodes and the communications between them using Zenoh.
First of all you will first have to clone this repository and change your branch to the tag v2.0_qr_code_follower:
git clone https://github.com/USanz/follow_beacon.git
git checkout v2.0_qr_code_follower
Note: Now there's no need to build the package because we're only going to use the python nodes.
In this case we are using a turtlebot3 burger model with a camera plugged in. We'll need to follow the same exact steps in the robot (now we do not need to checkout to another different branch).
You will need to have installed the zenoh-bridge-dds in the robot, the zenoh router in the computer and the zenoh python API in both the robot and the computer. In order to achieve this, follow the instructions linked in the Requirements part of the README.md file.
In order to run it, we will have to run the bringup nodes to communicate in local host and have a bridge running in the robot to use zenoh above and to be able to communicate with the other bridge that will be running in the computer, we will do this by adding ROS_LOCALHOST_ONLY=1
before both ros2 bringup and zenoh-bridge-dds commands.
To replicate this you will first have installed the zenoh-bridge-dds following their instructions, see the README.md for more information.
Note: to see more information about the parameters file, see the previous page (the parameters are the same although the file is not in a yaml format anymore)
-
In the robot (you can and should open a ssh session to run the commands):
- Run the bridge to listen to your computer ip, and the zenoh port (7447):
cd <zenoh-bridge-dds_installation_folder> ROS_LOCALHOST_ONLY=1 ./zenoh-bridge-dds -e tcp/<computer_ip>:7447
Note: see the official documentation for more information about the zenoh bridge configuration.
- Run the bringup:
ROS_LOCALHOST_ONLY=1 ros2 launch turtlebot3_bringup robot.launch.py
- Run the image publisher:
cd <your_workspace_path>/src/follow_beacon python3 src/zenoh_nodes/zenoh-python_img_pub.py -P config/zp_params.json
Note: this new parameter file is now in json format, but uses the same parameter names that the previous yaml file.
-
In the computer:
- Run the zenoh bridge in peer mode and connect it with the robot bridge:
ROS_LOCALHOST_ONLY=1 ./zenoh-bridge-dds -m peer -e tcp/192.168.16.136:7447
Note: for more information about the configuration of the zenoh bridge see this section of their GitHub repository README.md file.
- Run the QR code detector node:
cd <your_workspace_path>/src/follow_beacon python3 src/zenoh_nodes/zenoh-python_qr_detector.py -P config/zp_params.json
Note: to change the QR code detector (OpenCV / Zbar) just change the parameter in the config/zp_params.json file, whose accepted values are "opencv" or "zbar".
- Run the velocity publisher:
cd <your_workspace_path>/src/follow_beacon python3 src/zenoh_nodes/zenoh-python_sink_motors.py -P config/zp_params.json
- You can also run Rviz2 if you want to debug or get a further view:
ROS_LOCALHOST_ONLY=1 rviz2
Note: in order to open a rviz configuration file use the -d parameter and type the file path.