-
Notifications
You must be signed in to change notification settings - Fork 765
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
gazebo_ros_api_plugin cleanup #1137
gazebo_ros_api_plugin cleanup #1137
Conversation
Remove an unused overload of publishSimTime and add doxygen for the remaining publishSimTime function. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
The /clock topic is advertised in both loadGazeboRosApiPlugin and advertiseServices. This removes the code from advertiseServices and moves it earlier in loadGazeboRosApiPlugin. Signed-off-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of my comments are exactly that; comments pointing out why things are like they are. The changes look good to me. I'll approve, but someone else from the Gazebo team should probably take a look.
@@ -193,7 +193,6 @@ void GazeboRosApiPlugin::loadGazeboRosApiPlugin(std::string world_name) | |||
|
|||
gazebonode_ = gazebo::transport::NodePtr(new gazebo::transport::Node()); | |||
gazebonode_->Init(world_name); | |||
//stat_sub_ = gazebonode_->Subscribe("~/world_stats", &GazeboRosApiPlugin::publishSimTime, this); // TODO: does not work in server plugin? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is commented out, we also don't need the void GazeboRosApiPlugin::publishSimTime(const boost::shared_ptr<gazebo::msgs::WorldStatistics const> &msg)
signature below, so it makes sense to remove both.
// publish clock for simulated ros time | ||
pub_clock_ = nh_->advertise<rosgraph_msgs::Clock>("/clock",10); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And now this code is duplicate because we already do this in the main loadGazeboRosApiPlugin
// Manage clock for simulated ros time | ||
pub_clock_ = nh_->advertise<rosgraph_msgs::Clock>("/clock",10); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By moving this above advertiseServices
, we get exactly the same behavior as before, but without the code duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small nit
Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
@osrf-jenkins run tests please |
@ahcorde I merged your suggestion |
Remove an unused overload of publishSimTime and add doxygen for the remaining publishSimTime function. * Remove duplicate code for /clock advertisement The /clock topic is advertised in both loadGazeboRosApiPlugin and advertiseServices. This removes the code from advertiseServices and moves it earlier in loadGazeboRosApiPlugin. Signed-off-by: Steve Peters <scpeters@openrobotics.org> Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
Remove an unused overload of publishSimTime and add doxygen for the remaining publishSimTime function. * Remove duplicate code for /clock advertisement The /clock topic is advertised in both loadGazeboRosApiPlugin and advertiseServices. This removes the code from advertiseServices and moves it earlier in loadGazeboRosApiPlugin. Signed-off-by: Steve Peters <scpeters@openrobotics.org> Co-authored-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
I noticed with @clalancette that
gazebo_ros_api_plugin
advertises the/clock
topic and sets some variables in multiple places (loadGazeboRosApiPlugin() and advertiseServices()). This removes that duplicate code fromadvertiseServices()
and makes sure is called beforeadvertiseServices()
.There's also an unused private function that is an overload of
publishSimTime()
, so I've removed it here and added doxygen for the remainingpublishSimTime()
.