ArduPilot / ardupilot_gz

Tools for ArduPilot ROS2 integration and testing on ROS 2 humble
GNU General Public License v3.0
27 stars 19 forks source link

ardupilot_sitl build error with ROS 2 #50

Closed aarsht7 closed 2 months ago

aarsht7 commented 2 months ago

Hello,

I am trying to test ardupilot with gazebosim (gz-harmonic) and ROS 2 (humble) Ubunut 22.04 Following this guide

I encountered the following error. Yes, I did follow the installation for the microxrcedds_gen here is the output for the version info

ros@aarsh-pc:/workspaces/ardupilot$  microxrceddsgen -version
openjdk version "11.0.22" 2024-01-16
OpenJDK Runtime Environment (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1)
OpenJDK 64-Bit Server VM (build 11.0.22+7-post-Ubuntu-0ubuntu222.04.1, mixed mode, sharing)
microxrceddsgen version: 2.0.2

Error while building the ardupilot_sitl

Starting >>> ardupilot_sitl
--- stderr: ardupilot_sitl                         
gmake[2]: *** [CMakeFiles/ardupilot_build.dir/build.make:70: CMakeFiles/ardupilot_build] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:168: CMakeFiles/ardupilot_build.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< ardupilot_sitl [1.57s, exited with code 2]

Also, I forgot to mention one more error, so I have updated the issue.

[UPDATE] Error while building th microxrcedds_agent

[ 81%] Performing configure step for 'uagent'              
loading initial cache file /workspaces/ardupilot/build/microxrcedds_agent/uagent-prefix/tmp/uagent-cache-.cmake
-- Setting build type to 'Release' as none was specified.
CMake Error at CMakeLists.txt:153 (find_package):
  Could not find a configuration file for package "fastcdr" that is
  compatible with requested version "2".

  The following configuration files were considered but not accepted:

    /opt/ros/humble/lib/cmake/fastcdr/fastcdr-config.cmake, version: 1.0.24

Is it a known issue? I tried to look up the internet, but there was no lead.

Thanks.

rmackay9 commented 2 months ago

This is probably for @srmainwaring or @Ryanf55 to answer.

I'm sure you've seen it but hopefully you've got the ArduPilot build environment installed on the PC as well. https://ardupilot.org/dev/docs/building-the-code.html

Ryanf55 commented 2 months ago

Are you sure there isn't more log data? Normally, in a failure, you get messages on what failed.

Ryanf55 commented 2 months ago

Please delete the build, log, and install folder. Then rebuild. Finally, zip up the entire contents of your log folder and attach it here. I want to look at everything. https://colcon.readthedocs.io/en/released/user/log-files.html#log-files

srmainwaring commented 2 months ago

@aarsht7 the top level colcon messages are not that helpful - basically telling you a package failed to build and not much else. There are flags you can set to provide more detail --event-handlers console_direct+.

In this case the problem is the core ardupilot library as a colcon package. You can build this directly using ./waf as follows:

I suspect you may be missing a dependency, possibly the path to the microxrceddsgen binary.

aarsht7 commented 2 months ago

Are you sure there isn't more log data? Normally, in a failure, you get messages on what failed.

On the colcon build logs, there is no log data of ardupilot_sitl as pkg is not built But there is config.log inside src/ardupilot/build After analyzing it, I realized that the $PATH variable it is not the same as the one in the current env. Maybe it is catching the old one and not updating when I rebuild without removing the ardupilot build directory.

So I tried rm -rf src/ardupilot/build build/ install/ log/ and rebuild This time it does update to the correct path to the microxrcedds_gen, But the error remains the same.

Also, I forgot to mention one more error, so I have updated the issue.

There are flags you can set to provide more detail --event-handlers console_direct+.

@srmainwaring Here is the output of the build using the flag. (I have only put the error output and not the entire build log here)

you need to install pexpect with 'python -m pip install pexpect'
gmake[2]: *** [CMakeFiles/ardupilot_build.dir/build.make:70: CMakeFiles/ardupilot_build] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:168: CMakeFiles/ardupilot_build.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2

So I installed pexpect and tried again. This time, it was missing the future module. So I repeat the procedure after installing it and now I can see big red blocks across the screen.

Here is a pastebin link of the log Error starts from L82 And build fail logs from L418

srmainwaring commented 2 months ago

@aarsht7 did you install microxrceddsgen from the ArduPilot fork (https://github.com/ArduPilot/Micro-XRCE-DDS-Gen)? The error you are seeing is because the eProsima version does not support the additional flag reported in the errors.

aarsht7 commented 2 months ago

did you install microxrceddsgen from the ArduPilot fork

No, I did not. I used the docs from eProsima when I faced the error the first time. I tried with the fork, and ardupilot_sitl builds without error.

Error with pkg microxrcedds_agent persist

It seems pkg is not required as I run colcon build --packages-up-to ardupilot_gz_bringup, that pkg is not build. Closing the issue from my side. Thank you pointing to the fork 🙌🏼

Ryanf55 commented 2 months ago

Can you please contribute a docs PR? I'm lost on how you skipped that step. We've had a bunch of people skip it, and I am not sure how to improve it.

Ryanf55 commented 2 months ago

Also, please review this change too: https://github.com/ArduPilot/ardupilot_wiki/pull/5887

aarsht7 commented 2 months ago

Can you please contribute a docs PR?

ArduPilot/ardupilot_wiki#5888