ENGR 4503 Robotics & Unmanned Systems Midterm Notes
Python | |
Variables can be used without type declaration. | Python manages memory automatically. |
It is faster to code and debug in Python than in C (Easier to handle numerical data, string and “list”.) | Python and C form a good combo for solving engineering problems! |
Better choice for high-level tasks (complicated calculations or image processing, etc.) | However, slower, and may not handle low-level comms w/ sensors and controllers |
Coding in Python | |
Text editor | |
“.py” files | |
Python yourcode.py | Python executes the code line by line, same as MatLab not C! |
/
Python Variables | Example: |
A list in Python can be an array of numbers. | anInt=10 aFloat=10.0 aFloat=float(10) aString1='hello' aString2="hello's" aString3=aString1+aString2 |
What does this code do? array3=array1+array2 In the line array3=array1+array2, the operation combines two lists (array1 and array2) to a new list (array3). | array1=[1,2,3] array2=[4,5,6] array3=array1+array2 print(array3) |
What does this code do? for x in mylist: print(x) This is a for loop. The part of the code inside the loop is marked with “:” and indentation. Will return (1, 2, 3, 1, 2, 3, …). | mylist = [] mylist.append(1) mylist.append(2) mylist.append(3) print(mylist[0]) print(mylist[1]) print(mylist[2]) for x in mylist: print(x) |
Operations in Python | |
Operations on numbers | |
Operations on lists and strings | +: combine , *: repeat |
Dictionaries | Like an array but uses “keys” instead of index Stores data structures like phonebooks Messages/commands followed by arguments |
Print Format | Example: |
“print” will print data in the default format. No need to specify anything else. %’s can be used for numerical data and string |
|
Conditions in Python | |
== | equals, compares two strings |
=! | not equals |
>, < | greater than, less than |
>=, <= | greater than equal to, less than equal to |
“in” | check if element is in a container (string or list) (Ex. if ‘s’ in “show”: print (“yes”) |
“is” | check if both variables are the same |
“id()” | returns identity of an object; if both have same ID, “is” returns true |
Conditions cont. | Example: | Results: |
is / ID | x = [1,2,3] y = [1,2,3] z = x print(id(x)) print(id(z)) print(id(y)) print(x is z) print(x is y) | |
if | if statement1: do something elif statement2: do something else: do something | |
for loop | primes = [2, 3, 5, 7] for prime in primes: print(prime) | # Prints out the numbers 0,1,2,3,4 |
for loop | primes = [2, 3, 5, 7] for x in range(5): print(x) | # Prints out 3,4,5 |
for loop | primes = [2, 3, 5, 7] for x in range(3, 6): print(x) | # Prints out 3,5,7 |
for loop | words = ['cat', 'window', 'defenestrate’] for w in words: print(w, len(w)) | # Prints out window |
Procedural Programming (PP) *inline programming* | Write down steps and let computer execute them with procedures (or functions) Efficient for simple tasks |
Functional Programming (FP) | Steps are organized in functions Functions avoid memory (states) and mutable data; different from PP Such functions are software pieces that can be easily reused |
Object Oriented Programming (OOP) | Organized logic in methods of objects Organized data in properties of objects Not always best for simple tasks! |
PeeDee is lost on the ocean. He has a map with the locations in a local East-North-Up system of three foghorns. 1: [1000, 0, 0] m, scheduled to sound at 12:00:00 am. 2: [2700, 0, 0] m, scheduled to sound at 12:00:10 am. 3: [2020, -680, 0] m, scheduled to sound at 12:00:20 am. His watch may not be accurate. According to his watch, he heard horns at 12:01:13 am, 12:01:22 am and 12:01:32 am. | ||
| (sqrt((x-1000)2+y2)==340*(13-b), sqrt((x-2700)2+y2)==340*(12-b), sqrt((x-2020)2+ (y+680)2)==340*(12-b)) |
GPS | How does a GPS user determine its position? |
2-D Positioning (using single range measurements) | ![]() |
2-D Ranging (using two measurements) | ![]() |
2-D Ranging (using three measurements) | ![]() |
Without clock error & With clock error | R = (v_sound)*(Δt) R = range v_sound = velocity of sound Δt = transmit/receive time difference R’ = v_sound*(Δt+ $t) R’ = range w/ error (psuedo - range) |
The GPS Equation | ![]() |
Trilateration | Uses pseudorange (PR) measurements from at least four satellites to solve 3-D position and time. ![]() |
GPS Position/Time | ![]() |
Three segments of GPS systems: | Space: satellites themselves Control: monitors/controls satellites and generates ephemeris data User: anything that receives the GPS signal |
Airborne Laser Scanners | How does ALS differ from TLS (terrestrial)? | ALS Limitations? | Example: | ALS Error Sources? |
TLS: on the ground Drone: 100m or less Plane: up to several thousand m | Geometry - scans terrain top down Sensor quality - compact units may have lower res./accuracy Dynamic platform - need to know position/orientation; accurate timing | Point cloud is “seen” by the laser scanner. Does not directly come w/ 3D coordinates in the world frame. Ranging errors. | ![]() | Ranging error - random (can be averaged out) Position error - systematic (possible biases to all measurements; can be calibrated/corrected) Orientation error - systematic (possible biases to all measurements; can be calibrated/corrected) Timing error - systematic (possible biases to all measurements; can be calibrated/corrected) *Errors can be represented w/ an ellipsoid* |
GPS-INS | |
Inertial Navigation System | Measures acceleration and rotation (includes gravity/earth rotation; often comped with a barometer and/or magnetometer) |
Embedded GPS Inertial System | Accurate position velocity attitude and timing |
LIDAR (light detection & ranging) | high-precision mapping, environmental monitoring, and autonomous vehicles |
LADAR (radio detection & ranging) | primarily serves military purposes, such as surveillance and target identification *major difference b/w the wavelength of signal and divergence of signal beam* |






