Download presentation
Presentation is loading. Please wait.
Published byGriselda Linda Hamilton Modified over 9 years ago
1
Building robots Spring 20031 Building Braitenberg Vehicles From Abstraction to Realization
2
Building Robots Spring 20032 Vehicles Review vehicle 2A: aggresive crossed excitatory connections vehicle 2B: coward straight excitatory connections vehicle 3A: love straight inhibitory connections
3
Building Robots Spring 20033 Vehicle Design ‘differential steering’ contrast to steering wheel balance other options: tanks, bicycles, etc
4
Building Robots Spring 20034 Drive System ratios and reduction—why? gears: pro: efficient, accurate, strong con: need precise alignment, backlash pulleys: pro: simplicity, flexibility con: slippage, poor durability motor control: speed, direction, braking note: Connector direction matters.
5
Building Robots Spring 20035 Example Vehicle Design Differentially-steered vehicle with pulley drive See handout for construction details
6
Building Robots Spring 20036 MotorTest.java import josx.platform.rcx.*; class MotorTest { static final int STOP = 0; static final int RUN = 1; static final int FLOAT = 2; static int mode = STOP; static int power = 0; public static void main(String [] args) { setupButtonListeners(); while (true) { if (mode == RUN) { Motor.A.setPower( power ); // power in range [0, 7]. incremented with each press of View button. Motor.A.forward(); } else if (mode == STOP) { Motor.A.stop(); } else if (mode == FLOAT) { Motor.A.flt(); }... (button listener code not shown)
7
Building Robots Spring 20037 Mindstorms Light Sensor why the LED? sensor mode: raw vs. percent I/0 graph, compared to mammal eyes spectral response sunlight vs incandescent vs fluorescent
8
Building Robots Spring 20038 LightTest.java import josx.platform.rcx.*; class LightTest implements SensorConstants { public static void main(String [] args) throws InterruptedException { Sensor.S1.setTypeAndMode (SENSOR_TYPE_LIGHT, SENSOR_MODE_PCT); Sensor.S1.activate(); while (true) { int lightReading; if (Button.VIEW.isPressed()) { lightReading = Sensor.S1.readRawValue(); } else { lightReading = Sensor.S1.readValue(); } LCD.showNumber( lightReading ); }
9
Building Robots Spring 20039 Complete Example: “Aggressive.java” import josx.platform.rcx.*; class aggressive implements SensorConstants { public static void main(String [] args) { int minBrightness = 100; final int gain = 12; Sensor.S1.setTypeAndMode (SENSOR_TYPE_LIGHT, SENSOR_MODE_PCT); Sensor.S1.activate(); Sensor.S3.setTypeAndMode (SENSOR_TYPE_LIGHT, SENSOR_MODE_PCT); Sensor.S3.activate(); for (int i = 0; i < 100; i++) { if (Sensor.S1.readValue() < minBrightness) { minBrightness = Sensor.S1.readValue(); } else if (Sensor.S3.readValue() < minBrightness) { minBrightness = Sensor.S3.readValue(); } Thread.sleep(20); } Motor.A.forward(); Motor.C.forward(); while (true) { int motorASpeed = (Sensor.S3.readValue() - minBrightness) / gain; int motorCSpeed = (Sensor.S1.readValue() - minBrightness) / gain; setMotorSpeed(Motor.A, motorASpeed); setMotorSpeed(Motor.C, motorCSpeed); }
10
Building Robots Spring 200310 Aggressive.java (continued) protected static void setMotorSpeed(Motor m, int motorSpeed) { if (motorSpeed < 1) { m.flt();// important LCD.showNumber(-1); } else { if (motorSpeed > 7) { motorSpeed = 7; } m.forward(); m.setPower(motorSpeed); LCD.showNumber(motorSpeed); }
11
Building Robots Spring 200311 Observations Closed loop control; lessens importance of mechanical imperfections (e.g. pulley slip). The map is not the territory. Make your own—robots and observations!
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.