0
$\begingroup$

Rosanswers logo

Is it possible to change the focal length/field of view of the camera used to render the Gazebo GUI? The default focal length looks really short, which has the tragic effect of making my planning scenario look easy to reviewers :( I've noticed there is a camera tag in the world file, but it doesn't seem to be documented anywhere.


Originally posted by Paul Vernaza on ROS Answers with karma: 181 on 2012-01-16

Post score: 2

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

Hello Paul!

Somewhere within the gazebo robot configuration you will find the camera parameters like the following: Changing the hfov will change you the field of view :-)

<sensor:camera name="cam_front_sensor">
  <imageSize>640 480</imageSize>
  <imageFormat>B8G8R8</imageFormat>
  <hfov>90</hfov>
  <nearClip>0.1</nearClip>
  <farClip>100</farClip>
  <updateRate>20.0</updateRate>
  .....
</sensor:camera>

You can compute the focal length with

f = (width/2) / tan( deg2rad(hfov)/2) = (640/2) / tan(deg2rad(90)/2) = 320

The example above will give you a focal length of 320. Don't forget to convert the angle to radiant

Greetings Markus Gazebo camera FOV vs. focal length


Originally posted by Markus Bader with karma: 847 on 2012-01-17

This answer was ACCEPTED on the original site

Post score: 4

$\endgroup$
0
$\begingroup$

Rosanswers logo

Unfortunately, the camera used for rendering the gui does not have an easy way to change its FOV.

Ticketed feature request needs to be released.

Alternatively, you can create a static camera model in the world and set its fov as Markus described, and screen capture the images separately using image_view or rviz.


Originally posted by hsu with karma: 5780 on 2012-01-18

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.