Skip to content

Commit 828470c

Browse files
authored
Added move camera to model service (#1823)
Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
1 parent 70c412c commit 828470c

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

tutorials.md.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Ignition @IGN_DESIGNATION_CAP@ library and how to use the library effectively.
4141
* \subpage spherical_coordinates "Spherical coordinates": Working with latitude and longitude
4242
* \subpage python_interfaces Python interfaces
4343
* \subpage headless_rendering "Headless rendering": Access the GPU on a remote machine to produce sensor data without an X server.
44+
* \subpage move_camera_to_model Move camera to model
4445

4546
**Migration from Gazebo classic**
4647

98.4 KB
Loading
104 KB
Loading
2.46 MB
Loading

tutorials/move_camera_to_model.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
\page move_camera_to_model Move Camera to model
2+
3+
This tutorial gives an introduction to Gazebo's service `/gui/move_to/model`. This service will allow to move the camera to a specific model taking into account distance to the model and camera angle.
4+
5+
## How to move the camera to a model
6+
7+
1. Load the **View Angle** plugin. This service is only available when the **View Angle** plugin is loaded.
8+
2. Call the service using the request message type `ignition.msgs.GUICamera` and the response message type `ignition.msgs.Boolean`. The distance to the object is defined as the z coordinate, and the direction of the camera with a quaternion. It's possible to select the projection type.
9+
10+
For example, Let's move the camera to the `box` model looking down from 5 meters away.
11+
12+
```bash
13+
ign service -s /gui/move_to/model --reqtype ignition.msgs.GUICamera --reptype ignition.msgs.Boolean -r 'name: "box", pose: {position: {z:5}, orientation: {x:0, y:0, z: -1, w:0}}, projection_type: "orbit"' --timeout 5000
14+
```
15+
16+
@image html files/move_camera_to_model/box_5.gif
17+
18+
The camera can also be placed far away, for example 20 meters:
19+
20+
```bash
21+
ign service -s /gui/move_to/model --reqtype ignition.msgs.GUICamera --reptype ignition.msgs.Boolean -r 'name: "box", pose: {position: {z:20}, orientation: {x:0, y:0, z: -1, w:0}}, projection_type: "orbit"' --timeout 5000
22+
```
23+
24+
@image html files/move_camera_to_model/box_20.gif
25+
26+
In the following gif you can see the workflow of this service:
27+
28+
@image html files/move_camera_to_model/move_to_model.gif

0 commit comments

Comments
 (0)