disclaimer!!!! i am a n00b! please do note that everything that i have worked on is subject to...

22

Upload: gertrude-black

Post on 28-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project
Page 2: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

DISCLAIMER!!!!

I AM A N00B!Please do note that everything that I have

worked on is subject to questioning.. in fact.. I suggest it.

This entire project was a learning experience for me. Ive worked very hard and built this all from

scratch.

Many of the things Ive learned I want to share with you, and any help or suggestion is good :)

Page 3: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

What is a Segwii?

Seg WiiSeg comes from

Segway, which is a product.

This is the self-balancing part (where the real

coding happens).

The Wiimote, aka one of the most

hacked products out there.

A bluetooth based controller.

Libraries out there to interface (almost all

open source).

Page 4: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

Lets talk about the Seg part

How do you balance? Lets start simple.

0

X-X

Motor pushes the other way based on the

angle.

Angle measurement based off the

accelerometer reading.

Torque = angle*gain

Gain is a constant based on your

setup.

Page 5: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

Mach 1 (Ghetto bot)

MEMS Accelerometer

H-BridgeWiring (AVR ATMega128)

Cheap Lego

Motors

Total Cost: $130 (could be as low as $80)

Page 6: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

But there is a problem!!

0

X-X

How do you account for the angular speed

you are going at a given angle?

Gyroscopic sensor,This will measure

Omega, which is angular velocity.

Feed this into your torque!

What about how fast you are going at that angle?

±X /s ±X /s

±X /s = W (Omega)

Torque = angle*gain + angular velocity*gain

Page 7: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

Mach 2 (Now were getting somewhere)

Wiring (AVR ATMega128)

Accelerometer

GyroscopicSensor

H-Bridge

Status Lights(Not

necessary but helpful)

Cheap Lego Motors Total Cost: $230 (could be as low as

$180)

Page 8: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

More problems!

The readings from the

accelerometer were very noisy!

This caused the bot to jitter like

mad!

Noise and constant assistance needed!Solution: Filter the angle

reading!

But how? and without putting to much load on

the processor?

Page 9: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

Complementary Filter

With many possible filters, this is the most efficient way to filter the angle without having to much processing load.

Accelerometer

(Angle)

Gyroscope(Angular Velocity)

Accelerometer

(Angle)

Gyroscope(Angular Velocity)

Low Pass Filter

High Pass Filter

Page 10: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

Complementary Filter

Angle = 90%*(Angle + Angular Velocity*dt) + 10%*(Non Filtered Angle)

Clean Angle

High Pass

Constant

Previous Clean Angle

Angular Velocity Reading

from Gyro

Time Rate of

sampling

Low Pass Constant

Raw Angle Reading from Acceleromete

r

This integration converts angular velocity to angle.

The angle noise is very accurate, but it can drift after a

while.

Gives you a general area of where the angle is.

Low PassHigh Pass

Page 11: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

One problem left!

Assistance is constantly needed...

The bot may keep itself up for a few seconds but will keep over shooting the 0° mark.

Solution?

PID

Proportional Integral Derivative

Page 12: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

PID

Proportional Integral Derivative

P I DProportion

alIntegral Derivative

Proportional changes torque

based on present information,

Directly based on angle error.

Integral changes torque based on past information,

and what has occurred

Derivative changes torque based on future trajectory.

Pterm = angle_error * Pgain;

Everything is error!

How off it is from 0°

Iterm = (Iterm + (angle_error * Igain))

* .9999;

Dterm = (angle_error - old_angle_error) *

Dgain;

Page 13: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

0

X-X

±X /s = W (Omega)

Torque = Pterm + Dterm + Iterm + angular velocity*gain

Pterm = angle_error * Pgain;

Iterm = (Iterm + (angle_error * Igain))

* .9999;Dterm = (angle_error -

old_angle_error) * Dgain;

One more thing..

AngVelTerm = angvelocity*gain;

±X /s ±X /s

Page 14: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

Mach 3 (Balance at last!)

Total cost: $300Could be as low as:

$250

So now that its balancing!

Lets hook it up to a Wiimote!

Page 15: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

Wiimote

Using the Wiring or Arduino we can interface easily with Processing

Why? because they are married!

Using the wrj4P5 and WiiRemoteJ Libraries, communication can be established with the wiimote via bluetooth.

Wiimote gives computer an angle Computer scales and sends value to segwii via USB

Page 16: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

Things I hated about this project!

Don’t get me wrong, I loved this project.. I just wish a few things were different!

1) The middle man

I say.. cut the middle man, give the Segwii bluetooth, and write drivers.

Page 17: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

Things I hated about this project!

2) Segwii Hardware:- Gyro and Accelerometer need a temperature output- Encoders for the motor, for precise position control

- Better motors, with a properly tuned gearbox- Better batteries

3) The drivers I wrote:- Refining the drivers I wrote for the IMU 5DOF (Gyro and Acc)

- More precision!- Compensate for temperature, and add self calibration

4) The Wii part:- Based on the demo, you can see that the controls are quite

crude, and lot of refining is needed.

All of these need time and money...

Page 18: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

Computer Requirements

Segwii GUI is currently available for Mac and Linux.

Hardware code IDE works on any OS.

Page 19: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

I am Wii, and so can you!

All the code and hardware is now open source!

Help out, donate, or just learn!

Code and Schematics, and additional information and support can be found here:

http://www.segwii.com

Questions? Email me: [email protected]

Page 20: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

DEFCON

Any ideas?

- Annoyance bot?- Goon Robot?- Robot army?

- Robot Server/Control me?

Page 21: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project
Page 22: DISCLAIMER!!!! I AM A N00B! Please do note that everything that I have worked on is subject to questioning.. in fact.. I suggest it. This entire project

The End