Gazebo | Ignition | Community
Ask Your Question

Simulated raytrace in Gazebo

asked 2017-07-20 13:26:02 -0500

JoshMarino gravatar image

updated 2017-07-22 21:38:01 -0500


I have an application where I have a camera attached to the end of a 5-DOF robot arm (X, Y, Z, yaw, pitch). The robot arm is moving the camera around a fixed object (0,0,0) for inspection purposes. Given the position and orientation of the camera, is it possible to detect where on the object the camera is seeing? For example, I would like to know whether the axis of the camera is intersecting the object, and if so, determine the exact coordinates of the object the camera axis is intersecting.

Given the known camera axis (position/orientation), is it possible to extend a line along the +x-axis and see where it hits the fixed object (if it all)?

I should be able to calculate positions along the +x-axis moving outwards from the camera frame. However, I do not know how to check if these points are contained inside of the fixed object of interest. Would also be nice if something already existed for this, or at least something I can use to help.


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-07-26 16:47:33 -0500

iche033 gravatar image

The gazebo Scene class has a FirstContact function that probably helps you achieve what you want. If you want to use the camera's optical axis, set the mousePos to (0, 0). The last arg gives the intersection point

edit flag offensive delete link more

answered 2017-07-26 10:43:23 -0500

chapulina gravatar image

You could take a look at a couple of things:

  • Logical camera, which gives you the exact coordinates of every model contained within its frustum

  • RayShape::GetIntersection, which you could use to implement your own plugin that returns the name and position of the first model that intersects a line coming out of the camera.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2017-07-20 13:26:02 -0500

Seen: 514 times

Last updated: Jul 26 '17