How to place a camera on top of the robot such that it covers a specific area around the robot?

asked 2020-03-28 16:32:20 -0500

nbro gravatar image

updated 2020-03-28 16:44:58 -0500

I would like to place a camera on top of a robot (in simulation, with Gazebo), such that the covered area by this camera is an MxM grid (and you can assume that M is given in meters). Ideally, I would like to see the grid without the robot (i.e. as if the robot was invisible, but maybe this is not possible not even in simulation), but you can ignore this for now. I assume that the robot is represented by the origin of a certain coordinate system, so it's represented by a point.

I am able to manually place a camera on top of the robot (i.e. a crane camera that points towards the robot and so, when the robot is on the ground, the camera points to the ground, and it covers some area), but I don't know where exactly I should place it, such that the covered area around the robot is an MxM grid around the robot on the ground (so, e.g., if M=8, then I want the crane camera to be placed on top of the robot such that it covers an 8x8 m2 grid around the robot).

I know that cameras have certain parameters, such as the focal length, which may affect what they capture. In my case, the cameras have parameters x, y and z (i.e. the position), roll, pitch and yaw (i.e. orientation), h_fov (which I am not completely sure what it is, but it is related to the focal length, as can been seen from https://answers.ros.org/question/12658/how-to-change-gazebo-gui-focal-lengthfov/), width and height (which I think corresponds to the resolution of the captured images, so I think that images will have 800x800 resolution, i.e. 800x800 pixels), near and far (which I don't know what they are).

However, I don't know how these parameters relate to the size of the area (grid) captured by the camera. Does anyone have an idea of how to easily achieve what I want? Maybe there's an equation that relates the size of the area to certain parameters of the camera, something similar to https://answers.ros.org/question/12658/how-to-change-gazebo-gui-focal-lengthfov/, but I want an equation that relates the actual captured area, so not the width of the captured image, to the parameters of the camera. Certainly, the position of the camera affects the area that it captures, so x, y and z should be considered in the equation. If we ignore the orientation (i.e. roll, pitch and yaw) and assume that the camera is oriented such that it covers a rectangle (or a square) around the robot (and is aligned with the robot), then probably the next parameter that affects the captured area is h_fov. So, I guess that the parameters I will need to mainly change are the position and h_fov, and maybe width and height.

edit retag flag offensive close merge delete