I have a question on communication of Pixhawk 4 Mini with a Raspberry (Ubuntu 20 with ROS2Foxy) over a serial link with the ROS2-Bridge using PX4 v1.13.3 rtps-target on the pixhawk.
I followed the the steps for building the px4_ros_com package in the 1.13 documentation ROS 2 User Guide (PX4-ROS 2 Bridge) | PX4 User Guide and tested it in the SITL. Everything is working perfectly.
Now I want to switch into HITL and let the Raspberry communicate with the pixhawk. For that I connected the the Raspberry via the UART&I2C-port. I checked if the serial link is working by using the takeoffandLand-example from
MAVSDK to control the pixhawk from the Raspberry. That also works fine, so I assume that the serial communication is working.
I then wanted to check the communication between pixhawk and Raspberry via ROS2-Bridge. Therefore I built the px4_ros_com-bridge on the raspberry, executed the
$ micrortps_bridge -t serial -d /dev/ttyAMA0
On the Pixhawk, i made sure that mavlink was deactivated on /dev/ttyS3 and activated the microdds_client with
$ microdds_client -t serial -d /dev/ttyS3
after that I started the listener example on the raspberry
$ ros2 launch px4_ros_com sensor_combined_listener.launch.py
But no messages arrive. If I start the offboard_example the drone does not move. I can see on the micrortps_agent, that it sees that I started the listener, because it
[ micrortps_agent ] SensorCombined publisher matched
[ micrortps_agent ] SensorCombined publisher unmatched
But no messages arrive. When I check the status on the microdds_client it says
INFO [microdds_client] Running, disconnected
INFO [microdds_client] Payload tx: 0 B/s
INFO [microdds_client] Payload rx: 0 B/s
So I guess the serial is not working on RTPS for some reason. Could it be because i set the drone parameter wrong? I attach a picture with my RTPS-Parameters. Did someone maybe had a similar problem with the communication and give me a hint to solve it.
Thank you in advance!
Hey @tobias I suspect your wiring is working ok since you are sending MAVLink, but please take a photo of your set-up just to rule that out. What else do you have connected to TELEM1, TELEM2, TELEM/SERIAL4?
Can you please share a log? try loging from booth until shutdown with this param
SDLOG_MODE set to 2, try uploading to PX4 Flight Review and share a link here
You have to choices here to start the client: using parameters or using the shell. Now you are using both at the same time.
First, I suggest you to disable
RTPS_MAV_CONFIG and perform an initial test starting the client with
microdds_client -t serial -d /dev/ttyS3. Moreover, make sure that client and agent use the same baudrate.
RTPS_MAV_CONFIG, if enabled, allows to use MAVLINK and RTPS over the same serial link. However, this requires an additional driver (non included by default) called protocol_splitter. And you need to have its counterpart active on the companion computer. We can talk more about that if you want
Thank you for your fast response.
Here is a picture of my setup:
I havnt assembled the drone but on my understanding the
TELEM1 is connected to a Telemetry Receiver
Im not sure which port maps to TELEM2 and TELEM4 so i cant give a clear answer on that.
Here is a log Flight Review
Thanks for your Reply.
I will try to change the RTPS Parameters. I found that line in the logs:
INFO [micrortps_client] UART transport: device: /dev/rtps; baudrate: 57600; poll: 1ms; flow_control: No
ERROR [micrortps_client] UART transport: Failed to open device: /dev/rtps (2)
INFO [micrortps_client] EXITING…
Conflicting config for /dev/ttyS3
Maybe that corresponds to what you said, that RTPS settings are set in params and on nuttx console.
Yes I would like to send Mavlink and RTPS over the same serial link. Thank you for pointing out that I need an additional driver for that. I will try to install it on the companion computer and ask you if I have problems with it.
I suggest you to make RTPS work without mavlink than you can start using the protocol splitter
Sadly, disabling RTPS_CONFIG and RTPS_MAV_CONFIG and setting the same baudrate for agent and client didnt solve the communication problem for me. I will further investigate this and will post here when i find a solution.