Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Where is the laserShape in the ray sensor defined?

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?

Where is the laserShape in the ray sensor defined?

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.