|
|
The communication between the Raspberry Pi and the Pixhawk works via the RTPS/DDS interface. For implementation manual, see [PX4 Manual](https://docs.px4.io/master/en/ros/ros2_comm.html).
|
|
|
|
|
|
## Current status
|
|
|
We were able to establish the connection, using the UART interface of the RPi and the Pixhawk.
|
|
|
|
|
|
### Hardware Setup
|
|
|
The setup is shown in the figure below. The TX/RX UART ports are connected accordingly. Therfore we opened a pixhawk telemetry cable and connected it via alligator clips and jumper wires to the RPi. However, this is not a practical solution. Therfore we are aming to use a Micro USB Cable.
|
|
|
![rtps_physical_setup](uploads/8cb3a56e8363017f9dffda803b26a199/rtps_physical_setup.png)
|
|
|
|
|
|
### Software Setup
|
|
|
#### Pixhawk
|
|
|
At first, the correct Firmware must be installed on the Pixhawk. Usually this should be done already. If not, follow these steps:
|
|
|
1. [Install Toolchain on Linux](https://docs.px4.io/master/en/dev_setup/dev_env_linux_ubuntu.html). It says that Ubuntu 20 is not supported, but it does work, so no worry. You can also do this in a virtual machine.
|
|
|
2. [Install RTPS/DDS](https://docs.px4.io/master/en/dev_setup/fast-dds-installation.html). It is needed to build the proper PX4 Target.
|
|
|
3. Clone Repository:\
|
|
|
`git clone https://github.com/PX4/PX4-Autopilot.git --recursive -b release/1.11`
|
|
|
4. Build Target and upload:\
|
|
|
`make px4_fmu-v5_rtps upload`
|
|
|
|
|
|
If the correct Firmware is installed, type the following command into the NuttShell to start the transmission:\
|
|
|
`micrortps_client start -t UART -d /dev/ttyS3`\
|
|
|
When the phyiscal Interface is changed, the device '/dev/ttyS3' must be adjusted. Therefore, see [this](https://docs.px4.io/master/en/hardware/serial_port_mapping.html) site.
|
|
|
|
|
|
#### Raspberry Pi 4
|
|
|
The Ubuntu 20 SD Cards from Maarten are already set up. \
|
|
|
On every new startup, the access to the serial port must be granted by typing:\
|
|
|
`chmod o+rw /dev/ttyS0`\
|
|
|
The privileges can be checked using\
|
|
|
`ls -axl /dev/ttyS0`\
|
|
|
Sometimes, the system resets the priviliges... then you need to be fast to run the next command:\
|
|
|
`micrortps_agent start -t UART -d /dev/ttyS0`\
|
|
|
This starts the rtps agent program which handles the connection. To see if the setup works correctly, start the example code. Therfore, open a new terminal and source the ROS2 workspace:\
|
|
|
`source ~/px4_ros_com_ros2/install/setup.sh`\
|
|
|
Then, start the supplied program:\
|
|
|
`ros2 launch px4_ros_com sensor_combined_listener.launch.py`\
|
|
|
If it shows the realistic and timely changing measurements, the communication works. \
|
|
|
\
|
|
|
See [here](https://docs.px4.io/master/en/ros/ros2_comm.html#ros-2-example-applications) for more information on how to read and write data via the rtps interface.
|
|
|
|
|
|
## Next Steps
|
|
|
- [ ] Evaluate other ways for physical connection |
|
|
\ No newline at end of file |