ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

ROS & Gazebo moving object following a trajectory

asked 2017-05-20 04:34:50 -0600

Orestis gravatar image

Hello all, I pretty new to gazebo and ROS environment so I would like a little help on where to start with a project I am working on.

So, what I want to do is create a simulation for an object which could be anything from just a box or a quadrotor but only in the shape not in the properties. This object is governed by some kinematics which actually are a double integrator for acceleration in x and y directions. I have the state space system and I am currently implementing an optimal feedback control (MPC) in order for the object to follow a given trajectory.

What I would like to do is to simulate this scenario for an abstract object (I want to do upper level control) in Gazebo and ROS environment but I do not know from where to start. A thought would be to have a model like the standing person model or the quadrotor model with a mass of 1 and find each time step to apply the force needed (F=m*a) in x and y in order for the object to follow the trajectory given. I do not know however neither how this could be done nor from where to start. So if you have any suggestions or tutorials that could help me with it, this would be very helpful.

Thank you a lot in advance!

edit retag flag offensive close merge delete


Do you want Gazebo's physics engine to apply forces to your object (gravity, contacts...), or are you calculating that yourself and just want to send precise trajectories which the object should hold inside the simulation?

chapulina gravatar image chapulina  ( 2017-05-23 11:23:36 -0600 )edit

I'm mostly interested in the second part. I have the trajectory and I want the object to hold this trajectory inside the simulation

Orestis gravatar image Orestis  ( 2017-05-23 13:06:46 -0600 )edit

Will setting the position of my object through service gazebo/setModelState in a node work?

BotLover gravatar image BotLover  ( 2017-07-26 03:24:38 -0600 )edit

It should work, be sure to make the model static

chapulina gravatar image chapulina  ( 2017-07-27 22:15:26 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-26 11:37:11 -0600

Here is a tutorial on how to send velocities to a model using a Gazebo plugin.

For your purposes, since you don't want Gazebo's physics to move the object, you can make it <static> on SDF.

Then instead of setting velocity on the plugin's update loop, you can set world pose.

You can see an example here which sends random poses to a model.

edit flag offensive delete link more

Question Tools


Asked: 2017-05-20 04:34:50 -0600

Seen: 7,563 times

Last updated: May 26 '17