gazebosim / ros_gz_project_template

A template project integrating ROS and Gazebo simulator
Apache License 2.0
104 stars 24 forks source link

Build Error: Ros Humble + Gazebo Fortress #11

Closed DavideLanzoniSacmi closed 8 months ago

DavideLanzoniSacmi commented 9 months ago

Environment

Description

Steps to reproduce

  1. Install gazebo for ROS humble (https://gazebosim.org/docs/fortress/ros_installation): sudo apt-get install ros-humble-ros-gz

  2. Clone this repository under the source folder of a workspace (following https://gazebosim.org/docs/fortress/ros_gz_project_template_guide)

  3. colcon build --cmake-args -DBUILD_TESTING=ON

Output

Latitude-5590:~/project_ws$ colcon build --cmake-args -DBUILD_TESTING=ON
Starting >>> ros_gz_interfaces
Starting >>> ros_gz_sim
Starting >>> sdformat_test_files
Starting >>> ros_gz_example_application                                              
Starting >>> ros_gz_example_bringup
Starting >>> ros_gz_example_description                                              
Starting >>> ros_gz_example_gazebo
--- stderr: sdformat_test_files                                                                  
CMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING

---
Finished <<< sdformat_test_files [1.59s]
Starting >>> sdformat_urdf                                                                       
Finished <<< ros_gz_example_application [1.73s]                                                  
--- stderr: ros_gz_example_gazebo                                                                
CMake Error at CMakeLists.txt:17 (find_package):
  By not providing "Findgz-sim7.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "gz-sim7", but
  CMake did not find one.

  Could not find a package configuration file provided by "gz-sim7" with any
  of the following names:

    gz-sim7Config.cmake
    gz-sim7-config.cmake

  Add the installation prefix of "gz-sim7" to CMAKE_PREFIX_PATH or set
  "gz-sim7_DIR" to a directory containing one of the above files.  If
  "gz-sim7" provides a separate development package or SDK, be sure it has
  been installed.

---
Failed   <<< ros_gz_example_gazebo [1.68s, exited with code 1]
Finished <<< ros_gz_example_bringup [1.85s]                                       
Aborted  <<< sdformat_urdf [0.29s]
Aborted  <<< ros_gz_example_description [1.80s]
Aborted  <<< ros_gz_interfaces [3.07s]                                            
Aborted  <<< ros_gz_sim [3.29s]                            

Summary: 3 packages finished [4.54s]
  1 package failed: ros_gz_example_gazebo
  4 packages aborted: ros_gz_example_description ros_gz_interfaces ros_gz_sim sdformat_urdf
  2 packages had stderr output: ros_gz_example_gazebo sdformat_test_files
  10 packages not processed
jrutgeer commented 8 months ago

EDIT: there is a Fortress branch now, try that one instead. Original post below:

why should this template use only Garden

This is an example repository. Imo it aims at documenting the concepts rather than trying to provide an exact copy-paste solution for each and every version or ROS / Gazebo combination.

What should I use as template for Gazebo Fortress?

You have to adapt the CMakeLists.txt to correspond to the package releases for Fortress. They are listed in the collection-fortress.yaml file.

E.g. you will have to replace

find_package(gz-cmake3 REQUIRED)
find_package(gz-plugin2 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin2_VERSION_MAJOR})
find_package(gz-common5 REQUIRED COMPONENTS profiler)
set(GZ_COMMON_VER ${gz-common5_VERSION_MAJOR})
find_package(gz-sim7 REQUIRED)
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})
[...]

by: EDIT: not tested; correct names seem to be rather ignition-cmake2 instead of ign-cmake2. See further comments in this thread.

find_package(ign-cmake2 REQUIRED)
find_package(ign-plugin1 REQUIRED COMPONENTS register)
set(IGN_PLUGIN_VER ${ign-plugin1_VERSION_MAJOR})
find_package(ign-common4 REQUIRED COMPONENTS profiler)
set(IGN_COMMON_VER ${ign-common4_VERSION_MAJOR})
find_package(ign-gazebo6 REQUIRED)
set(IGN_GAZEBO_VER ${ign-gazebo6_VERSION_MAJOR})
[...]

Obviously not just this section, but throughout the remainder of all CMakeList.txt files.

Mind also that from Fortress to Garden there has been a rename from "Ignition Gazebo" to "Gazebo Sim" due to trademark issues on the 'Ignition' name. That's e.g. why in above code snippet gz-sim7 for Garden is replaced by ign-gazebo6 for Fortress (as opposed to gz-sim6).

Also in the code you will have to change many references of gz and sim into ign and gazebo. For further documentation see the gazebosim.org site.

Anyway, I would not spend the time to try and make this particular repository compile for Fortress. instead, just use it as an example and implement your own code for your project. E.g. start with the system plugin documentation for Fortress, try and get that to compile. The code for that example is in the gz-sim repository (ign-gazebo6 branch), see here.

See also this post on the community forum for more pointers to info on writing Gazebo system plugins.

There is also this upcoming talk at ROSCon2023: Simulate your World: A deeper look at extending Gazebo.

If you have further questions, ask them at the Robotics Stack Exchange instead of here.

DavideLanzoniSacmi commented 8 months ago

Thanks a lot! Really complete answer. I will dig into it better with your pointers

AlfonGio commented 6 months ago

Hi @DavideLanzoniSacmi,

I happened to experience the same error. How are you able to solve all the errors? I try to read the above hints provided but not really sure what to change in the CMakeLists.

Thank you.

EyalBrilling commented 6 months ago

@jrutgeer
Found the error. The naming in the yaml file is wrong. On apt,the library name isn't libign-cmake2-dev but libignition-cmake2 which means the version to be called with find_package is ignition-cmake2.

find_package(ignition-cmake2 REQUIRED)

After using ignition-cmake2, find_package works and compile succsed. Can you please confirm? If it is the case we need to keep an history of wrong version names and fix the yaml file itself I suspect it is the case for all libaries version names.

The funny thing is that on the fortress branch the CMakeLists is correct, so people(including me) fall from the beginning because we check the wrong branch :)

AlfonGio commented 6 months ago

@EyalBrilling Yeah, changing to ignition seems to solve most of the package issues. But I have another error arise regarding BasicSystem.hh and FullSystem.hh. Did it also happened to you?

Screenshot from 2024-01-08 11-40-42

jrutgeer commented 6 months ago

@EyalBrilling Yes, it seems the correct name is ignition-cmake2 instead of ign-cmake2. The yaml file is correct though, as it contains the github repository name and branch:

2024-01-09 10_35_20-gazebosim_gz-cmake at ign-cmake2

The CMakeLists.txt file seems to need rather the corresponding project names, as defined e.g. here.

Anyway, given there appears to be a Fortress branch to this repository now (this thread pre-dates it), the obvious choice is to use that branch, instead of redoing the work. @AlfonGio same remark: try with the Fortress branch instead.