Files
Main/99 Work/0 OneSec/OneSecNotes/10 Projects/PX4/ROS2 Interface for PX4.md
2024-12-02 15:11:30 +01:00

1.8 KiB

FastDDS Bridge

This is the newest type of bridge and it allows to integrate ROS2 and PX4 much closer together. The newest development allows to easily define new flight modes that run on the companion computer instead of PX4. PX4 remains aware of this.

MicroRTPS Bridge

Troubleshooting

Baudrate Mismatch

If the baudrate is not the same on both ends, no error is thrown, but the communication does not work. In the screenshot below you can see the status when the baudrate had a mismatch (red rectangle), there were no received messages. Once the baudrate was correct the messages could be received (green rectangle) !Pasted image 20240311104419.png The baudrates are changed like follows:

  • on the PX4 you can change the parameter SER_TEL_2_BAUD if TELEM2 is used as the micrortps bridge. Or if you start the bridge with a nuttshell command you can use the argument b, e.g.: micrortps_client start -t UART -d dev/ttyS2 -b 921600
  • on the companion computer side with the argument -b, when launching the micrortps agent: ./install/px4_ros_com/bin/micrortps_agent -b 921600 -d /dev/ttyAMA1 -g

ROS2 Topic Echo does not receive PX4-Data

If the bridge is setup correctly echoing the attitude message on the companion computer should show the messages. For it to work, the correct ROS2 environment has to be sourced and both ends of the bridge (agent on the companion computer, client on the px4-system) have to be running. Run the following command: ros2 topic echo /fmu/vehicle_attitude/out. Messages should start to appear. If not check the following things: