Professional Documents
Culture Documents
This talk:
Motor
Basics
Robot
Open Lab
Robot
Motors- Physics
Motor windings have a fixed resistance (ignoring heating) Voltage differential on motor leads causes current to flow. (Ohms law) Magnetic field proportional to current Torque proportional to magnetic field strength (and thus current) Torque causes rotor to begin rotating.
Which
Motors as Inductors
Another complication: motors windings are inductors Inductors oppose changes in current
They
store energy When current would otherwise change, inductors become voltage sources such that the current remains constant
V=LdI/dt
=0 dI/dt = infinity This makes V really big Makes a big spark so that dt isnt quite 0
Dont unplug a running motor Dont rapidly change the voltage on a motor; slowly increase/decrease it to avoid a current spike
When
accelerating, accelerate in a couple steps: 25% for 30 ms, 50% for 30ms, 75% for 30ms, then 100%. This goes for changing direction and decelerating too! Your wheels are less likely to slip too!
Powering Motors
uP
Motors: H-bridges
Vmotor
Motor
H-bridge allows bidirectional control A & D on: forward C & B on: backwards A & B on or C & D on: horrible! Our H-bridges have direction + enable What would B & D on do?
Motors: PWM
How do we run at fractional power? Consider rapidly toggling H-bridge on & off
40% power?
Scenario:
Motor will run full blast for 12 hours, then stop for 12 hours
of time it takes for rotor to achieve 63.2% of its final velocity after a step input.
of time it takes for current to achieve 63.2% of its final value after a step input with rotor locked in position.
Motor drivers take time to switch. If period is too short, drivers will spend the whole time switching and not conducting => low efficiency.
Mechanical time constant ~ 10 msec Electrical time constant: ~ 1 msec PWM must be faster than mech time constant, or motor will vibrate Faster than electrical time constant ensures PWM waveform is effectively an analog voltage
Why
do we care?
Avoid frequencies < 20KHz due to human hearing! (magnetostriction) Avoid frequencies > driver switching frequency (~100KHz?)
Current Sensing
Tells you how much torque the motor is producing. Not directly related to angular velocity
Dependent
on terrain!
Back EMF
must be zero
Must disconnect power and wait! (a couple electrical time constants) ORC board can measure, but requires great care and special cable.
Tachometer
Add an additional little motor to the output shaft with very low inertia This motor generates a back EMF This voltage proportional to rotational velocity.
Simple Encoders
Attach a disk to the motor shaft and attach a break-beam sensor across the teeth.
time
Output of Encoder
Or, use a reflectivity sensor and a disk with black & white colored wedges. Are we going forwards or backwards?
time
time
Forward
Backward
Servo Motors
Servo motors seek and hold a specific angle automatically! Have integrated gearhead & control electronics Use PWM as interface!
Huh?
About 180 degrees of rotation, to within ~1 degree Pretty good torque, but take it easy on them!
Power dissipation can be bad Plastic gears are wimpy Intermittent duty only
PWM is not used in the same way as normal motors. Servo uses PWM to build an analog voltage that is compared to a potentiometer on the output (feedback). Just send a PWM with a duty cycle proportional to the desired angle! Pulse widths that are too short/long cause servo to shake violently!
Not
Other Actuators
Solenoids Muscle Wire Cheap simple DC motors (5 or 12V) Electromagnetic <something> An actuator + a spring is a different actuator Use mechanical advantages when you can: levers, pulleys, ramps, winches Servos have a fair amount of torque for a motor their size, but can easily be overworked! Design so that actuators expend power only intermittently!
Control Logic
Turn
Go Straight
Follow Wall
Close Claw
Control Strategies
Presents some ability to cope with the unusual But still cant cope with things you havent considered
AI Planner
Might be able to figure a way out of a bind that you hadnt considered. Complicated, sometimes slow. Assigning scores to agree with how you would decide can be really hard.
Control Strategies
Hybrid
Combine
the above
the first minute, run the find a target FSM For the second minute, run the search for and go to a scoring area Release the target For the third minute, try to go home
Philosophy of Control
Know Everything
My current position is (2.6,3.7), Im facing exactly east. Theres a target behind me at (1.5,3.6) and a wall between us. The following series of precise moves will get me there. Robot maintains a lot of state (information about the world)
Very powerful. Very hard. Gee, George. That sure is a pretty target over there. Mmmm, pretty red color. I should go there. (later) Ah, I have a red thing. I feel happy. But Id feel happier if I saw some yellow right about now so Ill spin! Not much state to maintain.
Know Nothing
as much state as you can, but understand the margin of errors in your state and take this into account. Expect to be wrong. Maintain only a little state. Do lots of wandering, but try to remember where youve explored so you maximize the ground youve covered. Gather information about particular places. When you get to one, know how to recognize it. Then figure out what the next few things you should try to do are. As you wander, youll get lost; adapt and simplify your plan based on what goes wrong.
Building Behaviors
Example:
1. 2. 3.
If Im getting farther away from the wall, turn a unit to the right If Im too close to the wall, turn a unit to the left Go forward a bit, then back to step 1.
What if were getting farther away from the wall (a wheel is slipping, for example) faster than we are turning to the right?
Compute some function of error, and use this to determine how sharply (and in what direction) to turn.
Rich
mathematics available to help design Robust in theory, a bit tricky to perfect in practice
Potential for instability => amusement for audience
F(error)
PID control
If youre really far away from the wall, turn sharply. If youre only slightly veering, turn just a bit.
Thats Proportional
If youre rapidly getting farther away from the wall, start turning harder.
Thats Derivative
If, despite your efforts, you keep getting farther away for a long time, start turning harder.
Thats Integral
Turnrate=Cpe + Ci e + Cdde/dt Discrete-time calculus This is actually what a servo motor does to hold a particular angle
Patches come out periodically. Each version is time stamped. E.g., orc010803.tgz. Copy it somewhere useful Untar it (tar xzvf orc010803.tgz) Edit/copy the helloworld example to get started quickly
Largely self explanatory Its worth sitting down and reading through
Getting started
You
must call orc_initialize() before anything else. You must link with liborc.a after your .o files
E.g.: g++ o myprogram main.o liborc.a Use g++, not gcc
ORC Communication
transaction can take >10ms Lost opportunity for computation Consider doing communication asynchronously or heavy computation in separate thread.
LCD commands
API:
orc_lcdHome orc_lcdPrint, orc_lcdGoto
orc_lcdPrintf
Analog Command
API:
orc_analog orc_analogSetResolution orc_analogSetMaxPort orc_currentSense
Digital Commands
API
orc_buttons,
you plug in sensor that outputs a value into a digital out port, you can damage your ORC. Ask a TA if you need this, and always be careful!
Motor Commands
API:
orc_motorPWM orc_motorDir
Motors are indexed [1,4] different than other ports which are [0,x]! Use symbolic directions: MOTOR_FORWARD,
MOTOR_REVERSE, MOTOR_BRAKE
These
may not correspond to forward/backward for your robot Motors have different strengths forward and backward
Servo Commands
API:
orc_servoPWM orc_servoSetProfile orc_servoSeek hitec300profile
Servos should not be seeked out of range for extended periods of time (>2 seconds?) Servos support profiles, allowing you to specify an angle, rather than a pulse width.
Purely
Ultrasound Commands
API:
orc_ultrasoundPing orc_ultrasoundRead
Can only use one ultrasound at a time Must wait for the sonar to echo before reading!
12V Lead Acid Battery, 5 Ah Battery recharges whenever ORC is plugged into AC & battery is connected Recharging battery can use lots of current
Dont
deeply discharge battery. Its bad for it anyway! Disconnect geode if regulator gets hot
That frees up 0.7A for battery charging!
If
regulator still too hot, disconnect battery. Recharge with a bench supply.
Immediately tin (cover with solder) new tips. When soldering, if tip isnt shiny, it needs to be cleaned
Sponge Re-tin
Keep solder on tip when storing to prevent oxidation of tip Never, ever, sharpen the tip!
Tip
it!
Im done talking!
Now get to work! Not sure where to start?
Talk
to your advisor!