Gazebo | Ignition | Community
Ask Your Question

How to make the camera track a moving robot

asked 2015-04-12 12:05:02 -0500

Cerin gravatar image

When the robot moves, how do you make the camera track it, so the robot doesn't move out of the viewing pane?

I'm assuming I'll need to write a world plugin, but it's unclear how to programmatically access the camera. I see there's API documentation, but it's not searchable, so I'm not sure where to begin looking.

Also, is there a maximum limit to where the robot can move in the simulated world? When placing models, I noticed there appears to be min/max limits on the ground where models can be placed, implying the world is not infinite and that a moving robot would eventually run into some sort of invisible wall.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-12 14:09:16 -0500

chapulina gravatar image

If you don't want to go through the trouble of writing a plugin, you can right-click the model and choose Follow and the camera will follow the robot. Press ESC to leave follow mode.

Programmatically, I think it should be possible to emit gui::Events::follow(<modelName>). And gui::Events::follow("") to stop following.

The ground plane seems to end where the gray square ends, but if you try to place models beyond that point you'll see it's possible. You can also edit a model's pose on the left panel, I guess the only limitation should be numeric.

edit flag offensive delete link more


When following, is there any way to control the zoom? Follow is exactly what I need, but it zooms to far out, my model is barely visible, and when I try and manually zoom it re-zooms out.

Cerin gravatar imageCerin ( 2015-04-12 19:44:42 -0500 )edit
chapulina gravatar imagechapulina ( 2015-04-12 20:26:50 -0500 )edit

Thank you for your help.

Fenix0817 gravatar imageFenix0817 ( 2023-06-23 08:54:02 -0500 )edit

Question Tools

1 follower


Asked: 2015-04-12 12:05:02 -0500

Seen: 8,226 times

Last updated: Apr 12 '15