Raúl
Moderador
 Moderador
| Mensajes: 444 |  | Karma: 6
|
Re:ExplorerSimSonar project error - 2007/11/14 14:10
So, I finally found the bug and fix it. I have just published a new version of the services that I have changed. You can now download an updated SimulatedSonar Service [1], and a new ExplorerSimSonar Service [2].
This is the code that I have changed in the SimulatedSonar service:
| Code: |
// Raul - If state cannot be read from file create a default one
if (_state == null)
{
_state = CreateDefaultState();
}
else // Use the state saved in the file, but don't forget to allocate memory for arrays.
{
_state.DistanceMeasurements = new double[SonarArrayLength];
formerDistanceMeasurements = new double[SonarArrayLength];
}
/// <summary>
/// Create default service state
/// </summary>
pxsonar.SonarState CreateDefaultState()
{
pxsonar.SonarState temp_state = new pxsonar.SonarState();
// Allocation for Arcos Sensor readings.
temp_state.DistanceMeasurements = new double[SonarArrayLength];
formerDistanceMeasurements = new double[SonarArrayLength];
temp_state.MaxDistance = 4000;
temp_state.HardwareIdentifier = 0;
temp_state.TimeStamp = DateTime.Now;
// Initialize Sonar readings.
for (int i = 0; i < SonarArrayLength; i++)
{
temp_state.DistanceMeasurements[i] = 0.0;
formerDistanceMeasurements[i] = 0.0;
}
// Raul - P3DX front ring sonar is 180 degress. But lateral transducers are
// Raul - centered at 90 degrees, so I consider: 196 degrees.
// Raul - I considered the aperture of one transducer is 16 degrees.
temp_state.AngularRange = 196; // 180 plus two halfs of lateral transducers.
// Raul - Angle increment for sonar transducer rays.
temp_state.AngularResolution = 1.0; // let's generate one ray per degree.
// Save state in case it doesn't exist.
SaveState(temp_state);
return temp_state;
}
|
[1] http://www.conscious-robots.com/en/robotics-studio/robotics-studio-services/simulated-sonar-service-
10.html
[2] http://www.conscious-robots.com/en/robotics-studio/robotics-studio-services/explorersimsonar-
applic.html
Raúl Arrabales Moreno. conscious-robots.com/raul |