Files
Main/99 Work/0 OneSec/OneSecNotes/10 Projects/OsdAutopilot/ROS2 Build Instructions.md

24 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PX4_MSGS
The [PX4_msgs](https://github.com/PX4/px4_msgs) package is required, because it translates [[Custom uORB Message|uORB]] messages into the ROS2 ecosystem and vice versa. The project contains a `msg` folder, which contains the msg definitions. Usually, those message definitions are autogenerated by [a script](https://github.com/PX4/PX4-Autopilot/blob/v1.13.3/msg/tools/uorb_to_ros_msgs.py) provided by the PX4-Autopilot project.
A build error that has popped up several times is that the messsage definition comments contain `*/` which is misinterpreted by the compiler
Error message:
``` bash
/home/pi/ros2_ws/build/px4_msgs/rosidl_generator_c/px4_msgs/msg/detail/gimbal_v1_command__struct.h:356:3: error: expected identifier or ( before / token
356 | */
| ^
/home/pi/ros2_ws/build/px4_msgs/rosidl_generator_c/px4_msgs/msg/detail/gimbal_v1_command__struct.h:365:3: error: expected identifier or ( before / token
365 | */
```
In order to solve this error, just delete the relevant parts of the comment.
# px4_ros_com
In order to successfully build the `px4_ros_com` package you need to define the following env-variable: `export FASTRTPSGEN_DIR="/usr/local/bin/"`.
Without it it will not work and throw the following error:
```bash
c++: error: /home/pi/ros2_ws/build/px4_ros_com/src/micrortps_agent/microRTPS_agent.cpp: No such file or directory
c++: fatal error: no input files
```