client is not created after establishing connection from the agent
Closed this issue · 8 comments
My setup
- ROS2 Humble Ubuntu PC.
- OpenCR board
- ESP32
Problem description
Trying to use an OpenCR Board and an ESP32 to run micro ROS.
Both are not working properly or maybe it is the micro ROS agent, which is not working properly. Both with the same outcome. After uploading the micro-ros_publisher example and establishing the connection with the mirco ROS agent, it starts to communicate, but does not go beyond the logger_setup. So that it will never create the client.
Outcome
Establishing the connection like this:
ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyUSB0
The outcome is as follows:
[1701769397.406654] info | TermiosAgentLinux.cpp | init | running... | fd: 3
[1701769397.407256] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4
And it is not going beyond this point.
Expected outcome
From the micro ROS tutorials I am expecting the outcome to be like in the image below:
Reconstruction steps
Step 1: Arduino IDE 2 installation
Downloaded the Linux AppImage 64-bit https://downloads.arduino.cc/arduino-ide/arduino-ide_2.2.1_Linux_64bit.AppImage from here:
https://www.arduino.cc/en/software
Made the AppImage executable and started it.
Step 2: Arduino micro ROS precompiled library installation
I downloaded the Humble release of micro ROS for Arduino from here:
https://github.com/micro-ROS/micro_ros_arduino/releases
as mentioned in the instructions from the Github repository: https://github.com/micro-ROS/micro_ros_arduino/tree/humble
Included it in the Arduino libraries.
Step 3: Arduino board installation
Added the following URLs to the Arduino Board manager:
https://espressif.github.io/arduino-esp32/package_esp32_index.json (for the ESP32)
https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/arduino/opencr_release/package_opencr_index.json (for the OpenCR board)
For the ESP32 I've installed version 2.0.2 as this is mentioned to be supported.
Also I've installed pyserial with pip3 as it was missing during later compilation.
For the OpenCR I've installed the newest version 1.5.3.
Step 4: Uploading micro-ros_publisher example
From the Arduino IDE I chose File-> Examples -> micro-ros-arduino -> micro-ros_publisher. I uploaded this to both boards: OpenCR and ESP32.
Step 5: micro ROS agent installation
Using my native ROS2 Humble installation on Ubuntu, I followed the instructions to install the micro ROS build system and the micro ROS agent:
https://micro.ros.org/docs/tutorials/core/first_application_linux/
Step 6: establish connection
Now connecting the ESP32 or the OpenCR board with the uploaded micro-ros_publisher and trying to establish the connection from the micro ROS agent:
ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyUSB0
That ends in the problem described above.
Please provide the agent log using the flag -v6
in the micro-ROS Agent command and reset the board after connecting to the micro-ROS Agent.
This gives me the exact same output as before, just with a verbose level of 6 instead of 4:
[1701769397.406654] info | TermiosAgentLinux.cpp | init | running... | fd: 3
[1701769397.407256] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6
Does your board output anything via serial port if you attach it to minicom or miniterm?
I am not familiar with minicom, but I ran minicom --device /dev/ttyUSB0
.
It does start minicom 2.8.
Is that supposed to give me some output by default? If yes, there is nothing.
It is supposed to have some binary output where you can find the chars "XRCE" which is the header of the protocol.
I'm not sure if your board's output is nothing or if you are not choosing the correct serial device in Linux, could you check if there is a device in dev/serial/by-id/...
?
It is supposed to have some binary output where you can find the chars "XRCE" which is the header of the protocol.
That pointed me to the right direction. The communication is working now.
I remembered that I've seen "XRCE" output on the Arduino serial monitor. So I tried that again, but first I got no output there, too.
So what I did is: I unplugged the USB-cable, plugged it in again and then it started talking to me: "XRCE".
Seeing that I tried the same thing running the micro ROS agent first and afterwards connecting the microcontroller via USB. And now it is working.
I could also test it with ros2 topic echo /micro_ros_arduino_node_publisher
and received the message.
But I am wondering if that is the supposed behavior? Shouldn't the microcontroller wait in some idle mode to start the connection from this side? Is it supposed to only connect direct after startup?
That is the supposed behaviour, micro-ROS won't handle the connection for you.
But it is not difficult to handle the connections and reconnections, you have more info here: https://docs.vulcanexus.org/en/latest/rst/tutorials/micro/handle_reconnections/handle_reconnections.html
Thank you very much! I can continue from this point.
SOLVED