EECE 5554
Robotics Sensing and Navigation
Lab 4: Dead Reckoning with
an IMU, GPS, and LiDAR
Dr. Xian Li
Assistant Teaching Professor
Department of Electrical and Computer Engineering
Today
- What Lab 4 asks, and why
- The car and its two computers
- Before the drive: the launch file and the dry run
- In the car: roles, recordings, and the car files
- The analysis, including the new parts
- What to submit
How long can you dead-reckon?
In a tunnel, under a bridge, or between tall buildings, GNSS can vanish for minutes. A car then has to estimate its own motion. Each sensor in Lab 4 is good at one part of that, and fails in its own way.
RTK GNSS
Absolute position, to a few centimeters, once a second.- Drops to float or standalone near buildings and trees
- Gone in a tunnel
IMU
Rotation, smoothly, 40 to 100 times a second.- Heading drifts slowly
- Velocity from the accelerometer drifts fast: every error is integrated twice
LiDAR
How the car moved between two scans, from the walls, trees, and poles it sees.- Fails where there is nothing to match, or the scene moves
- Its own turns drift slowly
The Mustang Mach-E
| Sensor | Rate |
|---|---|
| Ouster OS1-64 LiDAR | 10 scans/s, 65,536 points each |
| Ouster's built-in IMU | 100 Hz |
| The car's own IMU | 100 Hz |
| The car's own GPS | 1 Hz, with its time |
| Wheel speeds, steering | 50 to 100 Hz |
| Your RTK and VN-100 | 1 Hz and 40 Hz, on your laptop |
The car PC runs ROS 2 Humble. The camera and radar are recorded too, but Lab 4 does not use them.
Two computers, never connected
Five parts
| Part | What you do | Where |
|---|---|---|
| 1. One launch file | nav_bringup starts your Lab 2 RTK driver and your Lab 3 VN-100 driver together | At home, against the emulators |
| 2. The dry run | The whole data collection on foot: walk_circle and walk_square, until the self-check says READY TO DRIVE: YES | A park, with your team |
| 3. The drive | Calibration circles and a 2 to 3 km loop: car_circles and car_drive, on both computers | The Mach-E, near Kerry Park |
| 4. The tools | Reading your bags and the two car files | The notebook |
| 5. The analysis | Heading, speed, and path from the IMU, then two clocks, LiDAR odometry, and an RTK outage | The notebook |
Part 1: one launch file
"""Start the Lab 2 RTK driver and the Lab 3 VN-100 driver together."""
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration
def generate_launch_description():
gps_launch = os.path.join(get_package_share_directory('gps_driver'),
'launch', 'rtk_driver.launch.py')
return LaunchDescription([
DeclareLaunchArgument('gps_port', default_value='/dev/ttyACM0'),
IncludeLaunchDescription(
PythonLaunchDescriptionSource(gps_launch),
launch_arguments={'port': LaunchConfiguration('gps_port')}.items()),
# TODO: declare imu_port, and include vn_driver's launch file
])- The GPS half is in the worked example. The VN-100 half is yours.
- Each include passes its own port, so the two drivers can never end up on the same device.
- The self-check runs both emulators, twice, with the ports swapped.
/dev/serial/by-id/ names. They never change.Part 2: the dry run on foot
walk_circle
Four slow circles around a landmark, about 10 m across, with the VN-100 held level. Practice for the calibration circles in the car.walk_square
A 25 m square, with a 20 s still start. Practice for the drive, and a short, simple bag for testing your analysis.- Record with your laptop's WiFi off, as in the car:
nmcli radio wifi off - Run
check_bagon every bag before you leave the park. A bad bag is cheap to redo there - Commit both bags, then run the self-check. It must say READY TO DRIVE: YES before your team gets the car
Part 3: The Drive
What happens in the car, step by step
Roles in the car
Driver
The instructor. Drives, and nothing else: never looks at a screen, and nobody asks them to.Car PC operator
Types the car's commands on the car PC when the data lead calls for them. At the end, makes and copies the car files.Data lead
Runs the laptop, calls the start and stop of each recording, and watches both topic rates and the fix quality.Sensor lead
Mounts and checks the VN-100, the antenna, and the receiver, and owns the cables.Navigator
Calls the route, keeps the hotspot on, and writes every stop and anything unusual, with the time.With three people
The sensor lead also navigates. Pick roles before you leave, and write them in the field handout.What to bring
- Laptop, fully charged, with READY TO DRIVE: YES
- A spare laptop with tested drivers
- VN-100 and its USB cable
- RTK kit: receiver, GNSS antenna, WiFi antenna, CAT-6 loop, USB-C cable
- Phone with the hotspot from Lab 2, charged
- A drive formatted exFAT for your car files: an SSD or a USB stick
- Tape measure, strong tape or straps, a level app
- The field handout, printed, and a pen
EECE5554_Lab4_field_handout.pdf. The car has no internet, and the handout has every step, a checklist, troubleshooting, and a page for your notes.Safety first
- Everyone wears a seat belt. We follow every traffic law, and yield to pedestrians, cyclists, and the streetcar
- Nobody touches a sensor, cable, or mount while the car moves. If something comes loose, we stop somewhere legal and safe first
- Secure everything before the car moves: in a hard stop, a loose IMU or laptop is a projectile
- Nothing on the dashboard, near an airbag, near the pedals, or in the driver's view
- Anyone can stop the drive at any time, and nobody argues. A data set can be recollected
Step 10: mount, and measure
- VN-100: on a flat, rigid surface near the centerline, level, x axis straight ahead, taped down, away from speakers and phones
- Antenna: on the roof mount, cable over a rear door seal, never through a window, taped to the roof
- Receiver: on the floor or rear seat, WiFi antenna on, CAT-6 loop in, USB plugs taped
The terminals you need
| Where | Terminal | Start it with | Used for |
|---|---|---|---|
| Laptop | 1: drivers | source ~/EECE5554/Lab4/ros2_ws/install/setup.bash | Your nav.launch.py, running the whole trip |
| Laptop | 2: recording | the same line, then cd ~/EECE5554/Lab4/data | Your ros2 bag record |
| Laptop | 3: watching | the same line | ros2 topic hz /imu and /gps |
| Car PC | the car | Staff opens it | Only ~/lab4/lab4_check.sh and ~/lab4/lab4_record.sh |
Step 11: before the car moves
- Laptop WiFi off:
nmcli radio wifi off. The receiver keeps its corrections through the hotspot - Drivers running with both by-id ports:
/imunear 40 Hz,/gpsnear 1 Hz - A real fix:
fix_quality4 or 5, outside the garage, after a few minutes - Car still:
/imulinear acceleration z near -9.8, because the VN-100's z axis points down - On the car PC:
~/lab4/lab4_check.shends with CAR READY: YES - The checklist in the field handout
~/lab4/lab4_check.sh /front_lidar/points 10.0 OK /front_lidar/imu 100.1 OK /vehicle/wheel_speeds 100.0 OK ... Free disk space: 180 GB (OK) CAR READY: YES
One recording, two computers
Step 12: the calibration circles
- Where: a flat, open lot, near the route or not, away from parked cars, light poles, and buildings. Not a slope: the vertical field would leak into the fit
- Size: 12 to 20 m across, at walking pace. Tighter is fine; the Mach-E's tightest is about 12 m
- How: 20 s still, 5 full 360 degree circles, then 10 s still
- Afterward: nothing in the car moves until the drive is done
~/lab4/lab4_record.sh start team3 car_circles ros2 bag record -o car_circles /gps /imu # 20 s still, 5 circles, 10 s still, then: # laptop: Ctrl+C, and "Laptop stopped." ~/lab4/lab4_record.sh stop
Step 13: the drive
- The route: a 2 to 3 km loop on the flatter streets on top of Queen Anne Hill, near Kerry Park, starting and ending at the same spot
- At least 10 turns, a few stops, and one hill on purpose. No tunnels, freeways, or garages
- 20 s still at the start, for the accelerometer bias, and 20 s still at the end
- The navigator logs every stop and anything unusual, with the time
~/lab4/lab4_record.sh start team3 car_drive ros2 bag record -o car_drive /gps /imu ~/lab4/lab4_record.sh status # watch it grow # at the end: laptop Ctrl+C, then ~/lab4/lab4_record.sh stop
car_drive_2, on both computers.Step 14: before you hand the car back
~/lab4/lab4_record.sh list team3 ~/lab4/lab4_record.sh extract team3 # plug your team's drive into the car PC, then: ~/lab4/lab4_record.sh copy team3
mkdir -p ~/EECE5554/Lab4/data/car cp /media/$USER/<drive>/EECE5554_Lab4_team3/*.npz \ ~/EECE5554/Lab4/data/car/
ros2 bag infoon both laptop bags: both topics, about 40 IMU and 1 GPS message per secondextractturns each 30 GB car bag into a 10 MB car file, in a few minutescopyfinds your drive, copies the files, and ejects it.--rawalso copies the whole bags, if the drive has 40 GB free- Everything of yours out of the car, WiFi back on, problems reported
If something goes wrong
| Problem | What to do |
|---|---|
| A rate drops to zero | Keep driving normally, finish the loop, fix it parked, and record the loop again |
| Something comes loose | Do not touch it while the car moves. Stop somewhere legal and safe first |
| fix_quality stays at 1 | Corrections are not arriving: hotspot on, CAT-6 loop in, Corrections tab live |
| A driver dies at launch | Device busy: close minicom. Permission denied: the dialout group |
| CAR READY: NO | Tell staff, and do not drive |
start says the bag exists | It never overwrites. Use the name it suggests, such as car_drive_2, on the laptop too |
copy cannot write to the drive | Format it exFAT. A Mac's own format, APFS, does not work on the car PC |
| Anyone feels unsafe | Stop the drive. A data set can be recollected |
Part 5: the analysis
| Section | The question | Figures |
|---|---|---|
| 5.1 Magnetometer | Hard and soft iron, on foot and in the car | 1 to 5 |
| 5.2 Heading | A complementary filter: the gyro for fast changes, the magnetometer for the long run | 6, 7 |
| 5.3 Velocity | The accelerometer against RTK and the car's own speed, with bias, hill, and stop corrections | 8 |
| 5.4 Motion model | Where the VN-100 sits, from the data | 9 |
| 5.5 Dead reckoning | The IMU track against RTK: how long within 2 m, and within 10 m | 10 |
| 5.6 Two clocks | Line up the laptop and the car PC by matching two gyros | 11 |
| 5.7 LiDAR odometry | The car's path from scan matching, with an ICP you write | 12 |
| 5.8 An RTK outage | IMU, LiDAR, and the two together, through 90 s without GNSS | 13 |
Try it: line up two gyros
Part 5.6
Shift the laptop's gyro
A made-up drive: turns of different lengths, a car gyro at 100 Hz with z up, and a laptop gyro at 40 Hz with z down, whose recording started a few seconds later.
LiDAR odometry
Part 5.7
- Two scans, half a second apart, as x and y points 1 to 3 m above the ground
- Move the new scan by a guess, and pair each point with its nearest neighbor in the old one
- Find the turn and shift that best fit the pairs, with an SVD
- Repeat until it settles: that is ICP, iterative closest point
- Chain the steps into the car's path, and compare it with RTK
An RTK outage
Part 5.8
Pick 90 s of car_drive with a fixed RTK, pretend it is lost, and estimate the path three ways from the last good fix. The distance from RTK after 90 s, over three stretches of a simulated drive, on a log scale:
What to submit
- GitHub: your workspace, four laptop bags, two car files in
data/car/, the analysis notebook, the README with the results table and answers, and the self-check report - Canvas: one PDF with Figures 1 to 13
- Never commit
build/,install/,log/, videos, or the car's own bags
| Item | Points |
|---|---|
| Software and data sets, from the self-check | 25 |
| Figures 1 to 13 | 49 |
| Results table | 5 |
| Questions A1, A2, and 1 to 10 | 41 |
| Total | 120 |
Lab 4 is 20 percent of the final grade. The LiDAR, the clocks, and the outage are 36 of the 120 points.
Where to find help
- The instructions notebook,
EECE5554_Lab4_instructions.ipynb: every step, the tools, and a troubleshooting appendix - The worked example,
EECE5554_Lab4_example.md: the launch package, a passing self-check, the car files, and the README format - The field handout,
EECE5554_Lab4_field_handout.pdf: the drive, step by step, printed - The self-check,
./verify_lab4.sh: run it early and often - Book the car: [[ BOOKING LINK ]]