... | ... | @@ -14,10 +14,10 @@ The report is structured as follows; |
|
|
|
|
|
|
|
|
## Goal
|
|
|
|
|
|
The goal for this exercise is to determine whether the premade variables are precise enough.
|
|
|
|
|
|
## Plan
|
|
|
|
|
|
We intend to do this by following the suggestions described in the assignment for week 10. Hence, use the travel() to make the legocar travel 50 cm and see how it works out in a physical test. To test the Track width, we make the legocar rotate 180 and see if it ends up in the same position as where it started.
|
|
|
|
|
|
## Experiments with pilotSquare:
|
|
|
When testing the pilotSquare[pilotSquare kode fra hjemmesiden] we wanted to see if the legocar would start and stop in the same place. We tested this three times where the start position of the legocar where the same. The variables wheel diameter and track width were not changed and therefore had the values:
|
... | ... | @@ -164,7 +164,94 @@ A simple solution would be to use a sequantial loop if we know the position of t |
|
|
LCD.drawString("Closing",0,0);
|
|
|
}
|
|
|
|
|
|
But what if we do not know of the location of the obstacle and we still want to be able to avoid it and endour route in our predetermined finishing position. To do this, we use the odometryPoseProvider, which attaches itself to the differential pilot as a listener, which means we can get the pose of the legocar by calling getPose(). We then use this to calculate a new route to our destination when we have avoided an obstacle.
|
|
|
|
|
|
------------------An example can be seen in video 3.
|
|
|
|
|
|
Although this helps us eliminate the problem of unknown obstacles, others still exist. For instance if the robot encounters an obstacle close to the finishing position, then it will have trouble navigating around it. Furthermore, the first obstacle the robot reaches triggers the updateRoute(), which cause the robot to take the fastest way to its end position. If it on its way encounters another obstacle, it has no way to drive around it and therefore just continue driving towards it. Finally, this code only knows how to get to the finishing position as fast as possible. If we want it to navigate around obstacles but still through specific positions on a map, then we have to do this in another way.
|
|
|
|
|
|
One way to solve some of these problems is to let the robot locate the distance to obstacles around it or create an array with positions we want it to navigate through before it reaches it’s final destination.
|
|
|
|
|
|
We tried to do this by using the code snippets beneath but without any succes:
|
|
|
|
|
|
the four Pose’s that the Legocar should visit:
|
|
|
|
|
|
public class wayFinder extends Thread
|
|
|
|
|
|
{
|
|
|
…….
|
|
|
public static OdometryPoseProvider opp = new OdometryPoseProvider (pilot);
|
|
|
private ArrayList<Pose> poses = new ArrayList<Pose>();
|
|
|
private Pose currentPose = opp.getPose();
|
|
|
|
|
|
private Point location;
|
|
|
private Pose cp,c1, c2, c3, c4;
|
|
|
|
|
|
|
|
|
public wayFinder()
|
|
|
{
|
|
|
c1 = new Pose(60,60, 0);
|
|
|
c2 = new Pose(0,60, 0);
|
|
|
c3 = new Pose(60,0, 0);
|
|
|
c4 = new Pose(0,0, 0);
|
|
|
|
|
|
poses.add(c1);
|
|
|
poses.add(c2);
|
|
|
poses.add(c3);
|
|
|
poses.add(c4);
|
|
|
}
|
|
|
|
|
|
and here is the code that should make the Legocar able to drive around obstacles but still be able to visit the four locations:
|
|
|
|
|
|
public void go()
|
|
|
{
|
|
|
for (Pose p : poses) {
|
|
|
|
|
|
updateRoute(p);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void updateRoute(Pose p){
|
|
|
Pose currentPose = opp.getPose();
|
|
|
Point endPoint = p.getLocation();
|
|
|
|
|
|
float angleToEnd = currentPose.angleTo(endPoint);
|
|
|
float distanceToEnd = currentPose.distanceTo(endPoint);
|
|
|
|
|
|
|
|
|
pilot.rotate(angleToEnd-currentPose.getHeading());
|
|
|
pilot.travel(distanceToEnd, true);
|
|
|
while ( 20 < d.getDistance()){
|
|
|
|
|
|
LCD.drawInt(d.getDistance(), 2, 2);
|
|
|
LCD.drawInt(dto, 2, 4);
|
|
|
Thread.yield();
|
|
|
|
|
|
if (d.getDistance()< 20 ){
|
|
|
pilot.rotate(90);
|
|
|
updateRoute(p);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
currentPose = opp.getPose();
|
|
|
angleToEnd = currentPose.angleTo(endPoint);
|
|
|
pilot.rotate(-currentPose.getHeading());
|
|
|
}
|
|
|
|
|
|
But if the Legocar meets any obstacles, then it just rotates 90 degrees and stand still. If no obstacles are observed, when the legocar reaches the first location, it also stands still. This would be something that we could make work if we had more time.
|
|
|
## Final Results
|
|
|
|
|
|
In this assignment, we have experimented with the odometry provider and in extension, see how precise we can track the Legocar position.
|
|
|
The first part concerned the accuracy of the position when using the premade variables and if the non-systematic odometry error model, modelled the error correctly. the preliminary tests we conducted showed that it drifted towards the left and also rotated to much. We ended up with a reasonable result that made it possible to track the position of the car with high accuracy. We then used these variables to investigate the non-systematic odometry error model. By conducting mulitple test, we ended up changing the variables to the following:
|
|
|
|
|
|
private float distanceNoiseFactor = 0.3f;
|
|
|
private float angleNoiseFactor = 1;
|
|
|
|
|
|
Which made the pilotMonitor output the error with the accuracy that corresponded to our tests.
|
|
|
|
|
|
The second part of the assignment concerned position tracking while avoiding objects. Our simple solution avoided a known position of an obstacle and ended up in the determined location. A second solution was created based on an ultrasonic sensor to detect an obstacle and avoid it and then continue to a determined location. This also went very well, but the code did not take into consideration if multiple obstacles where detected or if the legocar should be able to follow multiple position.
|
|
|
|
|
|
We tried to create a solution, that could follow multiple position and still be able to avoid obstacles. Although, we did not make it to work according to our intentions.
|
|
|
|
|
|
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
|
|
|
|
... | ... | |