Skip to content

Commit

Permalink
Forward port cleanup (#14)
Browse files Browse the repository at this point in the history
* updated build instructions and dependencies

Signed-off-by: Dharini Dutia <dharini@openrobotics.org>

* version logic

Signed-off-by: Dharini Dutia <dharini@openrobotics.org>

---------

Signed-off-by: Dharini Dutia <dharini@openrobotics.org>
  • Loading branch information
quarkytale authored Nov 30, 2023
1 parent ea5ef01 commit b7bf3d5
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 8 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ A template project integrating ROS 2 and Gazebo simulator.


## Install

For using the template with Gazebo Fortress switch to the `fortress` branch of this repository, otherwise use the default branch `main` for Gazebo Harmonic onwards.

### Requirements

1. Choose a ROS and Gazebo combination https://gazebosim.org/docs/harmonic/ros_installation
1. Choose a ROS and Gazebo combination https://gazebosim.org/docs/latest/ros_installation
Note: If you're using a specific and unsupported Gazebo version with ROS 2, you might need to set the `GZ_VERSION` environment variable, for example:

```bash
export GZ_VERSION=garden
export GZ_VERSION=harmonic
```

1. Install necessary tools
Expand Down
2 changes: 2 additions & 0 deletions ros_gz_example_bringup/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.5)
project(ros_gz_example_bringup)

find_package(ament_cmake REQUIRED)
find_package(ros_gz_example_description REQUIRED)
find_package(ros_gz_example_gazebo REQUIRED)

# Install project launch files
install(
Expand Down
5 changes: 5 additions & 0 deletions ros_gz_example_bringup/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
<author>Michael Carroll</author>
<author>Dharini Dutia</author>

<depend>joint_state_publisher_gui</depend>

<depend>ros_gz_example_description</depend>
<depend>ros_gz_example_gazebo</depend>

<buildtool_depend>ament_cmake</buildtool_depend>

<test_depend>ament_lint_auto</test_depend>
Expand Down
15 changes: 13 additions & 2 deletions ros_gz_example_gazebo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,25 @@ project(ros_gz_example_gazebo)
# The 'set' directive defines a variable (e.g. 'GZ_PLUGIN_VER').
# Such variables can be used lateron in the CMakeLists.txt file.
find_package(ament_cmake REQUIRED)
find_package(ros_gz_example_description REQUIRED)

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})

# Harmonic
if("$ENV{GZ_VERSION}" STREQUAL "harmonic")
find_package(gz-sim8 REQUIRED)
set(GZ_SIM_VER ${gz-sim8_VERSION_MAJOR})
message(STATUS "Compiling against Gazebo Harmonic")
# Default to Garden
else()
find_package(gz-sim7 REQUIRED)
set(GZ_SIM_VER ${gz-sim7_VERSION_MAJOR})
message(STATUS "Compiling against Gazebo Garden")
endif()


# Following 'add_library' directive defines a library target named 'BasicSystem'.
Expand Down
2 changes: 1 addition & 1 deletion ros_gz_example_gazebo/hooks/ros_gz_example_gazebo.sh.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ament_prepend_unique_value GZ_SIM_RESOURCE_PATH "$AMENT_CURRENT_PREFIX/share/@PROJECT_NAME@/worlds"
ament_prepend_unique_value GZ_SIM_PLUGIn_PATH "$AMENT_CURRENT_PREFIX/lib/@PROJECT_NAME@"
ament_prepend_unique_value GZ_SIM_PLUGIN_PATH "$AMENT_CURRENT_PREFIX/lib/@PROJECT_NAME@"
2 changes: 2 additions & 0 deletions ros_gz_example_gazebo/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<author>Michael Carroll</author>
<author>Dharini Dutia</author>

<depend>ros_gz_example_description</depend>

<buildtool_depend>ament_cmake</buildtool_depend>

<test_depend>ament_lint_auto</test_depend>
Expand Down
2 changes: 1 addition & 1 deletion ros_gz_example_gazebo/src/BasicSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ void BasicSystem::PostUpdate(const gz::sim::UpdateInfo &_info,
}
}

} // namespace ros_gz_example_gazeba
} // namespace ros_gz_example_gazebo
2 changes: 1 addition & 1 deletion ros_gz_example_gazebo/src/FullSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ void FullSystem::Reset(const gz::sim::UpdateInfo &_info,
{
gzdbg << "ros_gz_example_gazebo::FullSystem::Reset" << std::endl;
}
} // namespace ros_gz_example_gazeba
} // namespace ros_gz_example_gazebo
2 changes: 1 addition & 1 deletion template_workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repositories:
type: git
url: https://github.com/gazebosim/ros_gz_project_template.git
version: main
# Must compile ros_gz from source because Humble + Garden is not an official combination
# Must compile ros_gz from source for combinations that are not officially supported
ros_gz:
type: git
url: https://github.com/gazebosim/ros_gz.git
Expand Down

0 comments on commit b7bf3d5

Please sign in to comment.