Home | Tutorials | Wiki | Issues
Ask Your Question
0

Where is the laserShape in the ray sensor defined?

asked 2018-11-05 06:28:26 -0600

kumpakri gravatar image

updated 2018-11-06 02:43:25 -0600

I have been reading through source code of the ray sensor in order to understand how it works.

The RaySensor object has a physics::MultiRayShapePtr laserShape variable which it loads with a following instruction:

this->dataPtr->laserShape =
    boost::dynamic_pointer_cast<physics::MultiRayShape>(
        this->dataPtr->laserCollision->GetShape());

And it uses this variable to access information about it max angle, range, count of samples (which I don't understand what means) and loads distances to obstacles.

example of instruction to load a distance to obstacle:

 this->LaserShape()->GetRange(j1)

The physics::CollisionPtr laserCollision is obtained by following lines:

  this->dataPtr->laserCollision = physicsEngine->CreateCollision("multiray",
      this->ParentName());

So it seems the physicsEngine->CreateCollision() has some idea about what the ray looks like and provides the information to the sensor class. Is that correct? Where is the shape of the ray defined? And is there any way how to access it and change it?


EDIT

I would like to implement physically precise ultrasonic sensor. An ultrasonic sensor emits rays in 3D space, not just in one plane. The shape of the field is kind of cone, but the range differs for each angle.

here is an example of radiation specification of a ultrasonic sensor image description

I want to achieve this with Gazebo sensor.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-11-05 14:52:35 -0600

nkoenig gravatar image

updated 2018-11-06 10:30:46 -0600

Each physics engine implements a ray shape. For example, here is ODE's ray shape.

You really only need to worry about the main definition of ray shape .

If you are using a RaySensor, then most of the modifications you can do to the ray shape are exposed through SDF. Here is the SDF ray sensor spec.

Can you describe what you're trying to do?

Edit

Thanks for updating your question. Your project sounds like a great idea. Here is some background. A RayShape is a single line that with a start and end point. The primary purpose of a RayShape is to detect collisions. RayShapes are used primarily by CPU-based LiDAR sensors in Gazebo.

The "shape" of a RayShape can only be a straight line, see the RayShape API. A MultiRayShape is basically a collection of RayShapes, see the MultiRayShape API. You could construct a cone multiray shape using MultiRayShape::SetRay.

The MultiRayShape was intended to be used for LiDAR sensors. For exampl, its Init function creates the individual rays based on SDF data.

However, you should be able to use MultiRayShape in your own Sonar Sensor by using MultiRayShape's API.

edit flag offensive delete link more

Comments

@nkoenig Description added to the question.

kumpakri gravatar imagekumpakri ( 2018-11-06 02:43:57 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-11-05 06:28:26 -0600

Seen: 57 times

Last updated: Nov 06