Gazebo does not call ros:init
. It's up to one of your plugins (or a plugin that you load) to call ros::init
.
Originally posted by nkoenig with karma: 7676 on 2013-03-07
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by bit-pirate on 2013-03-08:
Right, but the question is, if it is needed. My plugin for example has subs & pubs, but since it is loaded into gazebo, which is also acting as a ROS node, it works fine without calling ros::init(). So, I wonder in which case it is actually needed.
Comment by Adolfo Rodríguez T on 2013-03-08:
Gazebo is acting as a ROS node because someone inside the process called ros::init(). If it wasn't your plugin, some other plugin must have done it, as standalone Gazebo does not do it. So yes, it is needed to make your plugin robust to the case when it's the only ROS-enabled component inside the Gazebo process.
Comment by bit-pirate on 2013-03-08:
You should have posted this as an answer. :-) Anyway, if I remove all plugins I am using, Gazebo is still showing up as a ROS node and is publishing/subscribing to topics. AFAIK this requires a ros::init(). Am I missing something?
Comment by nkoenig on 2013-03-15:
ROS wraps gazebo. So when you say you run gazebo, you're probably running a special gazebo script that loads in a plugin that in turn calls ros::init. Take a look in the simulator_gazebo
package.