1 | initial version |
You can bind the OnUpdate function to different Event or timer.
this->updateConnection = event::Events::ConnectWorldUpdateBegin(
std::bind(&VtolForce::OnUpdate, this));
The ConnectWorldUpdateBegin event happend on every timestep.
There should be a way how to use the ros Timer event to call your function. I made it work once, but don't have the working code around any longer.
Or you can use the OnUpdate function as you have now, just check for the time elapsed from the last time you published. That is the approach I see most often in Gazebo plugins.