Use raw acceleration, displacement, and angular rotation data from a vehocle's accelerometer, odometer, and rate hyros to reconstruct a vehicle's X, Y trajectory.
In this project you will take raw sensor data like this:
to calculate vehicle's X, Y trajectory and turn it into plots of vehicle trajectories like this:
Data tells a story but you have to know how to find it!
Contained in the data above is all the information you need to reconstruct a fairly complex vehicle trajectory. After processing this exact data, it's possible to generate this plot of the vehicle's X and Y position:
as you can see, this vehicle first accelerates forwards and then turns right until it almost completes a full circle turn.
timestamp
- Timestamps are all measured in seconds. The time between successive timestamps (Delta_t) will always be the same within a trajectory's data set (but not between data sets).
displacement
- Displacement data from the odometer is in meters and gives the total distance traveled up to this point.
yaw_rate
- Yaw rate is measured in radians per second with the convention that positive yaw corresponds to counter-clockwise rotation.
acceleration
- Acceleration is measured in m/s/s and is always in the direction of motion of the vehicle (forward).
Your job is to complete the following functions, all of which take a processed data_list
(with N entries, each Delta_t apart) as input:
-
get_speeds
- returns a length N list where entry i contains the speed m/s of the vehicle at t = i * Delta_t -
get_headings
- returns a length N list where entry i contains the heading (radians, 0 < 2\pi) of the vehicle at t = i * Delta_t -
get_x_y
- returns a length N list where entry i contains an(x, y)
tuple corresponding to the x and y coordinates (meters) of the vehicle at t = i * Delta_t -
show_x_y
- generates an x vs. y scatter plot of vehicle positions.
The vehicle always begins with all state variables equal to zero. This means x
, y
, theta
(heading), speed
, yaw_rate
, and acceleration
are 0 at t=0.