How to schedule forces at specific times?

asked 2015-07-29 12:20:47 -0500

Skylion gravatar image

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?

edit retag flag offensive close merge delete

Comments

It might work if you shortly pause the simulation, send the message, and then restart it.

AndreiHaidu gravatar imageAndreiHaidu ( 2015-07-30 03:05:26 -0500 )edit

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.

niall gravatar imageniall ( 2015-07-30 07:22:44 -0500 )edit

@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.

Skylion gravatar imageSkylion ( 2015-07-30 11:33:13 -0500 )edit

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.

niall gravatar imageniall ( 2015-07-31 16:52:19 -0500 )edit

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?

Skylion gravatar imageSkylion ( 2015-08-03 13:16:13 -0500 )edit

you can use gazebos internal msgs instead of ros...

evilBiber gravatar imageevilBiber ( 2015-08-05 07:06:06 -0500 )edit

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?

Skylion gravatar imageSkylion ( 2015-08-06 10:16:35 -0500 )edit

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.

niall gravatar imageniall ( 2015-09-02 14:12:32 -0500 )edit