User Tools

Site Tools


marvin:lab2

This is an old revision of the document!


LAB2

Delopgave1

lab2-1.jpg lab2-2.jpg

compile and download SonicSensorTest.java, a simple sensor test program. Place the car in front of different objects at different distances and compare the distance with the readings from the sensor.

Download gav ingen problemer, vores modul genkendt som Marwin :-) Med hjælp fra Gustav (praktikant fra 9.klasse) får vi hurtigt monteret transduceren.

The method getDistance returns 255 if there is no echo, hence no object, and otherwise a number less than 255 which is the distance in cm. Try to use the sensor with an object at a distance of up to 254 cm, can the sensor measure such a distance and under what conditions is it possible ?

Test af funktionen getDistanceTest() og ultrasonic sensoren:

målepunkter [cm]: (præcision lineal) Udlæsning Display [cm]
30 30
60 60
90 90
120 122
150 150
180 180
210 210
240 255 (Max ca. 230)

Betingelserne er, at hvis der skal måles 230cm, skal der være frit udsyn i en ca. 30 graders vinkel (slag på tasken).

Delopgave 2

The test program was compiled and uploaded with leJOS NXJ version alfa_03 as indicated in the comment to the program. Because of a known limitation of alfa_03 there is a 300 msec sample interval between readings of the distance. This limitation is no longer in the README list so try different values of the sample interval e.g. very small values. What is the time limit for the measurement - remember the speed of sound is 340.29 m/sec ? Does this limit usage of the sensor ?

Med 20ms sampling kan lyden nå at bevæge sig 6,8m inkl. ekko, hvilket vil sige 3,4m effektivt. Der er ikke taget højde for forsinkelse gennem A/D konverter I2C kommunikation. Blot konstateres, at 20ms sampling ikke er for hurtig i forhold til Max distancen. Som udgangspunkt er samplingstiden sat til 300ms.

Delopgave 3

Describe the behaviour of the car controlled by the program and try to change the different constants of the program.

Marwin kører med en hastighed proportionel med afstanden til en fastsat grænse, dvs den bremser gradvist ned efterhånden som den nærmer sig sin grænseværdi. Når gain-variablen øges øges accelerationen/deaccelerationen, idet man får et større %OS (procentvis overshoot), og man observerer kraftigere oscillation omkring grænseværdien. Der observeres desuden hjulspænd - batteriforbruget lider!

The power to the car motors is the controlled variable and the distance is the measured variable. What kind of control is it ?

P controller, Proportional Gain i feedback loop. Her er fasemarginen afhængig af gainet, hvilket vil kunne afhjælpes med Lead/Lag controllere (PID)

Delopgave 4

Wall Follower Philippe Hurbain has build and programmed a wall follower based on the LEGO Mindstorms RCX and a home build distance sensor. He used NQC (not quite c) to program the controller for the wall follower. Try to use his program and sensor placement to make the LEGO 9797 car follow a wall. Compare the NQC control algorithm with the different suggestions on page 179, 5.1.3 exercises, [1].

Første idé er at genbruge walltracker og modificere koden, sådan at den drejer henholdsvis højre/venstre istedet for bagud/fremad. Den første test viser, at motorerne ikke kører lige hurtigt, så der besluttes at korrigere på venstre motor.

Mangler at bliver færdigskrevet….

marvin/lab2.1221809084.txt.gz · Last modified: 2008/09/19 09:24 by deva