# Revision history [back]

### I get different ray sensor data at each run (How to get exactly the same?)

Hi,

Is there a way to retrieve ray sensor data directly from the physics engine? so that I get exactly the same data at each run. I use Gazebo version 6. I tried the code bellow, but it doesn't work:

sensors::SensorPtr sensor=sensors::SensorManager::Instance()->GetSensor(sensorName);
sensors::RaySensorPtr laser=boost::dynamic_pointer_cast<sensors::RaySensor>(sensor);
physics::MultiRayShapePtr multiRayShape=laser->GetLaserShape();

double min=multiRayShape->GetRange(0);
for(int i=0; i<640; i++){
if(multiRayShape->GetRange(i)<min)
min=multiRayShape->GetRange(i);
}
cout << "min range= "<<min<<endl;


This is the data I get with tow runs of the same simulation: