Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding ign_gazebo_dev package #240

Draft
wants to merge 2 commits into
base: foxy
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ros_ign_dev/ign_gazebo_dev/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.5)
find_package(ament_cmake REQUIRED)
project(ign_gazebo_dev)

ament_package(
CONFIG_EXTRAS cmake/ignition_gazebo_dev-extras.cmake)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This code here calls and sets required igniton gazebo based on ROS Distribution so,packages can directly go find_package(ign_gazebo_dev) so,that
# they don't need to change code with different ros distros
set( ENV{OVERRIDE_ROS_GZ_VERSION} 6 )

if(DEFINED ENV{ROS_DISTRO})
message(STATUS "Detected ROS Distro is $ENV{ROS_DISTRO}")
endif()

if("$ENV{ROS_DISTRO}" MATCHES "foxy")
find_package(ignition-gazebo3 REQUIRED)
set(IGN_GAZEBO_VER ${ignition-gazebo3_VERSION_MAJOR})
elseif("$ENV{ROS_DISTRO}" MATCHES "galactic")
find_package(ignition-gazebo5 REQUIRED)
set(IGN_GAZEBO_VER ${ignition-gazebo5_VERSION_MAJOR})
elseif("$ENV{ROS_DISTRO}" MATCHES "humble")
find_package(ignition-gazebo6 REQUIRED)
set(IGN_GAZEBO_VER ${ignition-gazebo6_VERSION_MAJOR})
else()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is probably worth allowing an override / fallback for unofficial ROS distributions.

Using a CMake variable like OVERRIDE_ROS_GZ_VERSION or similar for override or checking ROS_GZ_VERSION environment variable to fall back to if no known ROS_DISTRO is found.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added ign fortress as an override version in ignition_gazebo_dev-extras.cmake and package.xml.

message(STATUS "No ROS Distro detected")
message(STATUS "Setting to default gazebo version")
find_package(ignition-gazebo$ENV{OVERRIDE_ROS_GZ_VERSION} REQUIRED)
set(IGN_GAZEBO_VER ${ignition-gazebo$ENV{OVERRIDE_ROS_GZ_VERSION}_VERSION_MAJOR})

endif()
32 changes: 32 additions & 0 deletions ros_ign_dev/ign_gazebo_dev/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<package format="3">
<name>ign_gazebo_dev</name>
<version>1.0.0</version>
<description>Package to pull default ignition gazebo version for each ROS distro</description>

<maintainer email="[email protected]">Harsh Mahesheka</maintainer>

<license>Apache License 2.0</license>

<author>Harsh Mahesheka</author>

<build_depend>ros_environment</build_depend>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend condition="$ROS_DISTRO == foxy">ignition-gazebo3</depend>
<depend condition="$ROS_DISTRO == galactic">ignition-gazebo5</depend>
<depend condition="$ROS_DISTRO == humble">ignition-gazebo6</depend>

<!-- If no known ROS DISTRO is found,it will fall back to default a version -->

<depend condition="$ROS_DISTRO !=humble and $ROS_DISTRO !=galactic and $ROS_DISTRO!=foxy" >ignition-gazebo6</depend>





<!-- The above line makes the package depend on igniton version based on ROS Distribution So, packages can directly depend on it
so that they don't have to change code with different ros distros -->
<export>
<build_type>ament_cmake</build_type>
</export>
</package>