Unable to install Gazebo with ROS2 via colcon build

I’m attempting to follow the ROS2 with Gazebo installation instructions but am running into an error while updating ROS dependencies.

My issue is similar to this thread where i do not see a resolution.

When running rosdep install --from-paths src --ignore-src -r I get the following:

ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
ardupilot_gazebo: Cannot locate rosdep definition for [gz-sim8]
sdformat_urdf: Cannot locate rosdep definition for [sdformat14]
ros_gz_bridge: Cannot locate rosdep definition for [gz-transport13]
ros_gz_image: Cannot locate rosdep definition for [gz-transport13]
ros_gz_sim: Cannot locate rosdep definition for [gz-transport13]
ardupilot_gz_gazebo: Cannot locate rosdep definition for [gz-sim8]

Full output:

jamison@jamison:~/ardu_ws$ source /opt/ros/humble/setup.bash
sudo apt update
rosdep update
rosdep install --from-paths src --ignore-src -y
[sudo] password for jamison: 
Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Hit:2 http://us.archive.ubuntu.com/ubuntu jammy InRelease                      
Get:3 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]     
Hit:4 http://packages.ros.org/ros2/ubuntu jammy InRelease                      
Hit:5 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease            
Hit:6 https://packages.microsoft.com/repos/code stable InRelease    
Hit:7 https://dl.google.com/linux/chrome/deb stable InRelease       
Hit:8 http://packages.osrfoundation.org/gazebo/ubuntu-stable jammy InRelease
Get:9 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [2,072 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [705 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [736 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1,132 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe Translation-en [264 kB]
Fetched 5,166 kB in 1s (5,251 kB/s)                              
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///usr/share/python3-rosdep2/debian.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Skip end-of-life distro "foxy"
Skip end-of-life distro "galactic"
Skip end-of-life distro "groovy"
Add distro "humble"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Add distro "iron"
Skip end-of-life distro "jade"
Add distro "jazzy"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Skip end-of-life distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/jamison/.ros/rosdep/sources.cache
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
ardupilot_gazebo: Cannot locate rosdep definition for [gz-sim8]
sdformat_urdf: Cannot locate rosdep definition for [sdformat14]
ros_gz_bridge: Cannot locate rosdep definition for [gz-transport13]
ros_gz_image: Cannot locate rosdep definition for [gz-transport13]
ros_gz_sim: Cannot locate rosdep definition for [gz-transport13]
ardupilot_gz_gazebo: Cannot locate rosdep definition for [gz-sim8]

Subsequently, this impacts the colcon build:

jamison@jamison:~/ardu_ws$ colcon build
Starting >>> ros_gz_interfaces
Starting >>> ros_gz_sim
Starting >>> sdformat_test_files
Starting >>> ardupilot_msgs
Starting >>> micro_ros_agent
Starting >>> ardupilot_gazebo
Starting >>> ardupilot_gz_description
Starting >>> ardupilot_gz_gazebo
Starting >>> ardupilot_gz_application
Finished <<< sdformat_test_files [0.38s]                               
Starting >>> sdformat_urdf
Finished <<< ardupilot_gz_application [0.75s]                          
Finished <<< ardupilot_gz_description [0.76s]
--- stderr: ardupilot_gazebo                                           
Building ardupilot_gazebo as an `ament_cmake` project.
CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:825 (_pkg_check_modules_internal)
  CMakeLists.txt:58 (pkg_check_modules)


---
Failed   <<< ardupilot_gazebo [1.46s, exited with code 1]
Aborted  <<< ardupilot_msgs [1.47s]
Aborted  <<< sdformat_urdf [1.11s]
Aborted  <<< ardupilot_gz_gazebo [1.50s]         
Aborted  <<< ros_gz_interfaces [1.58s]
Aborted  <<< ros_gz_sim [1.76s]                                            
Aborted  <<< micro_ros_agent [3.81s]                                 

Summary: 3 packages finished [4.14s]
  1 package failed: ardupilot_gazebo
  6 packages aborted: ardupilot_gz_gazebo ardupilot_msgs micro_ros_agent ros_gz_interfaces ros_gz_sim sdformat_urdf
  4 packages had stderr output: ardupilot_gazebo ardupilot_gz_gazebo micro_ros_agent sdformat_urdf
  15 packages not processed

I believe I have successfully followed the prerequisite steps from the docs:

  • Build ardupilot on linux
  • Install ROS 2
  • ROS 2 with SITL

I’m running:

  • Ubuntu 22.04 6.8.0-45-generic
  • Latest Ardupilot
  • ROS2 Humble
  • Gazebo Harmonic

Any assistance would be greatly appreciated. I’m happy to provide additional information to help problem solve.

ardupilot_gazebo is not building: Most likely missing gstreamer dependencies
as these are not included in the ardupilot_gazebo package.xml.

See also: Update package dependencies for cmake build · Issue #112 · ArduPilot/ardupilot_gazebo · GitHub

Thank you, @rhys. This appeared to mostly resolve my issue (i’m able to run ros2 launch ardupilot_gz_bringup iris_runway.launch.py and successfully control with MAVProxy GCS).

A couple of other questions to see if I can get ahead of future issues:

  • There appears to be several flake8 and CMake linting errors flagged. Given that gazebo is running I’m just going to ignore these but please tell me if I’m missing something…
  • The ardupilot_dds_tests seems to be missing. Any recommendations on how to resolve?

I’ve included the buid and tests output below.

Build:

jamison@jamison:~/ardu_ws$ cd ~/ardu_ws
colcon build --packages-up-to ardupilot_gz_bringup
Starting >>> ardupilot_gazebo
Starting >>> ardupilot_msgs
Starting >>> micro_ros_agent
Starting >>> ros_gz_interfaces
Starting >>> sdformat_test_files
Starting >>> ardupilot_gz_description
Starting >>> ardupilot_gz_gazebo
Starting >>> ros_gz_sim
Finished <<< sdformat_test_files [0.15s]                              
Starting >>> sdformat_urdf
Finished <<< ardupilot_gz_description [0.15s]
Finished <<< micro_ros_agent [0.21s]                                  
Finished <<< sdformat_urdf [0.20s]                                    
Finished <<< ardupilot_gz_gazebo [0.39s]                              
Finished <<< ros_gz_sim [0.58s]                                       
Finished <<< ardupilot_msgs [2.39s]                                       
Starting >>> ardupilot_sitl
--- stderr: ardupilot_gazebo                                                 
Building ardupilot_gazebo as an ament_cmake project.
---
Finished <<< ardupilot_gazebo [10.9s]
Starting >>> ardupilot_sitl_models
Finished <<< ros_gz_interfaces [11.7s]                                        
Starting >>> ros_gz_bridge
Finished <<< ardupilot_sitl_models [1.01s]                                
[Processing: ardupilot_sitl, ros_gz_bridge]                                 
Finished <<< ros_gz_bridge [53.8s]                                             
[Processing: ardupilot_sitl]                                         
--- stderr: ardupilot_sitl                                            
../../libraries/AP_Scripting/lua/src/loslib.c: In function ‘os_tmpname’:
../../libraries/AP_Scripting/lua/src/loslib.c:185:3: warning: ‘buff’ may be used uninitialized [-Wmaybe-uninitialized]
  185 |   lua_pushstring(L, buff);
      |   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../libraries/AP_Scripting/lua/src/loslib.c:19:
../../libraries/AP_Scripting/lua/src/lua.h:228:22: note: by argument 2 of type ‘const char *’ to ‘lua_pushstring’ declared here
  228 | LUA_API const char *(lua_pushstring) (lua_State *L, const char *s);
      |                      ^~~~~~~~~~~~~~
../../libraries/AP_Scripting/lua/src/loslib.c:180:8: note: ‘buff’ declared here
  180 |   char buff[LUA_TMPNAMBUFSIZE];
      |        ^~~~

---
Finished <<< ardupilot_sitl [1min 58s]
Starting >>> ardupilot_gz_bringup
Finished <<< ardupilot_gz_bringup [0.66s]                       

Summary: 13 packages finished [2min 1s]
  2 packages had stderr output: ardupilot_gazebo ardupilot_sitl

Tests:


jamison@jamison:~/ardu_ws$ cd ~/ardu_ws
source install/setup.bash
colcon test --packages-select ardupilot_sitl ardupilot_dds_tests ardupilot_gazebo ardupilot_gz_applications ardupilot_gz_description ardupilot_gz_gazebo ardupilot_gz_bringup
colcon test-result --all --verbose
[0.399s] WARNING:colcon.colcon_core.package_selection:ignoring unknown package 'ardupilot_gz_applications' in --packages-select
Starting >>> ardupilot_sitl
Starting >>> ardupilot_gazebo
Starting >>> ardupilot_gz_description
Starting >>> ardupilot_gz_gazebo
Finished <<< ardupilot_gazebo [0.03s]
Finished <<< ardupilot_gz_description [0.50s]                
--- stderr: ardupilot_gz_gazebo                              
Errors while running CTest
Output from these tests are in: /home/jamison/drone/ardu_ws/build/ardupilot_gz_gazebo/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
---
Finished <<< ardupilot_gz_gazebo [0.66s]	[ with test failures ]
Finished <<< ardupilot_sitl [1.12s]          
Starting >>> ardupilot_dds_tests
[1.525s] ERROR:colcon.colcon_core.task.python.test:Failed to find the following files:
- /home/jamison/drone/ardu_ws/install/ardupilot_dds_tests/share/ardupilot_dds_tests/package.sh
Check that the following packages have been built:
- ardupilot_dds_tests
Failed   <<< ardupilot_dds_tests [0.00s, exited with code 1]
Starting >>> ardupilot_gz_bringup
--- stderr: ardupilot_gz_bringup                              
Errors while running CTest
Output from these tests are in: /home/jamison/drone/ardu_ws/build/ardupilot_gz_bringup/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
---
Finished <<< ardupilot_gz_bringup [0.85s]	[ with test failures ]

Summary: 5 packages finished [2.34s]
  1 package failed: ardupilot_dds_tests
  2 packages had stderr output: ardupilot_gz_bringup ardupilot_gz_gazebo
  2 packages had test failures: ardupilot_gz_bringup ardupilot_gz_gazebo
build/ardupilot_gz_bringup/Testing/20241014-2255/Test.xml: 5 tests, 0 errors, 1 failure, 0 skipped
- flake8
  <<< failure message
    -- run_test.py: invoking following command in '/home/jamison/drone/ardu_ws/src/ardupilot_gz/ardupilot_gz_bringup':
     - /opt/ros/humble/bin/ament_flake8 --xunit-file /home/jamison/drone/ardu_ws/build/ardupilot_gz_bringup/test_results/ardupilot_gz_bringup/flake8.xunit.xml --config /home/jamison/drone/ardu_ws/src/ardupilot_gz/ardupilot_gz_bringup/.flake8
    
    ./launch/robots/iris.launch.py:58:1: E303 too many blank lines (3)
    
    ./launch/robots/iris.launch.py:161:89: E501 line too long (108 > 88 characters)
    
    ./launch/robots/iris_lidar.launch.py:163:89: E501 line too long (108 > 88 characters)
    
    ./launch/robots/wildthumper.launch.py:58:1: E303 too many blank lines (3)
    
    
    6 files checked
    4 errors
    
    'E'-type errors: 4
    
    Checked files:
    
    * ./launch/iris_maze.launch.py
    * ./launch/iris_runway.launch.py
    * ./launch/wildthumper_playpen.launch.py
    * ./launch/robots/iris_lidar.launch.py
    * ./launch/robots/iris.launch.py
    * ./launch/robots/wildthumper.launch.py
    -- run_test.py: return code 1
    -- run_test.py: verify result file '/home/jamison/drone/ardu_ws/build/ardupilot_gz_bringup/test_results/ardupilot_gz_bringup/flake8.xunit.xml'
  >>>
build/ardupilot_gz_bringup/test_results/ardupilot_gz_bringup/copyright.xunit.xml: 6 tests, 0 errors, 0 failures, 0 skipped
build/ardupilot_gz_bringup/test_results/ardupilot_gz_bringup/flake8.xunit.xml: 4 tests, 0 errors, 4 failures, 0 skipped
- ardupilot_gz_bringup.flake8 E303 (./launch/robots/iris.launch.py:58:1)
  <<< failure message
    too many blank lines (3):
    def generate_launch_description():
  >>>
- ardupilot_gz_bringup.flake8 E501 (./launch/robots/iris.launch.py:161:89)
  <<< failure message
    line too long (108 > 88 characters):
        #         "tf2_msgs.msg.TFMessage(transforms=[x for x in m.transforms if x.header.frame_id == 'odom'])",
  >>>
- ardupilot_gz_bringup.flake8 E501 (./launch/robots/iris_lidar.launch.py:163:89)
  <<< failure message
    line too long (108 > 88 characters):
        #         "tf2_msgs.msg.TFMessage(transforms=[x for x in m.transforms if x.header.frame_id == 'odom'])",
  >>>
- ardupilot_gz_bringup.flake8 E303 (./launch/robots/wildthumper.launch.py:58:1)
  <<< failure message
    too many blank lines (3):
    def generate_launch_description():
  >>>
build/ardupilot_gz_bringup/test_results/ardupilot_gz_bringup/lint_cmake.xunit.xml: 1 test, 0 errors, 0 failures, 0 skipped
build/ardupilot_gz_bringup/test_results/ardupilot_gz_bringup/pep257.xunit.xml: 6 tests, 0 errors, 0 failures, 0 skipped
build/ardupilot_gz_bringup/test_results/ardupilot_gz_bringup/xmllint.xunit.xml: 1 test, 0 errors, 0 failures, 0 skipped
build/ardupilot_gz_description/Testing/20241014-2255/Test.xml: 3 tests, 0 errors, 0 failures, 0 skipped
build/ardupilot_gz_description/test_results/ardupilot_gz_description/copyright.xunit.xml: 0 tests, 0 errors, 0 failures, 0 skipped
build/ardupilot_gz_description/test_results/ardupilot_gz_description/lint_cmake.xunit.xml: 1 test, 0 errors, 0 failures, 0 skipped
build/ardupilot_gz_description/test_results/ardupilot_gz_description/xmllint.xunit.xml: 1 test, 0 errors, 0 failures, 0 skipped
build/ardupilot_gz_gazebo/Testing/20241014-2255/Test.xml: 5 tests, 0 errors, 1 failure, 0 skipped
- lint_cmake
  <<< failure message
    -- run_test.py: invoking following command in '/home/jamison/drone/ardu_ws/src/ardupilot_gz/ardupilot_gz_gazebo':
     - /opt/ros/humble/bin/ament_lint_cmake --xunit-file /home/jamison/drone/ardu_ws/build/ardupilot_gz_gazebo/test_results/ardupilot_gz_gazebo/lint_cmake.xunit.xml
    CMakeLists.txt:32: Line ends in whitespace [whitespace/eol]
    
    
    1 errors
    -- run_test.py: return code 1
    -- run_test.py: verify result file '/home/jamison/drone/ardu_ws/build/ardupilot_gz_gazebo/test_results/ardupilot_gz_gazebo/lint_cmake.xunit.xml'
  >>>
build/ardupilot_gz_gazebo/test_results/ardupilot_gz_gazebo/copyright.xunit.xml: 4 tests, 0 errors, 0 failures, 0 skipped
build/ardupilot_gz_gazebo/test_results/ardupilot_gz_gazebo/cppcheck.xunit.xml: 4 tests, 0 errors, 0 failures, 4 skipped
build/ardupilot_gz_gazebo/test_results/ardupilot_gz_gazebo/cpplint.xunit.xml: 4 tests, 0 errors, 0 failures, 0 skipped
build/ardupilot_gz_gazebo/test_results/ardupilot_gz_gazebo/lint_cmake.xunit.xml: 1 test, 0 errors, 1 failure, 0 skipped
- ardupilot_gz_gazebo.lint_cmake whitespace/eol (CMakeLists.txt:32)
  <<< failure message
    Line ends in whitespace
  >>>
build/ardupilot_gz_gazebo/test_results/ardupilot_gz_gazebo/xmllint.xunit.xml: 1 test, 0 errors, 0 failures, 0 skipped
build/ardupilot_sitl/Testing/20241014-2255/Test.xml: 5 tests, 0 errors, 0 failures, 0 skipped
build/ardupilot_sitl/test_results/ardupilot_sitl/black.xunit.xml: 0 tests, 0 errors, 0 failures, 0 skipped
build/ardupilot_sitl/test_results/ardupilot_sitl/copyright.xunit.xml: 11 tests, 0 errors, 0 failures, 0 skipped
build/ardupilot_sitl/test_results/ardupilot_sitl/lint_cmake.xunit.xml: 1 test, 0 errors, 0 failures, 0 skipped
build/ardupilot_sitl/test_results/ardupilot_sitl/pep257.xunit.xml: 11 tests, 0 errors, 0 failures, 0 skipped
build/ardupilot_sitl/test_results/ardupilot_sitl/xmllint.xunit.xml: 1 test, 0 errors, 0 failures, 0 skipped

Summary: 76 tests, 0 errors, 7 failures, 4 skipped

Thanks again

Nothing serious. AFAIK, only the tests for ardupilot_dds_tests are fully clean against the linters.

Does this package build when using colcon build ... --packages-select ardupilot_dds_tests? There may be a missing dependency causing the failure?

I think I’m all set now. Thanks, rhys.

1 Like