gazebosim / ros_gz

Integration between ROS (1 and 2) and Gazebo simulation
https://gazebosim.org
Apache License 2.0
261 stars 139 forks source link

Statically-composable `gzserver` #631

Open roncapat opened 2 weeks ago

roncapat commented 2 weeks ago

Currently, no header file is defined for https://github.com/gazebosim/ros_gz/blob/ros2/ros_gz_sim/src/gzserver.cpp

This means that currently there is no possibility to import the node in a custom main.cpp to be statically composed with other nodes in the same process space, but the user is forced to go with dynamic composition.

The solution is fairly simple, and I may open a PR if you agree to add the header of this node and make it linkable from 3-rd party projects.

azeey commented 2 weeks ago

I'm not opposed to this, but having a public header adds a constraint on how we can modify the GzServer class. If we do this, we should remedy this by using the PIMPL pattern via GZ_UTILS_UNIQUE_IMPL_PTR from gz-utils https://github.com/gazebosim/gz-utils/blob/gz-utils3/include/gz/utils/ImplPtr.hh