The project encompassed multiple aspects during the course. The first 6 weeks of the class focused on incorporating the DonkeyCar AI framework into a Nvidia Jetson Nano development board. The second half of the class focused on running the vehicle using a simple ROS package while also integrating a SparkFun OpenLog Artemis IMU (https://www.sparkfun.com/products/16832) into the system to perform position estimation using a simple integration scheme.
Our team consisted of 2 mechanical engineering students (Ayush and Daniel), 1 electrical engineer (Zack) and 1 UCSD extension student (Layne).
The camera mounting system was designed with flexibility and calibration in mind. Because the effectiveness of autonomous driving is largely dependent on the quality of image data, the orientation of the camera becomes extremely important. In order to efficiently manufacture the assembly, the design was broken down into smaller more manageable components to reduce printing time and complexity. The three main components of the mount are the angle brackets, the struts, and the mounting block. The modular design of the assembly allowed for 8 variable angle orientations as well as 10 vertical heights which proved effective when troubleshooting the optimal configuration.
The camera mount attaches to the front mounting block of the car via 2 4mm bolts, providing a universal design independent from the baseplate and electronic configuration. This aspect of universal mounting proved useful to Team 6 in particular, who utilized these files to streamline their own camera mounting assembly. It is possible for teams to reuse this design without any interference with the main build of the car.
The system consists of the following components:
- Jetson Nano Developer Kit
- Adafruit PWM controller
- USB webcam
- LED indicator board
- Battery Pack
- Battery voltage sensor
- Remote relay (EMO)
- 5V DC-DC voltage regulator
The algorithm follows simple Euler integration of a a planar rigid body system.
INSERT BICYCLE CAR DIAGRAM
From the IMU the following signals are available:
- Longitudinal Acceleration
- Lateral Acceleration
- Vertical Acceleration
- Roll Rate
- Pitch Rate
- Yaw Rate
- Longitudinal Magnetic Field
- Lateral Magnetic Field
- Vertical Magnetic Field
These signals are fused in the firmware developed by Francis Le Bars to output the heading of the orientation of the vehicle in quaternion form. The original idea was to use the heading output from the Artemis to calculate x- and y- velocities relative to the starting position of the vehicle. These speeds can then be integrated to determine an estimate of the position of the vehicle. It is important to take into account that the accelerations measured by the IMU are of the rotating frame and include the rotational components as well as the lateral and longitudinal accelerations. After struggling with the heading output from the firmware, it was determined that for some reason the heading was wrong. The team did not have the time to determine if it was due to improper calibration or a broken sensor. To counteract this, it was attempted to directly integrate the yaw rate to obtain the yaw angle of the vehicle. Further, during testing it was determined that low-pass filtering the biased-acceleration was required. There are many more updates to be done but the final algorithm for the project is below:
- Measure the first 1-second of data and calculate the averaged bias
- At each time step, do the following
- a_long_filtered(k+1) = k1*(a_long - bias_long) + k2*a_long_filtered(k)
- a_lat_filtered(k+1) = k1*(a_lat - bias_long) + k2*a_lat_filtered(k)
- U_dot = a_long_filtered + V*omega_yaw
- V_dot = a_lat_filtered - U*omega_yaw
- U(k+1) = U(k) + U_dot*Delta_t
- V(k+1) = V(k) + V_dot*Delta_t
- Deadband U and V (to actually stop the car)
- yaw(k+1) = yaw(k) + yaw_rate*Delta_t
- Rotate U and V into x_dot and y_dot
- x_dot = U*cos(yaw) - V*sin(yaw)
- y_dot -U*sin(yaw) + V*cos(yaw)
- x(k+1) = x(k) + x_dot*Delta_t
- y(k+1) = y(k) + y_dot*Delta_t
Where k1 and k2 are calculated from a basic discrete first-order low-pass filter with a break frequency of 5 rad/s.
Please see the python code, as well as all our final project code, at our GitHub profile here: https://github.com/lclemen/MAE-148-team-4
The position estimation problem is a difficult one that needs additional considerations beyond the scope of this quarter. This project is the first step that can be utilized by future teams. A few ideas for options to investigate include:
- AHRS issues with internal firmware
- Additional filters on the signals
- Fusing the algorithm with an encoder to perform dead reckoning
- Implementing a Kalman filter instead the simple integration scheme.