How to schedule forces at specific times?
So I am using Gazebo to several iterations of a model where apply forces and see how they react. However, I have noticed that there is a minuscule delay between sending the message and Gazebo reacting. I would like my simulation to be as deterministic as possible. Is there a way I can have Gazebo apply forces at a specific SimTime?
It might work if you shortly pause the simulation, send the message, and then restart it.
Or you could write a model plugin (http://gazebosim.org/tutorials/?tut=plugins_model) to apply forces a prescribed times. The plugin runs every iteration so I doubt this would suffer any delay. If you don't need to create this time instances on the fly, this might due.
@nial is there not already a means to do this? Furthermore, I do need to create the time instances on the fly, would I have to implement a topic based control structure then? And won't having a rather complex code running ever iteration only slow things down? Simbody already has an almost unacceptably slow and inconsistent real time factor.
Yes there actually is, through services: http://answers.gazebosim.org/question/9079/how-to-schedule-forces-at-specific-times/. As is explained here you can set the start time and duration of the wrench you want to apply. But This is only really practical for doing it once or twice (from the command line). My best guess would be create a model plugin that you can send ROS messages to from another node when and what force you want to apply.
You linked the answer to itself? I suspect you meant to link it to a different url. Also, is there a way to this without ROS or do I just have to implement this feature myself?
you can use gazebos internal msgs instead of ros...
Won't that be significantly slower though? I really want these simulations to be as deterministic as possible and network latency could influence the result couldn't it?
Sorry, I meant to link this: http://gazebosim.org/tutorials/?tut=ros_comm, but I expect you found it by now. Like evilBiber says you can also use Gazebo's message system (protobufs: http://www.gazebosim.org/tutorials?tut=topics_subscribed&cat=transport). I expect like you say it will be faster because it speaks directly to the Gazebo API instead of through ROS API.