F17: FoxP2
Contents
- 1 Grading Criteria
- 2 FOXP2
- 3 Abstract
- 4 Objectives & Introduction
- 5 Schedule
- 6 Parts List & Cost
- 7 Overall Design and Methodology
- 8 Motor Controller
- 9 Sensors
- 10 Geographical Controller
- 11 Android Application
- 12 SCons - Build Automation
- 13 Validation and Testing Plan
- 14 Testing & Technical Challenges
- 15 Conclusion
- 16 References
Grading Criteria
- How well is Software & Hardware Design described?
- How well can this report be used to reproduce this project?
- Code Quality
- Overall Report Quality:
- Software Block Diagrams
- Hardware Block Diagrams
- Schematic Quality
- Quality of technical challenges and solutions adopted.
FOXP2
Abstract
This project entails the aggregated knowledge from the Embedded System courses offered at SJSU leveraged into a fully functioning self-driving vehicle. This vehicle will navigate the terrain, avoid obstacles, and relay feedback to the user. The Initialization is enabled using the custom application which will set the final destination using GPS and destination node.
Objectives & Introduction
Show list of your objectives. This section includes the high-level details of your project. You can write about the various sensors or peripherals you used to get your project completed.
Team Members & Responsibilities
- R Nikfar
- Team Lead
- Electrical Circuits Engineering
- PCB design
- Sensor testing and implementation.
- Jason Tran
- Sensor IO Implementaion, and testing
- Master controller.
- Ahsan Uddin
- Git Admin
- Motor Control.
- Yuyu Chen
- Geographical Implementation
- Bridge Support
- Marvin Flores
- Android Application development
- Bridge Implementation
- Rabeel Elahi
- Master Controller Implementation.
- Sophia Quan
- LCD interface
- Motor Control.
- Michael Jaradah
- Testing.
- Taylor Kearns
- Testing.
- Bohan Liu
- Master Controller.
Schedule
Show a simple table or figures that show your scheduled as planned before you started working on the project. Then in another table column, write down the actual schedule so that readers can see the planned vs. actual goals. The point of the schedule is for readers to assess how to pace themselves if they are doing a similar project.
Week# | Date | End Date | Task | Status | Completion Date | |
---|---|---|---|---|---|---|
1 | 10/8/2017 | 10/14/2017 | Geographical: Order GPS and Compass
Android: Setup Android Studio; Run test application Motor: PWM proof of concept Sensors: Research and requirement for the proper front and reverse sensors. IO design. PCB: Initial design of PCB without peripherals was Completed. Master: Research Self-driving car algorithm. |
Completed
Completed Completed Completed Completed Completed |
Android & Bridge: 10/21/2017 | |
2 | 10/15/2017 | 10/21/2017 | Geographical: Interface with micro-controller to receive raw data
Android & Bridge: Initial App UI running. Create a solid plan for checkpoint algorithm. Motor: Run the car in straight line in manual mode. Sensors: Purchase and create the protocols and IO. Master: Start the design of the master controller for all IO. |
Completed
On-going Completed Completed On-going |
Geographical: 10/21/2017 Android & Bridge: 10/28/2017 | |
3 | 10/22/2017 | 10/28/2017 | Geographical: Implement algorithm to parse GPS NMEA sentence and calibrate compass
Android & Bridge: Checkpoint algorithm implemented. Phone to SJSUOne board communication setup. Motor: LCD Display initial integration Sensors: Initialize testing and debugging on the sensors. Master: Set priorities for the connected IO, and design a flowchart of the whole system |
Geographical: Completed Android & Bridge: Completed Delayed due to shipping issues |
Geographical: 10/28/2017 Android & Bridge: 11/04/2017 | |
4 | 10/29/2017 | 11/04/2017 | Geographical: Integrate GPS and compass together to get heading, bearing, and distance
Android & Bridge: Checkpoint algorithm testing. Full Communication with SJSUOne board implemented. Motor: Implement Speed and Voltage sensor. Full functional motor system that can support Gateway Sensors: Implement the IO and sensors with the master controller. PCB: initial design sent out to be printed. Master: Create and Design the Algorithm to handle IO from sensors and output motor controls. |
Completed
Geographical: Completed Android & Bridge: Completed Master: Completed |
Geographical: 11/04/2017 Android & Bridge: 11/11/2017 | |
5 | 11/05/2017 | 11/11/2017 | Geographical: Update DBC with Bridge controller and interface with other nodes on CAN bus
Android & Bridge: Other commands such as start and stop implemented and tested. Checkpoint algorithm finalized. Motor: Implement full functional LCD and Speed sensor feedback control Sensors: Further testing and fine-tuning of sensors for a fluid and seamless drive. Master: Testing of Signals, CAN, and behavior of the vehicle. |
Geographical: On-going Android & Bridge: Completed Master: On-going |
Geographical: 11/11/2017 Android & Bridge: 11/18/2017 | |
6 | 11/12/2017 | 11/18/2017 | Geographical: Calibrate compass with car
Motor: Reverse end to end system integration test Android & Bridge: Forward commands to GEO board Sensors: Improve filtering algorithm. Develop proof of concept for TOF sensors. |
Android & Bridge: Completed Motor: Completed |
Geographical: 11/14/2017 Android & Bridge: 11/25/2017 | |
7 | 11/19/2017 | 11/25/2017 | Geographical: Checkpoint algorithm
Motor: Speed integration check for final speed settings Android & Bridge: Receive messages from GEO & SENSOR. Add features to the app to display sensor values. Sensors: Compare TOF sensor viability. Look into other forms of measurement such as voltage, etc. |
Android & Bridge: Completed Motor: Completed |
Geographical: 11/25/2017 Android & Bridge: 11/25/2017 | |
8 | 11/26/2017 | 12/02/2017 | Geographical: System testing
Motor: Code freeze after feature complete. Clean up and unit test Android & Bridge: Implement auto-connect. Sensors: System testing |
Android & Bridge: Completed Motor: Completed |
Geographical: 12/02/2017 Android & Bridge: 12/02/2017 | |
9 | 12/03/2017 | 12/09/2017 | Geographical: System testing
Android & Bridge: Testing Sensors: System testing |
|||
10 | 12/10/2017 | 12/16/2017 | Geographical: Testing | Android & Bridge: Testing | ||
11 | 12/17/2017 | 12/20/2017 | Demo autonomous car on 12/20 |
Parts List & Cost
Item# | Part Desciption | Vendor | Qty | Cost $ |
---|---|---|---|---|
1 | RC Car | Amazon | 1 | 240.00 |
2 | SJOne board | Preet | 7 | 560.00 |
3 | Adafruit Ultimate GPS Breakout | [1] | 1 | 39.95 |
4 | CMPS11 - Tilt Compensated Compass Module | [2] | 1 | 29.90 |
5 | Bluetooth Module | Sparkfun | 1 | 24.95 |
6 | LIPO Batteries + Charger | 1 | 130.00 | |
7 | Ultrasonic sensor | Maxbotix | 5 | 150.00 |
8 | PCB | Bay Area Circuits | 2 | 75.00 |
9 | DB9 Connector + PCB components | HSC | 1 | 40.00 |
10 | CAN Transceiver | Microchip | 10 | 20.00 |
11 | LED HeadLights | Amazon | 1 | 30.00 |
12 | Traxxas XL-5 ESC (Replacement) | [3] | 1 | 55.00 |
13 | 4D Systems LCD | [4] | 1 | 100.98 |
Overall Design and Methodology
Board Connection Architecture
Our team's approach to the design of this project was solely based on the integrity of its connections and communication between the nodes. Each node would handle specific parts of the car that would require an extensive amount of computing. At the center of this communication would be our design and printed PCB(printed circuit board). This board was designed in a manner that would reduce the amount of noise within the circuitry of its components, and place its nodes at an optimal location relative to the car.
Insert Picture of the board connections here
Printed Circuit Board
The PCB which is at the heart of this project was designed in Eagle CAD. There were 2 iterations of this board. The first one was designed without validation and had problems with noise within the CAN communications(discussed in problems encountered section). This design lacked several necessary connections and was limited by functionality.
The Second version of the board would incorporate 4 external power outlets that supply 3.3V and 5V to external components as necessary. There would also be an external power unit with regulators that make sure that a clean power is fed to the boards if necessary. As shown in the schematic, the can transceivers are connected to the boards using the terminating resistors. This CAN bus line also connects to the DB9 connections to easily read the CAN data using the PCAN Dongle.
Before the Board was sent for printing, the rat nests had to be removed and the connections had to be routed in such a way that minimum amount of noise was created. this ensured a robust communication for the CAN bus and stable noise-free power supply for the external components such as the Ultrasonic Sensors.
Motor Controller
Motor Controller primary tasks are as follows: 1. Control the rear wheels for moving forward, backward and stop 2. Control the front wheels to maneuver 3. Display contents on the LCD
ESC (Electronic Speed Control)
Our car came up Traxxas XL5 installed already. We knew that the onboard wireless receiver controls the ESC through PWM but we didn’t know the frequency and the duty cycle. So we hooked up the ESC with an oscilloscope and used the Wireless transmitter to go forward/backward and found out that the operating frequency of the ESC is 100Hz.
Then we tried implementing the same driving frequency on the SJ one board and we came across several issues:
1. Even though we were setting the SJ Board to 100Hz frequency, for some reason it was outputting ~110Hz
2. The percentage duty cycle we set in the SJ One board FW, was not exactly the same percentage that was output to the pins
3. Due to the above issue in (2), we couldn’t control the car to the finest level of speeds, either it would be stopped or it would be racing down so we had come up with different plans
Our solution to the above problems were to overclock the ESC to ~420Hz where we could control the speed limits very finitely within the scope of the PWM driving frequency of the SJ One board. Below are the scope shots of the PWM driven by the SJ One board to control the ESC
Servo (to turn the front wheels)
The Servo also uses PWM as an input to control the direction of the wheels. SJ One board has a limitation where all PWM signals need to be driven at the same frequency. Which means that as we are driving the ESC signals at ~420 Hz, we also had to drive the servo PWM signals at 420Hz. We had to do a parametric search of various PWM percentages to find out which ones would be best suited for turning the servos. Below are the scope shots of the PWM signals that SJOne board is using to drive the servo directions.
RPM Sensor (for detecting speed)
We used Traxxas RPM sensor (6520) to detect the speed. The package came with a single magnet which, along with the RPM sensor, needed to be mounted inside the motor compartment. The idea is that everytime the motor completes 1 whole revolution, it reaches very close to the sensor. And when the sensor detects the magnet nearby, it sends out a high pulse until the magnet moves away from it. Therefore, upon detecting the X number of rising edge in Y seconds we can say that there were X revolutions/Y seconds
The schematic for hooking up the RPM sensor was challenging because of the following:
1. First we came across an issue where we were able to mount the magnet on the motor but it wasn't possible to mount the RPM sensor head inside the motor compartment. Later we found out that we needed a special compartment designed by Traxxas to hold the RPM sensor inside the motor compartment
2. When we were prototyping the RPM sensor on breadboard, we saw that regardless of whether we bring the magnet close to the sensor or not, the signal voltage was always high. After many researches and trail and errors we found out that the signal pin had to be connected to the VCC across a 1K resistor so that it can effectively pull it down when it detects the magnet
3. The Traxxas RPM sensor package came with a single magnet and a Hall effect sensor. So we put the single magnet inside the motor compartment and it was working fine when we were manually bring the hall effect sensor close by. But when we would put the motor cover on, we would see that the RPM sensor would never trigger. We fixed the issue by putting 2 magnets on top of each other to increase the magnetic field and then we were able to see the RPM sensor work seamlessly.
LCD
The uLCD-32PTU is a 3.2" (240x320) LCD screen with a micro SD connector, GPIO's along with I2C and serial COMMS. Workshop4 IDE was used to program the GUI, and data was transmitted from the SJOne board through UART communication. The LCD displays RPM clicks, GPS heading, bearing, distance, and also the current firmware version and branch name.
Note: The display here shows the angularmeter which will display the rpm, the top right box will display the bearing, heading, and distance from the GPS, and the bottom box will disply the firmware git hash, and branch.
Hardware Interface
1. CAN bus
Motor ECU uses can1 to communicate with other ECUs. Motor primarily receives data from Master/Gateway to maneuver left/straight/right and also stop/forward/reverse the wheels. Motor also receives non-critical system data from Geographical ECU which needs to be displayed to the LCD. For the CAN configuration, we used XXX pin with baud rate YYY.
2. PWM to Motor and servo
There are 3 PWM pins available on SJ One Board. As explained earlier, all PWM frequencies were set to 420Hz. The Motor PWM PIN is driven from XXX and the servo PWM pin is driven from YYY.
3. RPM sensor for edge detection
The RPM input is connected to P2.6. It should be noted that there's a 1K resistor between the VCC of the RPM and the Signal Input
Motor, Servo and the RPM share the power directly from the 8.4V Traxxas battery
4. UART to LCD
LCD uses UART TX/RX port to talk to the LCD. The UART is configured at 9600 bauds/sec.
Software Design
1. Init
In the Motor ECU's init sequence we do the following in order:
- CAN Init:
- PWM Init:
- LCD Init
- RPM sensor Init
- Voltage sensor Init
2. 1 Hz Task
1Hz task is responsible for:
- CAN Bus reset logic
- Handle Manual PWM (only in debug mode)
- RPM check
- Speed check
- Update LCD:
- RPM data
- Bearing data
- Compass data
- Send CAN messages
3. 10 Hz task
10Hz task is responsible for:
- Reverse State machine
4. 100 Hz task
- Handle CAN messages
Implementation
This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
- Overall
- The Motor ECU's main task is to make sure the motor wheels and the servo turns are always in accordance to Master ECU's commandment. Motor ECU dequeues CAN messages in 100Hz task therefore the reaction time of wheels movement is never over 10ms. Although to reach full speed from stop, and more importantly, brake from full speed, it would take the car more than ~1s due to the weight and the inertia from speed.
- Debug mode
- In order to debug the motor side easily on the field
Sensors
The primary responsibility of the sensor ECU is to provide object detection capabilities.
Hardware Design
For object detection, distance sensors are used to provide proximity awareness. 3 distance sensors are placed on the front of the car (front left, front, and front right) to continuously measure the distance of the general directions. An object or obstacle can be detected when the distance of a given direction is below a threshold which indicates that the car cannot traverse in that direction and should attempt steer away from the blocked path.
Hardware Interface
Note: Despite the names, the TX and RX pins do not function as asynchronous serial transmit and receive. The TX functions as an open-drain output that pulls the line down when the sensor wants to trigger a cascaded sensor. The RX functions as an digital input that acts as a trigger for the sensor to begin measuring a distance.
Software Design
The sensor software follows a modular design pattern. Sensors is the top level module
Implementation
This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
Geographical Controller
The main purpose of the geographical controller is to guide the car towards its destination. This is done by processing data from the GPS and Compass module in order to get the Heading, Bearing, and Distance.
The compass will allow the user to calculate the Heading, which tells us which direction the car is pointing relative to magnetic north nor simply, "Which way the car is pointing"?
The GPS will allow the user to get the current coordinate of the car, which will be useful when calculating the Bearing and Distance.
The Bearing tells us the direction from the current location to a checkpoint coordinate, and is given as the angle between the location and the current location of the car.
The Distance tells us how many meters away the current checkpoint is. Essentially, How far away are we from our destination?
The geographical controller is also responsible for:
1. Process data from GPS and Compass module.
2. Navigate to nearest checkpoints and to set destination.
3. Receive checkpoints from Bridge controller.
Hardware Design
Hardware Interface
CAN Bus
The CAN bus interface allows the geographical controller to send and receive data from other microcontrollers on the bus. For example, the geographical controller will send requests to the Gateway controller to tell it to turn right, left, or keep straight in order to reach the set checkpoints. The geographical controller will receive checkpoints from the Bridge controller in order for the geographical controller to know how to steer or how far away the destination is at.
MTK3339 Ultimate GPS
The MTK3339 Ultimate GPS module from Adafruit was chosen because it provided good results when it was used previously for a different project. The main purpose of the GPS module is to provide an accurate location of the car while the car navigates towards its destination. This is done by parsing NMEA sentences, which are transmitted by 22 satellites to pinpoint the current location of the module. There are various different types of NMEA sentences, such as $GPRMC and $GPGGA. The NMEA sentence that was used was $GPRMC, which provides only the recommended minimum. $GPRMC was also chosen because it is the only NMEA sentence the GPS module is able to provide data at 10Hz for real-time application. The module is interfaced via UART with a baud-rate set to 57600bps. The module also comes with a fix LED, which indicates if a GPS fix by blinking every 15 seconds, if not, it blinks every 1Hz. The module is powered by 3.3V from the SJOne board.
The $GPRMC sentence is separated by commas, which the user has to parse in order to get useful data out of the module. The most important data that the user want is the GPS coordinate, Latitude and Longitude. The strtok_r() function was used in order to parse the NMEA sentence.
Below is an example of a parsed $GPRMC sentence:
Example: $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68 1 2 3 4 5 6 7 8 9 10 11 12
Number | Raw form | Description |
---|---|---|
1 | 225446 | Time of fix 22:54:46 UTC |
2 | A | Navigation receiver warning A = OK, V = warning |
3 | 4916.45 | Latitude 49 deg. 16.45 min |
4 | N | North |
5 | 12311.12 | Longitude 123 deg. 11.12 min |
6 | W | West |
7 | 000.5 | Speed over ground, Knots |
8 | 054.7 | Course Made Good, True |
9 | 191194 | Date of fix 19 November 1994 |
10 | 020.3 | Magnetic variation 20.3 deg |
11 | E | East |
12 | *68 | mandatory checksum |
CMPS11 - Tilt Compensated Compass Module
The CMPS11 - Tilt Compensated Compass module was chosen because it provides the heading value, which let the user know which way the car is facing relative to magnetic north. Not only does it provide heading, the module also has a 3-axis gyro and a 3-axis accelerometer to remove or neglect any errors while the module is tilted (going up or down a slope). Another compass module was considered before choosing this module because the old module had to be calibrated extensively in order for it to work properly. This module only needed to be calibrated one time in an environment free of magnetic interference. The heading was double-checked after the module was mounted onto the car.
The compass module is placed away from all other components of the car to minimize any magnetic interference from the motor, servo, sensors, and microcontrollers. Placing it in an environment where there is magnetic interference will cause incorrect reading of the heading and the car will navigate towards the wrong direction. The compass module is interfaced via I2C. It is powered on by 3.6-5V, but 3.3V works also.
Software Design
The Geographical Controller is designed in a way so that the code is modular and organized. Only what is needed are exposed.
GPS Compass Geo_Sensor bool gps_init(gps_data_ready_cb cb); bool cmps11_init(void); bool geo_sensor_init(void); bool get_lat_long(float *gps_data); float cmps11_get_heading(void); void geo_sensor_run(void); bool cmps11_calibrate(bool start_calibration, bool end_calibration); float compute_distance(float gps_lat, float gps_long, float dst_lat, float dst_long);
The GPS library and Compass library are used by Geo_Sensor in order to calculate the Heading, Bearing, and Distance when geo_sensor_run() is called. Extern variables are used to share data CAN layer and Geo_Sensor.
extern float e_heading; extern float e_bearing; extern float e_distance; extern float e_curr_latitude; extern float e_curr_longitude; extern float e_checkpoint_latitude; extern float e_checkpoint_longitude; extern uint8_t e_heading_valid; extern bool e_gps_distance_valid;
Task | Description |
---|---|
geo_init() | CAN_init()
geo_sensor_init() |
geo_1Hz() | CAN_reset_bus() |
geo_10Hz() | geo_sensor_run() command_car() |
geo_100Hz() | can_rx() |
geo_1kHz() | N/A |
Implementation
GPS
The GPS main purpose is to provide the latitude and longitude for its current location. It is interfaced via UART. This will help us calculate the bearing and distance to the destination. An example of raw NMEA string is provided in the Hardware Interface section of Geographical Controller.
Compass
The compass will provide the Heading, which tells us the direction where the car is facing. It is interfaced via I2C. The Heading value is in units of degree, from 0 degree to 360 degree. Only two registers are read (Hi and Lo) for heading value.
Geo-Sensor
This layer combines the data from the GPS (latitude and longitude) and Compass (heading). In this layer, the distance (in meter) and bearing (in degree) are calculated. The distance and bearing are calculated by the current latitude and longitude, along with the checkpoint's latitude and longitude.
The Bearing (in degrees) is calculated from the following formula (Forward Azimuth): bearing = atan2( sin(longDiff_rad)*cos(lat2_rad), cos(lat1_rad)*sin(lat2_rad)-sin(lat1_rad)*cos(lat2_rad)*cos(longDiff_rad))
The distance (in meters) is calculated from the following formula (Haversine Formula): a = sin^2(latDiff_rad/2) + cos(lat1_rad) * cos(lat2_rad) * sin^2(longDiff_rad/2) formula: c = 2 *atan2(sqrt(a), sqrt(1-a)) d = Radius of Earth * c
The heading, bearing, and distance values are shared with the CAN layer for further manipulation. A simple moving average with a window of 10 was implemented to filter out bad GPS parsing (corrupt data) which occur after some time. Any distance value above the moving average will mark the GPS data as invalid.
To navigate the car in the direction of the destination, the difference of the heading and bearing will have to be approximately zero. After many test runs, the team realize that the car moves to the right when the steering is straight. To account for this, the threshold for which to turn right is decreased so that it will turn right less.
Difference = Heading - Bearing
The distance to mark a checkpoint as reached is 3 meters radius from the actual destination, which accounts for some GPS inaccuracy. Therefore it will reach its destination within a 6 meter diameter.
To receive checkpoints from the Bridge controller, the Bridge controller has to send the checkpoints via CAN to the Geographical controller. This is done with a handshake protocol between the two controllers. The Bridge will first send the number of checkpoints available to the Geographical controller. Once a non-zero number is received by the Geographical controller, the Geographical controller will start receiving Latitude and Longitude pairs from the Bridge controller. After receiving a "Done" signal from the Bridge, the Geographical controller responds with the number of Latitude and Longitude pair received. The handshake state machine for the Geographical controller is the left one above.
To command the car to navigate towards the destination, a GO signal needs to be sent from the Android App. To stop the car, a STOP signal is also sent from the Android App. After receiving checkpoints from the Bridge/App and Go is received, the Geographical controller will calculate which checkpoint is the closest based on distance between the checkpoints and the car's current location. After reaching that checkpoint, mark the checkpoint as "reached" to skip that checkpoint and find the next closest checkpoint until all checkpoint has been reached. The checkpoint algorithm for the Geographical controller is the right one above.
Android Application
Main Tasks
- Generate checkpoints
- Send START and STOP commands
- Auto-connect to the Bridge module
- Display relevant information:
- map
- current phone location
- current car location
- connection heartbeat
- checkpoint
Software Design
High Level Architecture Design
The application's high level design is simple: Use Google Maps API to get the checkpoints and forward them to the bridge controller. Once the checkpoints are sent, the START command can be executed by clicking the START button on the app. This sends a start command signal to the bridge controller which then forwards the message to the Geo Controller via CAN bus. The STOP command, however, can be executed at any point in time and has the same process as the START command.
Implementation
Android applications follows the MVC pattern by default to allow developers to manage their applications easily. For this application, the Views are the MapView, Buttons, Heartbeat (ImageView), and TextViews to display extra information from the bridge. The Controller is the main fragment that contains all the logic. The Models are the data that come from the the Google Maps API and data coming from the bridge.
MapPane Fragment
The MapPane Fragment is used as the main class of the application and provides the link between the Models and the Logic of the application. MapPane Fragment contains the MapView, buttons for CHECKPOINTS, START, and STOP, as well as some extra information from the Bridge Controller such as heartbeat and sensor values.
Logic
The Logic resides in the MapPane Fragment and is a combination of different objects:
- Button Click Listeners - these listeners are attached to specific button views to execute methods when clicked.
- Message Handler - this handler is responsible for communication between the main fragment and the Bluetooth Service.
- Connection Watcher - this is a thread that runs at startup which monitors the connectivity with the Bridge Controller by checking the heartbeat message.
Bluetooth Service
This component is responsible for connecting/disconnecting with the Bridge Controller via Bluetooth. It's also responsible for sending/receiving data, as well as parsing the received data from the Bridge Controller.
MapHelper
This helper class is responsible of requesting a GET REST call to Google Maps API. It's also responsible of parsing the Json response and extract the checkpoints.
This section includes implementation, but again, not the details, just the high level. For example, you can list the steps it takes to communicate over a sensor, or the steps needed to write a page of memory onto SPI Flash. You can include sub-sections for each of your component implementation.
SCons - Build Automation
SCons is a build automation tool similar to Make and is based on the Python programming language. The 2 documents below describe the basic usage of SCons to build firmware and unit tests.
File:Cmpe243 f17 foxp2 SCons Build Automation.docx
File:Cmpe243 f17 foxp2 SCons Building Unit Tests.docx
There are 3 build environments defined for the FoxP2 project.
1. ARM build environment
2. DBC build environment
3. Unit test build environment
ARM Build Environment
The ARM build environment utilizes the GNU ARM embedded toolchain to compile code for ARM targets namely for the SJOne Board's LPC1758 powered by an ARM Cortex-M3 (ARMv7-M architecture). Resources used by this build environment include Cortex-M3 specific code, FreeRTOS, start up code, linker scripts, LPC1758 drivers, and finally application-specific code. To build an ECU-specific program, an ECU name can be provided as a command line argument.
DBC Build Environment
The DBC build environment utilizes the default Python interpreter (defined in PATH) and the DBC parser Python tool to generate a C header file. The build environment uses the target ECU name as the target NODE required by the DBC parser.
Unit Test Build Environment
The unit test build environment utilizes the native C compiler on Linux hosts and Cygwin's C compiler on Windows hosts. SCons automatically searches for all unit tests source files in a test directory with file names starting with "test_". When the unit test flag is provided on command line, SCons will build then executed all unit tests. If any unit test fails, the overall SCons build will fail. For Windows, the FoxP2 repository contains pre-built shared libraries (.dll) of Cgreen unit testing library and Cygwin's POSIX references which are linked at run-time.
Validation and Testing Plan
Sensor Testing:
- Front left sensor detection (values)
- Front right sensor detection (values)
- Front middle sensor detection (values)
- Back left sensor detection (values)
- Back right sensor detection (values)
- Response & accuracy / precision
- put object 1 ft away, and make sure it reads 12 in (inches are sent over can)
- response to approaching obstacles (start from 3ft away and move in)
- LED correspondence with values
- All sensor MIA handling
Object Avoidance Testing:
- If right sensor blocked, go left
- If left sensor blocked, go right
- If front sensor blocked, reverse, go right/left
- If right & left sensor blocked, reverse, go right/left
- If back sensor blocked, move forward
- If back and front left blocked, go right
- If back and front right blocked, go left
Motor Testing:
- If ramped up, speed up
- If ramped down, slow down
- If no ramp, constant speed
LCD Testing:
- Display compass
- Display voltage
- Display speed
- Githash version
- Branch name
- All values update accordingly
- Display values MIA handling
Voltage sensor Testing:
- Compare smart device, voltmeter, and sensor readings
App Testing:
- Automatic car connection
- Set a GPS location
- Sends stop to car until destination chosen
- MIA car / GPS lock handling
Geographical testing:
- Losing the GPS Lock
- Accuracy in sending coordinates
- Location accuracy in chosing destination
- MIA GPS sensor
Basic Hardware Testing:
- Confirm switch to turn on car works
- 7-Seg value indication
- LED indications
- No loose / flimsy wires
- Car doesn't move unless given a GPS coordinate
- Avoids obstacles while moving towards a target destination
- Can reverse away from obstacles and continue towards the destination
- Avoid GPS when reversing for 5 seconds
Testing & Technical Challenges
Describe the challenges of your project. What advise would you give yourself or someone else if your project can be started from scratch again? Make a smooth transition to testing section and described what it took to test your project.
Include sub-sections that list out a problem and solution, such as:
<Bug/issue name>
Discuss the issue and resolution.
Conclusion
Conclude your project here. You can recap your testing and problems. You should address the "so what" part here to indicate what you ultimately learnt from this project. How has this project increased your knowledge?
Project Video
Upload a video of your project and post the link here.
Project Source Code
References
Acknowledgement
Any acknowledgement that you may wish to provide can be included here.
References Used
List any references used in project.
Appendix
You can list the references you used.