Home | Tutorials | Wiki | Issues
Ask Your Question
0

Modify model names during simulation

asked 2016-08-18 08:22:33 -0600

winston gravatar image

When I 'insert' a model from the Gazebo GUI, it seems I could not change its model name anymore. Is there any way to change its name after drag it into the simulation world?

edit retag flag offensive close merge delete

Comments

1

Hey winston. I managed to change the name internally using Entity::SetName inside a model plugin. On the other hand, the gzclient doesn't update the name and when i delete one model using gzclient's graphically way of deleting a model, the model disappears but it doesn't disappear from the world's model list ...

wicked88 gravatar imagewicked88 ( 2016-08-20 07:14:50 -0600 )edit

but like.... why? why are you relying on model name, and why do you want it to change?

Peter Mitrano gravatar imagePeter Mitrano ( 2016-09-13 00:06:16 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-08-18 20:14:26 -0600

chapulina gravatar image

updated 2016-08-18 20:18:10 -0600

Unfortunately, I don't think it's a good idea to change a model's name after it's been spawned. There's a lot of internal code which assumes the name stays the same. You can see by the comment on the Entity::SetName function. I can imagine all the topics staying the same and so on...

As a side note, every model has a unique id, but that's more meant to be a way to lookup faster (comparing ints instead of strings), than a way to keep track of a model if its name changes.

edit flag offensive delete link more

Comments

1

Sorry I cant really understand that behavior. When the API gives me the option to change the name of a model, then it should have influence on all other aspects. To restart the GzClient is really unsatisfying! I also wanted to change the model name due to some custom algorithms in the load method, so the numbering is for me important. Do I really have to adjust my algorithm because Im not able to change the name that its indicating the model instance number?

TwoBid gravatar imageTwoBid ( 2016-09-05 03:13:31 -0600 )edit

I agree with you. I think the API call shouldn't be there if it doesn't behave properly.

chapulina gravatar imagechapulina ( 2016-09-13 11:21:39 -0600 )edit

I think it is good if Gazebo provides a built-in command line tool that enables use to spawn a model with custom name, pose, orientation or etc. Then I don't have to change its name, pose, etc. after I drag it into the world.

winston gravatar imagewinston ( 2016-11-11 21:25:04 -0600 )edit
1

The `gz model` tool should do it, try `gz model -f ~/.gazebo/models/beer/model.sdf -x 1 -y 2 -z 3 -R 0.1 -P -0.3 -m my_beer` for example

chapulina gravatar imagechapulina ( 2016-11-12 10:20:39 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-08-18 08:22:33 -0600

Seen: 180 times

Last updated: Sep 05 '16