Duration of activity: 5 hours
Group members participating: Daniela, Helene, Lukas
Goals
In this lab session we will start developing the final project, by building the world and the robot car, and start developing software for the robot.
Plan:
- Determine the appearance of the world our robot should navigate in, and build a sample world for testing.
- Determine the internal map representation of the world
- Build a robot car.
- Start writing software for the robot to navigate the world.
Results
Building the world:
We discussed several ways of building the map the robot car should navigate in. Our ideas can be split in two main catagories:
- Avoid walls: A grid with white and black square indicating where the robot can drive.
- Follow a line: A graph consisting of black lines where nodes represent the crossroads and the edges represent the roads (the black lines).
The first idea was to have the world consist of a large white surface with black line indicating the walls. Then the robot car should drive around in the white passageways, and not cross the black walls. The representation of the world would then be a pixel grid, where each cell in the grid represents a ½-1 cm square on the physical map. Each cell of the grid should then be black or white in order to represent walls or passages. Our plan then was to let the robot car use the differential pilot to navigate the world map, using a light sensor to avoid the walls. One clear problem with this approach is that the robot car always must be aware of its location in the grid with some x and y cooordinates. We saw this as a clear challenge since it prevents us from letting the car drive around at random untill it sees a black wall. We discussed different variants of this approach with a smaller (½ cm) or larger grid.
After discussing the above approach we wanted to investigate a completely different approach and decided to think of the world as a graph consisting of nodes and edges. In this representation the physical world would consist of a number of black lines crossing each other. We would then use a PID controller to make the robot car follow the black line. The crossroads should be made in a way that makes the robot discover them (e.i. a distinct color). The robot car should then be able to determine all outgoing roads from the crossroad and build up an internal map using angles to determine in which direction they are leading.
We decided to use the second approach for several reasons. For the first we had a clear idea of how to create a solution using the techniques we have learned throughout the course. Furthermore the map representation of this approach will take up less space than the first approach, which might be a concern because of the restricted space capacity of the NXT. Depending on the resolution and size of the pixel map, it could take up several megabytes of memory.
For the physical world we got a white surface on which we used black tape to make the roads. We started off by making a very small sample map we can use to test the PID controller and other things.
This means that the internal map representation of the world will be a node for each crossroad, and the roads between the crossroads will be the edges between the nodes.
Building the robot car:
Having decided upon the physical and internal reprensentation of the world we went to the task of building the robot car.
From the physical representation of the world we determined that we need two light sensors for doing the PID line follower control and a color sensor to detect the distinct color at the crossroads. Since the the discription of the project and the physical world does not force the car to look in a specific way we determined to build the standard car from the lego instructions with a small modification that lets us attach three sensors at the front of the car. See the following picture of the car:
Software:
PID Controller:
We started by writing the PID controller greatly inspired by the one we made for the "race" competition. Our plan was to follow the Ziegler-Nichols method, where one starts by finding the ultimate proportional gain and the oscillation periode, and uses this information to find the best parameters for the PID controller. Duing our search of finding the ultimate proportional gain we found the car driving quite smooth along the straight line only using the porportional part of the PID controller. In the fist version of our world we have only straight line with no curves. For this reason we decided to only use the proportional part of the PID controller, since it seems to be good enough for our purpose. If we later decide to design a more complex world with curved lines we can extend the controller to a full PID controller.
The following code shows the code for the P(ID) controller:
Detect crossroads:
We decided to mark crossroads with a distinct color, which the robot car can detect with the color sensor. We had to determine the id's of the different colors available in the ColorSensor class. To do this we wrote the following code, which uses the color sensors getColorID method to return the id of the color the sensor is registering. Futhermore the method writes the color and the corresponding color id to the screen, which let us examine how good the color sensor is in dertermining the color.
This code gave the following result for the build in color ids:
After having determined the values of the id's, we used the getColorID method in the ColorSensor class on different colored papers to see if the ColorSensor meassured correct, how accurate it is, and to determine which colored paper would be best.
Our first try was with a light green paper, but the result of the getColorID method was that it was white. Our next go was a yellow paper, where the color sensor measured it to be green. Which let us conclude that the getColorID method might not be very precise or the color of the papers are too light. For our purpose it is enough that the color sensor can distinguish the color from black and white, which it indeed can. Thus, we decided to use the yellow paper to indicate a crossroad.
We were a little concerned whether the colored paper would interfere with the line follower. For this reason we wanted a bright color, that would look like white to the light-sensors. After having decided on the yellow paper we taped it on the map and ran the line follower to see if it would be a problem, but the P(ID) controller worked just fine with the yellow paper in place.
Our next step was making the robot car follow the line using the light sensors and stop when it sees the yellow color with the color sensor. We did this by adding a check to the infinite while loop for the line follower. The check simply sees whether the color sensor have seen yellow - if so it stops the motors and breaks out of the loop otherwise it continues following the line. See the following code:
When running the above code, the robot could detect crossroads, even if we only used a small strip of yellow paper.
Map the crossroad:
When the robot car has detected a crossroad, it should begin to map which roads lead away from it. To do this we want the robot car to turn around its own axis and look for black lines. To be able do do this we need the robot car to have the center of the crossroad precisely between its wheels. Since the color sensor is in the front of the robot car we need it to drive a specific distance forward. To do this we want to use the DifferentialPilot class which we used in Lab Session 9. We decided to use it beacuse the result of Lab Session 9 was that the DifferentialPilot class is a good tool to use when you need to drive a specific distance.
Meassurements needed for the differenetial pilot:
- Wheel diameter: 56 mm (read from the print on the wheel)
- Track distance: 111 mm (see picture)
- Distance bewteen the color sensor and the wheels: ~75 mm (see picture) (this is a very rough meassurement, but for our purpose it is not need to be completely precise).
As a solution to this we want to use the tachocounter instead of the Differential Pilot. We wrote the following code for diving the distance using the tachocounter:
The following video show the result we got using the tachocounter:
Conclusion
In this lab session we have discussed different ways of making the physical world and decided to go with the one using black lines as roads. Futhermore we managed to implement some of the behaviors needed in the robot car: Follow the black line and detect crossroads. We had some problem with using different tools to control the wheels, and our initial solution was to implement some of the Differential Pilots behaviour manual.
Next time our plan is to:
References:
In this lab session we have discussed different ways of making the physical world and decided to go with the one using black lines as roads. Futhermore we managed to implement some of the behaviors needed in the robot car: Follow the black line and detect crossroads. We had some problem with using different tools to control the wheels, and our initial solution was to implement some of the Differential Pilots behaviour manual.
Next time our plan is to:
- Try again to use the Differential Pilot to control the wheels, since it implements alot of the behaoviour we need.
- Make the robot car detect the roads leading away from the crossroad.
- Determine how the car should build the internal representation of the map.
References:
- PID controller: PID controller - Wiki
- Lab Session 9: lab9
- ColorSensor.java: http://www.lejos.org/nxt/nxj/api/lejos/nxt/ColorSensor.html
- DifferentialPilot.java: http://www.lejos.org/nxt/pc/api/lejos/robotics/navigation/DifferentialPilot.html





No comments:
Post a Comment