Skip to content

Commit c7ae81a

Browse files
authored
Sync Ionic and Jetty directories with Harmonic (gazebosim#599)
* Updates from Harmonic/Ionic to Jetty Signed-off-by: Addisu Z. Taddese <[email protected]> * Updates from Harmonic to Ionic Signed-off-by: Addisu Z. Taddese <[email protected]> * Update rosdep instructions Signed-off-by: Addisu Z. Taddese <[email protected]> * Keep the skip-keys on gz-cmake3 Signed-off-by: Addisu Z. Taddese <[email protected]> --------- Signed-off-by: Addisu Z. Taddese <[email protected]>
1 parent bae0853 commit c7ae81a

File tree

10 files changed

+284
-103
lines changed

10 files changed

+284
-103
lines changed

ionic/ros2_integration.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -78,36 +78,34 @@ ros2 launch ros_gz_bridge ros_gz_bridge.launch.py bridge_name:=ros_gz_bridge con
7878
Alternatively, if an existing container is already running, you can pass its name
7979
when launching the bridge using the `container_name` parameter. More info about composition can be viewed [here](ros2_overview.md#composition)
8080

81-
Check [this block](https://github.com/gazebosim/ros_gz/blob/jazzy/ros_gz_bridge/launch/ros_gz_bridge.launch.py#L27-L34)
81+
Check [this block](https://github.com/gazebosim/ros_gz/blob/jazzy/ros_gz_bridge/launch/ros_gz_bridge.launch.py#L25-L68)
8282
from the source code to know all the different parameters accepted by this
8383
launch file.
8484

85+
QOS Overrides:
86+
87+
QOS overrides can be passed as extra parameters to the bridge using the `bridge_params` argument of the launch file. An example of this:
88+
```bash
89+
ros2 launch ros_gz_bridge ros_gz_bridge.launch.py bridge_name:=ros_gz_bridge config_file:=<path_to_your_YAML_file> bridge_params:={'qos_overrides./topic_name.publisher.durability': 'transient_local', 'qos_overrides./another_topic_name.publisher.durability': 'transient_local'}
90+
```
91+
You can omit the following from what you pass to `bridge_params`: `{}`, ` `, `"`, `'`.
92+
93+
More info about using QOS overrides can be found [here](https://docs.ros.org/en/jazzy/How-To-Guides/Overriding-QoS-Policies-For-Recording-And-Playback.html#using-qos-overrides)
94+
8595
## Launching the bridge from a custom launch file in XML.
8696

8797
It's also possible to trigger the bridge from your custom launch file. For that
8898
purpose we have created the `<ros_gz_bridge/>` tag that can be used from you
8999
XML or YAML launch file. In this case, the arguments are passed as attributes
90-
within this tag. Here's an example:
100+
within this tag. Here's a simplified example, a more comprehensive example can be viewed [here](https://github.com/gazebosim/ros_gz/blob/ros2/ros_gz_bridge/launch/ros_gz_bridge.launch):
91101

92102
```xml
93103
<launch>
94104
<arg name="bridge_name" />
95105
<arg name="config_file" />
96-
<arg name="container_name" default="ros_gz_container" />
97-
<arg name="create_own_container" default="False" />
98-
<arg name="namespace" default="" />
99-
<arg name="use_composition" default="False" />
100-
<arg name="use_respawn" default="False" />
101-
<arg name="log_level" default="info" />
102106
<ros_gz_bridge
103107
bridge_name="$(var bridge_name)"
104-
config_file="$(var config_file)"
105-
container_name="$(var container_name)"
106-
create_own_container="$(var create_own_container)"
107-
namespace="$(var namespace)"
108-
use_composition="$(var use_composition)"
109-
use_respawn="$(var use_respawn)"
110-
log_level="$(var log_level)">
108+
config_file="$(var config_file)">
111109
</ros_gz_bridge>
112110
</launch>
113111
```
@@ -119,7 +117,7 @@ of the values or not even use all the parameters.
119117
## Launching the bridge from a custom launch file in Python.
120118

121119
Here's a simplified example of a Python launch file used to load a bridge from
122-
Python:
120+
Python, a more comprehensive example can be viewed [here](https://github.com/gazebosim/ros_gz/blob/ros2/ros_gz_bridge/launch/ros_gz_bridge.launch.py):
123121
```python
124122
from launch import LaunchDescription
125123
from launch.actions import DeclareLaunchArgument

ionic/ros2_launch_gazebo.md

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,45 +54,49 @@ an option but not strictly necessary as you could decide to hardcode some of the
5454
values or not even use all the parameters.
5555

5656
### Python
57-
Python launch files provide more low-level customization and logic compared to XML launch files.
58-
In the following example, the user can specify a world argument to launch an environment for
59-
the Moon, Mars, or Enceladus. It additionally sets the resource path environment variable and
60-
sets up empty arrays for topics to be bridged and remapped from Gazebo to ROS 2:
57+
Python launch files provide more low-level customization and logic compared to XML launch files. For example, you can set environment variables and include Python specific functions and logic.
58+
In the following example, the user can replace the example package, world, and bridged topic with their own. This is intended as a scaffolding more than something that can be run on its own.
59+
6160
```python
62-
from ament_index_python.packages import get_package_share_directory
6361
from launch import LaunchDescription
64-
from launch.actions import (DeclareLaunchArgument, SetEnvironmentVariable,
65-
IncludeLaunchDescription, SetLaunchConfiguration)
66-
from launch.substitutions import PathJoinSubstitution, LaunchConfiguration, TextSubstitution
6762
from launch_ros.actions import Node
63+
from launch.actions import SetEnvironmentVariable, IncludeLaunchDescription
6864
from launch.launch_description_sources import PythonLaunchDescriptionSource
65+
from launch.substitutions import PathJoinSubstitution
66+
from launch_ros.substitutions import FindPackageShare
6967

7068

7169
def generate_launch_description():
72-
pkg_ros_gz_sim = get_package_share_directory('ros_gz_sim')
73-
pkg_spaceros_gz_sim = get_package_share_directory('spaceros_gz_sim')
70+
ros_gz_sim_pkg_path = get_package_share_directory('ros_gz_sim')
71+
example_pkg_path = FindPackageShare('example_package') # Replace with your own package name
7472
gz_launch_path = PathJoinSubstitution([pkg_ros_gz_sim, 'launch', 'gz_sim.launch.py'])
75-
gz_model_path = PathJoinSubstitution([pkg_spaceros_gz_sim, 'models'])
7673

7774
return LaunchDescription([
78-
DeclareLaunchArgument(
79-
'world',
80-
default_value='moon',
81-
choices=['moon', 'mars', 'enceladus'],
82-
description='World to load into Gazebo'
75+
SetEnvironmentVariable(
76+
'GZ_SIM_RESOURCE_PATH',
77+
PathJoinSubstitution([example_pkg_path, 'models'])
78+
),
79+
SetEnvironmentVariable(
80+
'GZ_SIM_PLUGIN_PATH',
81+
PathJoinSubstitution([example_pkg_path, 'plugins'])
8382
),
84-
SetLaunchConfiguration(name='world_file',
85-
value=[LaunchConfiguration('world'),
86-
TextSubstitution(text='.sdf')]),
87-
SetEnvironmentVariable('GZ_SIM_RESOURCE_PATH', gz_model_path),
8883
IncludeLaunchDescription(
8984
PythonLaunchDescriptionSource(gz_launch_path),
9085
launch_arguments={
91-
'gz_args': [PathJoinSubstitution([pkg_spaceros_gz_sim, 'worlds',
92-
LaunchConfiguration('world_file')])],
86+
'gz_args': [PathJoinSubstitution([example_pkg_path, 'worlds/example_world.sdf'])], # Replace with your own world file
9387
'on_exit_shutdown': 'True'
9488
}.items(),
9589
),
90+
91+
# Bridging and remapping Gazebo topics to ROS 2 (replace with your own topics)
92+
Node(
93+
package='ros_gz_bridge',
94+
executable='parameter_bridge',
95+
arguments=['/example_imu_topic@sensor_msgs/msg/[email protected]',],
96+
remappings=[('/example_imu_topic',
97+
'/remapped_imu_topic'),],
98+
output='screen'
99+
),
96100
])
97101
```
98102

jetty/Model_insertion_fuel.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ There are a few different ways to spawn a model into the simulation.
4949
- Download the model files from [app.gazebosim.org/fuel/models](https://app.gazebosim.org/fuel/models).
5050
- Extract the files and place them under your local model directory (e.g. `~/my-local-models/model-name`).
5151
The folder should contain `materials`, `meshes` as well as the `model.config` and the `model.sdf` files.
52-
- Add your model directory as a resource with `export GZ_SIM_RESOURCE_PATH=~/my-local-models/model-name`
52+
- Add your model directory as a resource with `export GZ_SIM_RESOURCE_PATH=~/my-local-models/`
5353
- Open the Gazebo Simulator and add the Resource Spawner Plugin, the model should now show up under your local resources.
5454

5555
![Resource Spawner - Fuel resources](tutorials/fuel_insert/resource_spawner_local.png)

jetty/install_ubuntu_src.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,38 @@ sudo apt -y install \
103103
$(sort -u $(find . -iname 'packages-'`lsb_release -cs`'.apt' -o -iname 'packages.apt' | grep -v '/\.git/') | sed '/gz\|sdf/d' | tr '\n' ' ')
104104
```
105105

106+
Alternatively, if you want to install dependencies using
107+
[rosdep](https://docs.ros.org/en/rolling/Tutorials/Intermediate/Rosdep.html),
108+
ensure that [rosdep is installed](https://docs.ros.org/en/rolling/Tutorials/Intermediate/Rosdep.html#how-do-i-use-the-rosdep-tool)
109+
and use the following command:
110+
111+
```bash
112+
cd ~/workspace/src
113+
rosdep install -i --from-path . -y \
114+
--skip-keys "gz-cmake3 DART libogre-dev libogre-next-2.3-dev"
115+
```
116+
117+
The `rosdep` command attempts to install dependencies listed in `package.xml`
118+
files, but when problems arise the `--skip-keys` argument is used. Explanations
119+
for its use in the previous line are given below:
120+
121+
* `gz-cmake3`: `gz-tools2` can build from source against
122+
[any of `gz-cmake3`, `gz-cmake4`, and `gz-cmake` (v5)](https://github.com/gazebosim/gz-tools/pull/128),
123+
and this workspace only contains `gz-cmake` (v5). The `gz-tools2` `package.xml`
124+
file only [depends on gz-cmake3](https://github.com/gazebosim/gz-tools/blob/2b228e5b956/package.xml#L13)
125+
and since that package is not present, use `--skip-keys gz-cmake3`.
126+
* `DART`: `gz-physics` can build against [dartsim](http://dartsim.github.io),
127+
which is listed as DART in the [gz-physics package.xml file](https://github.com/gazebosim/gz-physics/blob/main/package.xml#L16).
128+
This package is not in the workspace, so `DART` is added to the `--skip-keys`
129+
string.
130+
See the discussion in [gz-physics#608](https://github.com/gazebosim/gz-physics/pull/608#discussion_r1589512231)
131+
for more background on the package name used for `DART`.
132+
* `libogre-dev` and `libogre-next-2.3-dev`: `gz-rendering` can build against
133+
ogre 1.9 and ogre-next 2.3. The debian package names are listed as
134+
dependencies in the [gz-rendering package.xml](https://github.com/gazebosim/gz-rendering/blob/main/package.xml#L22-L23)
135+
but they are not available on all Linux versions, so work around with
136+
`--skip-keys "libogre-dev libogre-next-2.3-dev"`.
137+
106138
## Building the Gazebo Libraries
107139

108140
Once the compiler and all the sources are in place it is time to compile them.

jetty/ros2_integration.md

Lines changed: 69 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,43 +65,93 @@ for a valid configuration file.
6565

6666
The package `ros_gz_bridge` contains a launch file named
6767
`ros_gz_bridge.launch.py`. You can use it to start a ROS 2 and Gazebo bridge.
68+
6869
Here's an example:
70+
```bash
71+
ros2 launch ros_gz_bridge ros_gz_bridge.launch.py bridge_name:=ros_gz_bridge config_file:=<path_to_your_YAML_file>
72+
```
73+
74+
Launching with composition:
75+
```bash
76+
ros2 launch ros_gz_bridge ros_gz_bridge.launch.py bridge_name:=ros_gz_bridge config_file:=<path_to_your_YAML_file> use_composition:=True create_own_container:=True
77+
```
78+
Alternatively, if an existing container is already running, you can pass its name
79+
when launching the bridge using the `container_name` parameter. More info about composition can be viewed [here](ros2_overview.md#composition)
80+
81+
Check [this block](https://github.com/gazebosim/ros_gz/blob/jazzy/ros_gz_bridge/launch/ros_gz_bridge.launch.py#L25-L68)
82+
from the source code to know all the different parameters accepted by this
83+
launch file.
84+
85+
QOS Overrides:
6986

87+
QOS overrides can be passed as extra parameters to the bridge using the `bridge_params` argument of the launch file. An example of this:
7088
```bash
71-
ros2 launch ros_gz_bridge ros_gz_bridge.launch.py name:=ros_gz_bridge config_file:=<path_to_your_YAML_file>
89+
ros2 launch ros_gz_bridge ros_gz_bridge.launch.py bridge_name:=ros_gz_bridge config_file:=<path_to_your_YAML_file> bridge_params:={'qos_overrides./topic_name.publisher.durability': 'transient_local', 'qos_overrides./another_topic_name.publisher.durability': 'transient_local'}
7290
```
91+
You can omit the following from what you pass to `bridge_params`: `{}`, ` `, `"`, `'`.
7392

74-
## Launching the bridge from a custom launch file.
93+
More info about using QOS overrides can be found [here](https://docs.ros.org/en/jazzy/How-To-Guides/Overriding-QoS-Policies-For-Recording-And-Playback.html#using-qos-overrides)
94+
95+
## Launching the bridge from a custom launch file in XML.
7596

7697
It's also possible to trigger the bridge from your custom launch file. For that
7798
purpose we have created the `<ros_gz_bridge/>` tag that can be used from you
7899
XML or YAML launch file. In this case, the arguments are passed as attributes
79-
within this tag. Here's an example:
100+
within this tag. Here's a simplified example, a more comprehensive example can be viewed [here](https://github.com/gazebosim/ros_gz/blob/ros2/ros_gz_bridge/launch/ros_gz_bridge.launch):
80101

81102
```xml
82103
<launch>
83-
<arg name="name" default="ros_gz_bridge" />
84-
<arg name="config_file" default="" />
85-
<arg name="container_name" default="ros_gz_container" />
86-
<arg name="namespace" default="" />
87-
<arg name="use_composition" default="True" />
88-
<arg name="use_respawn" default="False" />
89-
<arg name="log_level" default="info" />
90-
<ros_gz_bridge
91-
name="$(var name)"
92-
config_file="$(var config_file)"
93-
container_name="$(var container_name)"
94-
namespace="$(var namespace)"
95-
use_composition="$(var use_composition)"
96-
use_respawn="$(var use_respawn)"
97-
log_level="$(var log_level)">
104+
<arg name="bridge_name" />
105+
<arg name="config_file" />
106+
<ros_gz_bridge
107+
bridge_name="$(var bridge_name)"
108+
config_file="$(var config_file)">
98109
</ros_gz_bridge>
99110
</launch>
100111
```
101112

102113
In this case the `<ros_gz_bridge>` parameters are read from the command line.
103114
That's an option but not strictly necessary as you could decide to hardcode some
104-
of the values.
115+
of the values or not even use all the parameters.
116+
117+
## Launching the bridge from a custom launch file in Python.
118+
119+
Here's a simplified example of a Python launch file used to load a bridge from
120+
Python, a more comprehensive example can be viewed [here](https://github.com/gazebosim/ros_gz/blob/ros2/ros_gz_bridge/launch/ros_gz_bridge.launch.py):
121+
```python
122+
from launch import LaunchDescription
123+
from launch.actions import DeclareLaunchArgument
124+
from launch.substitutions import LaunchConfiguration, TextSubstitution
125+
from ros_gz_bridge.actions import RosGzBridge
126+
127+
128+
def generate_launch_description():
129+
130+
bridge_name = LaunchConfiguration('bridge_name')
131+
config_file = LaunchConfiguration('config_file')
132+
133+
declare_bridge_name_cmd = DeclareLaunchArgument(
134+
'bridge_name', description='Name of ros_gz_bridge node'
135+
)
136+
137+
declare_config_file_cmd = DeclareLaunchArgument(
138+
'config_file', description='YAML config file'
139+
)
140+
141+
# Create the launch description and populate
142+
ld = LaunchDescription([
143+
RosGzBridge(
144+
bridge_name=LaunchConfiguration('bridge_name'),
145+
config_file=LaunchConfiguration('config_file'),
146+
),
147+
])
148+
149+
# Declare the launch options
150+
ld.add_action(declare_bridge_name_cmd)
151+
ld.add_action(declare_config_file_cmd)
152+
153+
return ld
154+
```
105155

106156
## Publish key strokes to ROS
107157

0 commit comments

Comments
 (0)