Raúl
Moderator
 Moderator
| Posts: 434 |  | Karma: 6
|
Re:explorer sim sonar and localization using landmark - 2008/08/25 10:10
Yes, there is a trick to get the current position of the robot using the simulator and the DifferentialDriveTT service (from Trevor Taylor) that I am using. But this is nothing to do with SLAM or landmarking, it is a trick wich will never work in real world.
The trick is to ask the DifferentialDrive service for its possition. It does work in the simulator because this service is maintaing the position of the wheel entities in the simulated world. So you could do something like this:
| Code: | _state.X = (update.Body.LeftWheel.MotorState.Pose.Position.X +
update.Body.RightWheel.MotorState.Pose.Position.X) / 2;
_state.Y = (update.Body.LeftWheel.MotorState.Pose.Position.Z +
update.Body.RightWheel.MotorState.Pose.Position.Z) / 2;
_state.Theta = (float) (Math.Acos(w)*2*180/Math.PI);
if (update.Body.LeftWheel.MotorState.Pose.Orientation.Y < 0)
_state.Theta = -_state.Theta;
|
This is done in the ExplorerSimSonar.cs file in DriveStateUpdate method...
But the problem is that this is unreal, and cannot be done in the real world. It is only a trick for the simulator. Additionally, you have to take care of updating the wheel entities positions so you can get the latest position state.
About implementing SLAM with the simulator, you have to take into account that MSRS simulator is supposed to has perfect odometry. So in principle, you could infer your position by calculating the distance in terms of time and velocity. My experience tell me that MSRS is not 100% perfect odometry, as the simulator calculate physics and sometimes the wheels slip, especially when you hit an obstacle, or when changing speed or heading. So this makes the environment somewhat valid for testing SLAM algortihms.
You could try to test any SLAM algorithm based on Kalman filters or something like that. Actually, I think there was a grid slam implementation for MSRS.. But I have to check it..
Cheers,
Raúl.
Raúl Arrabales Moreno. conscious-robots.com/raul |