PX4-Autopilot: microdds_client not working with real hardware
Describe the bug
I use a raspberry pi 4 companion computer with ros2 humble and micro_ros_agent installed. When I try to connect it to a pixhawk 4 mini (setup for HITL) through serial (TELEM 1 port on pixhawk, /dev/ttyAMA1 on the raspberry pi) they start the communication, but very quickly abort. On the companion computer the following message is shown:
pi@cm17:~/ros_ws $ ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyAMA1 -b 921600 -v
[1668776671.744447] info | TermiosAgentLinux.cpp | init | running... | fd: 3
[1668776671.745096] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 4
[1668776672.420570] info | Root.cpp | create_client | create | client_key: 0xAAAABBBB, session_id: 0x81
[1668776672.420935] info | SessionManager.hpp | establish_session | session established | client_key: 0xAAAABBBB, address: 1
[ros2run]: Segmentation fault
On the px4-side I get the following error after executing microdds_client start -t serial -d /dev/ttyS1 -b 921600
in the nuttshell:
nsh> microdds_client start -t serial -d /dev/ttyS1 -b 921600
nsh> ERROR [microdds_client] create entities failed: participant: 255
To Reproduce
- Prepare the flight controller for HITL mode as explained here and install micro-ros-agent on the companion computer.
- Setup the cabling between the companion computer and the pixhawk 4 mini
- Start HITL environment (pixhawk 4 mini connected to the development computer through USB) as explained here.
- On the companion computer run
ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyAMA1 -b 921600 -v
- In QGC open the mavlink shell of the pixhawk 4 mini
- in the mavlink shell run
microdds_client start -t serial -d /dev/ttyS1 -b 921600
Expected behavior
When I run this on my development computer in a SITL environment the agent and the client communicate through udp without a problem. In the SITL example I used a modified c++ node (see my pull request) inspired by px4-offboard.
I expect the agent and the client to communicate as they do in SITL.
Log Files and Screenshots
None
Drone (please complete the following information):
I use a Pixhawk 4 mini in HITL mode
Additional context
I am sure that the serial connection between the companion computer works, because I have tried to access the mavlink shell with the mavlink_shell.py script from the companion computer. After that I have disabled Mavlink on TELEM 1 (MAV_0_CONFIG = 0), set the serial baudrate to 921600 (SER_TEL1_BAUD = 921600) and enabled (XRCE_DDS_0_CFG = TELEM1).
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 21 (5 by maintainers)
Thank you for the link !! Now i can see the topic list by running :
sudo MicroXRCEAgent udp4 --port 8888 ROS_DOMAIN_ID=0
on the raspbery andmicrodds_client start -t udp -p 8888 -h 192.168.0.100
(the rpi adress) the pixhawk and the raspberry are connected on the same router via ethernet nowros2 topic list
give me all the topics but they are empty or not published by the pixhawk ??ros2 topic echo /fmu/out/vehicule_attitude
“WARNING: topic [/fmu/out/vehicule_attitude] does not appear to be published yet Could not determine the type for the passed topic” Do you know where i’m wrong ?It’s not working but i’m happy , it’s the first time i see the list of topics !!
@ozitoune I managed to fix it as following (reference - https://github.com/PX4/PX4-Autopilot/issues/21120#issuecomment-1428347091):
if you want to use TELEM1, you have to stop mavlink and then activate the microdds_client. You can do that changing the parameters: MAV_0_CONFIG = 0 to disable mavlink on TELEM1, XRCE_DDS_0_CFG = TELEM1 to start microdds_client on TELEM1 and SER_TEL1_BAUD to set the baudrate.
to use TELEM2 (ttyS3 of pixhawk): XRCE_DDS_0_CFG = TELEM2 SER_TEL2_BAUD = 921600 To check if it is already running, in the QGroundControl’s MavlinkConsole: microdds_client status if not running yet, start the client in the MavlinkConsole: microdds_client start -t serial -d /dev/ttyS3 -b 921600 In raspberrypi: sudo MicroXRCEAgent serial --dev /dev/serial0 -b 921600
make sure your raspberrypi is correct connected to your pixhawk: connect pixhawk TELEM’s tx/rx/ground on raspberrypi correspondent pins connect pixhawk on 5v (pixhawk’s usb on smartphone charger for example) remember that you also need to configure the raspberry’s serial port /dev/ttyAMA0.
It is not possible to configure XRCE_DDS_0_CFG = USB (/dev/ttyACM0 port of laptop) only for the pixhawk’s TELEM, so it would not work on laptop via USB.