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

Launch gzserver and the bridge as composable nodes #528

Merged
merged 27 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
21d4c23
Add gzserver with ability to load an SDF file or string
azeey Feb 21, 2024
3a5e099
Testing components.
caguero Apr 3, 2024
1b3ba4e
Tweak
caguero Apr 4, 2024
04255e3
Tweak
caguero Apr 4, 2024
d28021a
Tweak
caguero Apr 4, 2024
82633e7
Style
caguero Apr 4, 2024
0a34d24
Merge remote-tracking branch 'origin/ros2' into gz_sim_ros_node
azeey Apr 4, 2024
2506cb9
Merge branch 'gz_sim_ros_node' into gz_sim_ros_node_composition
caguero Apr 4, 2024
2f19e16
Remove comments
caguero Apr 5, 2024
1124d28
Launch file for running gz_bridge (#530)
caguero Apr 11, 2024
78127ca
Launch file for running gzserver (#532)
caguero Apr 18, 2024
2e28e0d
Merge branch 'ros2' into gz_sim_ros_node_composition
caguero May 13, 2024
c2a26ef
Launch file for combined gzserver + bridge (#533)
caguero May 15, 2024
6a73faa
Launch file for combined spawn_model + bridge (#534)
caguero May 15, 2024
1ba6ebf
Launch gzserver from xml (#548)
caguero May 21, 2024
7c380c3
Merge remote-tracking branch 'origin/ros2' into gz_sim_ros_node
azeey May 22, 2024
2b07936
Fix build, remove experimental code
azeey May 22, 2024
35be061
Add comment, fix linter
azeey May 22, 2024
85904db
Merge remote-tracking branch 'origin/gz_sim_ros_node' into gz_sim_ros…
azeey May 22, 2024
8d01ae8
Fix end of file newline
azeey May 22, 2024
08e0389
Merge remote-tracking branch 'origin/ros2' into gz_sim_ros_node_compo…
azeey May 22, 2024
f7eaa49
Update ros_gz_sim/src/gzserver.cpp
caguero May 23, 2024
efb5f92
Update ros_gz_sim/src/gzserver.cpp
caguero May 23, 2024
01345e2
Remove launch_gz and use ros_gz_sim instead
caguero May 23, 2024
122ac28
Merge branch 'gz_sim_ros_node_composition' of github.com:gazebosim/ro…
caguero May 23, 2024
305097b
Tweaks
caguero May 23, 2024
2416aaf
Mostly styule.
caguero May 23, 2024
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
36 changes: 0 additions & 36 deletions launch_gz/package.xml

This file was deleted.

49 changes: 0 additions & 49 deletions launch_gz/setup.py

This file was deleted.

8 changes: 6 additions & 2 deletions ros_gz_sim/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ find_package(gz-msgs REQUIRED)
find_package(gz_sim_vendor REQUIRED)
find_package(gz-sim REQUIRED)
# Needed in launch/gz_sim.launch.py.in
set(GZ_SIM_VER ${gz-sim_VERSION_MAJOR})

gz_find_package(gflags
REQUIRED
PKGCONFIG gflags)
find_package(std_msgs REQUIRED)

# Install the python module for this package
ament_python_install_package(${PROJECT_NAME})

add_executable(create src/create.cpp)
ament_target_dependencies(create
rclcpp
Expand Down Expand Up @@ -93,8 +97,8 @@ install(FILES
)

install(FILES
"launch/gzserver.launch"
"launch/gzserver.launch.py"
"launch/gz_server.launch"
"launch/gz_server.launch.py"
"launch/gz_spawn_model.launch.py"
"launch/ros_gz_sim.launch.py"
"launch/ros_gz_spawn_model.launch.py"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
<arg name="world_sdf_string" default="" />
<arg name="container_name" default="ros_gz_container" />
<arg name="use_composition" default="False" />
<gzserver
<gz_server
world_sdf_file="$(var world_sdf_file)"
world_sdf_string="$(var world_sdf_string)"
container_name="$(var container_name)"
use_composition="$(var use_composition)">
</gzserver>
container_name="$(var container_name)"
use_composition="$(var use_composition)">
</gz_server>
</launch>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Launch gzserver in a component container."""
"""Launch gz_server in a component container."""

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
Expand Down Expand Up @@ -56,7 +56,7 @@ def generate_launch_description():
ComposableNode(
package='ros_gz_sim',
plugin='ros_gz_sim::GzServer',
name='gzserver',
name='gz_server',
parameters=[{'world_sdf_file': LaunchConfiguration('world_sdf_file'),
'world_sdf_string': LaunchConfiguration('world_sdf_string')}],
extra_arguments=[{'use_intra_process_comms': True}],
Expand All @@ -73,7 +73,7 @@ def generate_launch_description():
ld.add_action(declare_world_sdf_string_cmd)
ld.add_action(declare_container_name_cmd)
ld.add_action(declare_use_composition_cmd)
# Add the actions to launch all of the gzserver nodes
# Add the actions to launch all of the gz_server nodes
ld.add_action(load_nodes)
ld.add_action(load_composable_nodes)

Expand Down
8 changes: 4 additions & 4 deletions ros_gz_sim/launch/ros_gz_sim.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ def generate_launch_description():
('use_respawn', use_respawn),
('bridge_log_level', bridge_log_level)])

gzserver_description = IncludeLaunchDescription(
gz_server_description = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[PathJoinSubstitution([FindPackageShare('ros_gz_sim'),
'launch',
'gzserver.launch.py'])]),
'gz_server.launch.py'])]),
launch_arguments=[('world_sdf_file', world_sdf_file),
('world_sdf_string', world_sdf_string),
('use_composition', use_composition), ])
Expand All @@ -104,8 +104,8 @@ def generate_launch_description():
ld.add_action(declare_bridge_log_level_cmd)
ld.add_action(declare_world_sdf_file_cmd)
ld.add_action(declare_world_sdf_string_cmd)
# Add the actions to launch all of the bridge + gzserver nodes
# Add the actions to launch all of the bridge + gz_server nodes
ld.add_action(bridge_description)
ld.add_action(gzserver_description)
ld.add_action(gz_server_description)

return ld
5 changes: 5 additions & 0 deletions ros_gz_sim/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
<license>Apache 2.0</license>

<author>Alejandro Hernandez</author>
<author email="addisuzt@intrinsic.ai">Addisu Taddese</author>
<author email="caguero@openrobotics.org">Carlos Agüero</author>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>
<buildtool_depend>pkg-config</buildtool_depend>

<depend>ament_index_python</depend>
<depend>launch</depend>
<depend>launch_ros</depend>
<depend>libgflags-dev</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Main entry point for the `launch_gz` package."""
"""Main entry point for the `ros_gz_sim` package."""

from . import actions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@
from launch.substitutions import PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare

@expose_action('gzserver')
@expose_action('gz_server')
class GzServer(Action):
"""Action that executes a gzserver ROS [composable] node."""
"""Action that executes a gz_server ROS [composable] node."""

def __init__(
self,
*,
world_sdf_file: SomeSubstitutionsType,
world_sdf_string: SomeSubstitutionsType,
container_name: SomeSubstitutionsType,
use_composition: SomeSubstitutionsType,
world_sdf_file: Optional[SomeSubstitutionsType],
world_sdf_string: Optional[SomeSubstitutionsType],
container_name: Optional[SomeSubstitutionsType],
use_composition: Optional[SomeSubstitutionsType],
azeey marked this conversation as resolved.
Show resolved Hide resolved
**kwargs
) -> None:
"""
Construct a gzserver action.
Construct a gz_server action.

All arguments are forwarded to `ros_gz_sim.launch.gzserver.launch.py`, so see the documentation
All arguments are forwarded to `ros_gz_sim.launch.gz_server.launch.py`, so see the documentation
of that class for further details.

:param: world_sdf_file Path to the SDF world file.
Expand All @@ -59,7 +59,7 @@ def __init__(

@classmethod
def parse(cls, entity: Entity, parser: Parser):
"""Parse gzserver."""
"""Parse gz_server."""
_, kwargs = super().parse(entity, parser)

world_sdf_file = entity.get_attr(
Expand Down Expand Up @@ -101,15 +101,15 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]:
Execute the action.
"""

gzserver_description = IncludeLaunchDescription(
gz_server_description = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[PathJoinSubstitution([FindPackageShare('ros_gz_sim'),
'launch',
'gzserver.launch.py'])]),
'gz_server.launch.py'])]),
launch_arguments=[('world_sdf_file', self.__world_sdf_file),
('world_sdf_string', self.__world_sdf_string),
('container_name', self.__container_name),
('use_composition', self.__use_composition),
])

return [gzserver_description]
return [gz_server_description]
3 changes: 3 additions & 0 deletions ros_gz_sim/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[options.entry_points]
launch.frontend.launch_extension =
ros_gz_sim = ros_gz_sim
azeey marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 2 additions & 0 deletions ros_gz_sim/src/gzserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ class GzServer : public rclcpp::Node
RCLCPP_ERROR(
this->get_logger(),
"Must specify either 'world_sdf_file' or 'world_sdf_string'");
rclcpp::shutdown();
return;
caguero marked this conversation as resolved.
Show resolved Hide resolved
}

gz::sim::Server server(server_config);
server.Run(true /*blocking*/, 0, false /*paused*/);
caguero marked this conversation as resolved.
Show resolved Hide resolved
rclcpp::shutdown();
}

private:
Expand Down
Loading