Robotics StackExchange | Archived questions

Please what is the correct way to use AttachStaticModel function?

I am implementing a simple robot behavior where the robot represented as a box picks an object and drops it at a goal location. However, when the robot reaches the object location to pick it, it doesn't pick it.

A simplified version of the task has been attached mppickdrop.cc

All it does is to attach the m_litter to this->model and change the pose of the robot. This doesn't work, as the box just stays frozen at initialized pose. Please what am I getting wrong?

I am using gazebo 7

my robot model is a simple box.Robot sdf robot

object to pick (m_litter) is also a simple red box.object sdf object

The world is world sdf world

Many thanks in advance. The complete plugin source code is ModelPlugin source file

Asked by elcymon on 2017-01-13 08:16:29 UTC

Comments

Can you change 0 to 1 in the m_litter sdf model?

Asked by nkoenig on 2017-01-13 11:28:09 UTC

Can you change <static>0</static> to <static>1</static> in the m_litter sdf model?

Asked by nkoenig on 2017-01-13 11:28:41 UTC

Can you change the static value from 0 to 1 in the m_litter sdf model?

Asked by nkoenig on 2017-01-13 11:29:13 UTC

I set static element to 1 and it still didn't solve the problem.

gazebo -v returns version 7.4.0

Asked by elcymon on 2017-01-13 12:24:38 UTC

Your "OnUpdate" function is called every cycle of simulation. It would be better to call AttachStaticModel only once. This probably won't fix your problem.

Asked by nkoenig on 2017-01-13 16:36:02 UTC

Answers

The API documentation says:

/// \brief Attach a static model to this model 
///
/// This function takes as input a static Model, which is a Model that
/// has been marked as static (no physics simulation), and attaches it
/// to this Model with a given offset.
///
/// This function is useful when you want to simulate a grasp of a
/// static object, or move a static object around using a dynamic
/// model.
///
/// If you are in doubt, do not use this function.
///
/// \param[in] _model Pointer to the static model.
/// \param[in] _offset Offset, relative to this Model, to place _model.

Is the object that you're trying to pick up static?

Asked by nkoenig on 2017-01-13 09:58:07 UTC

Comments

Yes it is Static. I also added a code to set it from the source file if by any chance the model is not static. I used m_litter->SetStatic(true), and verified with m_litter->IsStatic().

I added a link to the full plugin code. I will try to attach an image of the source code also.

Asked by elcymon on 2017-01-13 10:08:13 UTC

Can you post your SDF file(s), and also let us know what version of gazebo you are using?

Asked by nkoenig on 2017-01-13 10:31:14 UTC

Yes. I am doing that now... I am using gazebo7

In the image uploaded, the object is set as not static, but I have tried it with 1 already and the problem still persists.

Asked by elcymon on 2017-01-13 10:51:09 UTC

Hi, am having the same issue - trying to attach a static model to a non static. I have the correct parameters - not sure what is wrong (there are nor errors thrown). In fact, if you use the function correctly with a NON static model, you will get the error "[Err] [Model.cc:1310] AttachStaticModel requires a static model" ....

Asked by Dougie DeRosa on 2019-08-20 16:00:36 UTC