Appendix D. Math Cheat Sheet

Sensors

Raw values to percentage (light sensor):

percentage = 146 - raw value / 7

Raw values to temperatures, in C° (temperature sensor):

C° = (785 - raw value) / 8

Conversion of Celsius to Fahrenheit degrees:

F° = C° x 9 / 5 + 32

Averages

Simple average:

A = (V, +V2+... +Vn)/n

Weighted average:

A = (V1xW,+V2xW2 + .,. + VnxWn) / (W, + W2 + ... + Wn)

Exponential smoothing:

An = (Vn xW, + An-1 x W2) / (W, + W2)

Interpolation

Linear interpolation: Find the value of the dependent variable Y for a given value of the independent variable X, knowing that for X equal to Xa, Y isYa, and for X equal to Xb, Y is Yb.

(Y - Ya) / (Yb - Ya) = (X - Xa) / (Xb - Xa)

Y = (X - Xa) x (Yb - Ya) / (Xb - Xa) + Ya

Equation of the straight line which connects the points (Xa, Ya) and (Xb, Yb):

m = (Yb - Ya) / (Xb - Xa)

b = Ya - m x X a

Y=mxX+b

Gears, Wheels, and Navigation

Output angular velocity of the body of a differential gear Oav, given the input angular velocity of the two axles Iav1 and Iav2:

Oav = (lav, + lav2) / 2

Distance, Time, Speed:

distance = speed x time

speed = distance / time

Circumference C of a wheel, given the diameter D:

C = D x□

□ = 3.1415926...

Increment in rotation sensor count I that corresponds to a turn of the wheel, given R the resolution of the sensor and G the gear ratio between the wheel and the sensor:

l = GxR

R = 16 (for Lego rotation sensors)

Conversion factor F which measures the traveled distance of a wheel for any single increment in the count of a rotation sensor:

F = C / I = (D x □) / (G x R)

Actual traveled distance, given F and the count of the sensor:

T = Count x F

Traveled distance Tc of a differential drive robot’s centerpoint, given the traveled distances TL andTR of its left and right drive wheels:

Tc = (TR + TL)/2

Change of orientation □OR, in radians, of a differential drive robot, given the traveled distances TL andTR of its left and right drive wheels, and the distance B between the wheels:

□OR = (TR-TL)/B

New orientation 0i of a robot after a change in orientation □O from the previous orientation Oi-1:

Oi = Oi-1 + □O

New position of a robot (xi, yi) of a robot after having covered a distance Tc in direction 0i from position (xi-1yi-1):

xi = xi-1 + Tc x cos Oi

yi = yi-1 + Tc x sin Oi

Conversion of radians to degrees:

Degrees = Radians x 180 / □

Required increment in rotation sensor count for a given change of orientation □OR in radians or □OD in degrees:

Count = T / F = (□OR x B / 2) / F = □OR x B / 2F

Count = □OD x π x B / (360 x F)

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.218.45