diff --git a/libraries/AP_DDS/README.md b/libraries/AP_DDS/README.md index b148fa23e0..1af0af6f60 100644 --- a/libraries/AP_DDS/README.md +++ b/libraries/AP_DDS/README.md @@ -377,3 +377,40 @@ This will run the tools automatically when you commit. If there are changes, jus pre-commit install git commit ``` + +## Testing DDS on Hardware + +### With Serial + +The easiest way to test DDS is to make use of some boards providing two serial interfaces over USB such as the Pixhawk 6X. +The [Pixhawk6X/hwdef.dat](../AP_HAL_ChibiOS/hwdef/Pixhawk6X/hwdef.dat) file has this info. +``` +SERIAL_ORDER OTG1 UART7 UART5 USART1 UART8 USART2 UART4 USART3 OTG2 +``` + +For example, build, flash, and set up OTG2 for DDS +```bash +./waf configure --board Pixhawk6X --enable-dds +./waf plane --upload +mavproxy.py --console +param set DDS_ENABLE 1 +# Check the hwdef file for which port is OTG2 +param set SERIAL8_PROTOCOL 45 +param set SERIAL8_BAUD 115 +reboot +``` + +Then run the Micro ROS agent +```bash +cd /path/to/ros2_ws +source install/setup.bash +cd src/ardupilot/libraries/AP_DDS +ros2 run micro_ros_agent micro_ros_agent serial -b 115200 -r dds_xrce_profile.xml -D /dev/serial/by-id/usb-ArduPilot_Pixhawk6X_210028000151323131373139-if02 +``` + +If connection fails, instead of running the Micro ROS agent, debug the stream +```bash +python3 -m serial.tools.miniterm /dev/serial/by-id/usb-ArduPilot_Pixhawk6X_210028000151323131373139-if02 115200 --echo --encoding hexlify +``` + +The same steps can be done for physical serial ports once the above works to isolate software and hardware issues.