micro_ros_agent serial not working?
Closed this issue · 4 comments
micro_ros_agent, serial on rPi 4
- Hardware description: raspberry Pi 4 Model B
- Installation type: micro_ros_setup
- Version or commit hash: humble
Steps to reproduce the issue
Hi, I've managed to install, setup and run micro_ros_agent
.
I start it with:
ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyAMA0 -b 115200
And output of that command is:
[1701676721.257899] info | TermiosAgentLinux.cpp | init | running... | fd: 3
[1701676721.260238] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4
Which means that agent is running.
I've tested my serial port /dev/ttyAMA0
and when I run:
echo "test" > /dev/ttyAMA0
I recieve echoed string on my serial port.
However, when I publish message on the certain ros 2 topic, such as /cmd_vel
, nothing is propagated to the serial port.
So, after running micro_ros_agent
and testing serial port, when I publish ROS 2 message on the /cmd_vel
nothing gets to the serial port.
Expected behavior
I expect to have something on my serial port if I published message to the topic. So for example if I publish something on the /cmd_vel
topic, I should
at least see some bytes being sent to the serial port or: /dev/ttyAMA0
. However, currently, nothing gets to the serial port.
Actual behavior
micro_ros_agent
is running. And serial port is opened. However, when I publish message on the /cmd_vel
topic, nothing gets through.
Additional information
Let me know if you need anything more!
Which is your micro-ROS Client code?
Well currently, client is running on nucleo. It is custom written code that reads /cmd_vel
and republishes it to individual motors.
It was tested with micro_ros_agent
on another PC with USB2UART connection. Now I'm trying to setup the same thing with the
rPI4, and in this case, I looped back GPIOs of the rPI for the UART, and serial works, however, I'm not able to get anything on the serial when running micro_ros_agent
.
Maybe I'm missing something. Tnx for the help!
I do not understand why you are looping back GPIOs... The micro-ROS Agent must be connected to a micro-ROS Client to operate.
Does your setup work when you connect a micro-ROS Agent to a micro-ROS Client?
Does your micro-ROS Agent print logs when you open it with flag -v6
and connect your board?
Hi @pablogs9
You're right. I've run the micro_ros_agent
with the -v6
and I get all the output. Especially after connecting with the client code on the nucleo.
I've had a little bit of trouble enabling serial port on the raspberry Pi4 for Ubuntu 22.04, that's why I used loopback. I've thought that I could see something on the serial port only running server side of the micro_ros_agent.
However, now things run smoothly. Output of the -v6
is nice:
Example:
ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyAMA0 -b 115200 -v 6
[1701679248.690618] info | TermiosAgentLinux.cpp | init | running... | fd: 3
[1701679248.691381] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6
[1701679249.071156] info | Root.cpp | create_client | create | client_key: 0x153E537A, session_id: 0x81
[1701679249.073321] info | SessionManager.hpp | establish_session | session established | client_key: 0x153E537A, address: 0
[1701679249.073746] debug | SerialAgentLinux.cpp | send_message | [** <<SER>> **] | client_key: 0x153E537A, len: 19, data:
0000: 81 00 00 00 04 01 0B 00 00 00 58 52 43 45 01 00 01 0F 00
[1701679249.082618] debug | SerialAgentLinux.cpp | recv_message | [==>> SER <<==] | client_key: 0x153E537A, len: 44, data:
0000: 81 80 00 00 01 07 22 00 00 0A 00 01 01 03 00 00 14 00 00 00 00 01 00 20 0C 00 00 00 6E 75 63 6C
0020: 65 6F 5F 67 34 39 31 00 00 00 00 00
Problem was with the serial of the raspberry Pi4 :)
Thanks!