Gazebo | Ignition | Community
Ask Your Question
0

Please what is the correct way to use AttachStaticModel function?

asked 2017-01-13 07:16:29 -0500

elcymon gravatar image

updated 2017-01-13 09:50:38 -0500

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

edit retag flag offensive close merge delete

Comments

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

nkoenig gravatar imagenkoenig ( 2017-01-13 10:28:09 -0500 )edit

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

nkoenig gravatar imagenkoenig ( 2017-01-13 10:28:41 -0500 )edit

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

nkoenig gravatar imagenkoenig ( 2017-01-13 10:29:13 -0500 )edit

I set static element to <static>1</static> and it still didn't solve the problem. gazebo -v returns version 7.4.0

elcymon gravatar imageelcymon ( 2017-01-13 11:24:38 -0500 )edit

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.

nkoenig gravatar imagenkoenig ( 2017-01-13 15:36:02 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-01-13 08:58:07 -0500

nkoenig gravatar image

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?

edit flag offensive delete link more

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.

elcymon gravatar imageelcymon ( 2017-01-13 09:08:13 -0500 )edit

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

nkoenig gravatar imagenkoenig ( 2017-01-13 09:31:14 -0500 )edit

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 <static>1</static> already and the problem still persists.

elcymon gravatar imageelcymon ( 2017-01-13 09:51:09 -0500 )edit

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

Dougie DeRosa gravatar imageDougie DeRosa ( 2019-08-20 16:00:36 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-01-13 07:16:29 -0500

Seen: 520 times

Last updated: Jan 13 '17