Difference between revisions of "F17: Rolling Thunder"

From Embedded Systems Learning Academy
Jump to: navigation, search
(Acknowledgement)
(Appendix)
Line 864: Line 864:
  
 
=== Appendix ===
 
=== Appendix ===
You can list the references you used.
 

Revision as of 04:20, 15 December 2017

Contents

Legend

Color Component

Orange

Master Controller

Red

Geographical Controller

Indigo

Communication Controller (Bridge)

Green

Motor/IO Controller

Blue

Sensor Controller

Teal

Android Application

Brown

QA

Team Members & Responsibilities

  • Master Controller
    • Akil Khan
    • Jerry John
  • Geographical Controller
    • Abhilash Tuse
    • Vishal Shrivastava
  • Communication Controller (Bridge)
    • Akinfemi Akin-Aluko
  • Motor and I/O Controller
    • Saurabh Ravindra Badenkal
    • Joshua Skow
  • Sensor Controller
    • Sona Bhasin
    • Thrishna Palissery
  • Android Application
    • Johnny Nigh
  • QA Team
    • Akil Khan
    • Saurabh Ravindra Badenkal

Abstract

A self-driving car navigates to a destination while avoiding obstacles. The car is a modified RC (remote control) car. The destination is set using an Android app.

Schedule

Start Date End Date Task Status Date of Completion
1 09/20/2017 09/26/2017
  • Order components and distribute project modules.
  • Research on project requirements.
  • Research on different sensors to be used.
Completed 09/26/2017
2 09/27/2017 10/03/2017
  • Set up project Git and Wiki page.
  • Understand the hardware specifications of each component.
  • Study the datasheet of each component and the hardware interfacing.
  • Test the compatibility of each module.
Completed 10/03/2017
3 10/04/2017 10/10/2017
  • Establish a connection over Bluetooth between the Android app and the BRIDGE.
Completed 10/10/2017
10/10/2017 Wiki Schedule Completed 10/10/2017
4 10/11/2017 10/17/2017
  • Test ultrasonic sensors (Maxbotix and Parallax ping) and identify the suitable one for front and rear.
  • Verify basic commands to Traxxas motor, send basic commands (e.g. forward) to RC car from SJOne board.
  • Configure GPS device baud rate and interface it with SJOne board using UART.
  • Parse data received from GPS device to transmittable format.
  • Analyse the information required to communicate across the controllers.
  • Chalk out the Message IDs based on the priority of the messages and the data to be sent across nodes.
  • Understand DBC and implement the DBC file compatible with all the controllers.
  • Transfer data from the Android app to the BRIDGE.
Completed 10/17/2017
5 10/18/2017 10/24/2017
  • Implement sensor code and perform standalone testing.
  • Finish motor controller API. Test motor driving in different situations, begin to listen to CAN for controls.
  • Interface motor to the SJOne board and check for basic functionality.
  • Interface Compass module with SJOne board using I2C serial bus.
  • Interface Geo controller module with CAN Bus.
  • Establish communication across all the CAN controllers over CAN bus based on the DBC file.
  • Verify the power-up interactions and configurations between Master and the other controllers
  • Receive data in the Android app from the BRIDGE.
Completed 10/24/2017
10/24/2017 DBC File Completed 10/24/2017
10/24/2017 DEMO: CAN communication between controllers Completed 10/24/2017
6 10/25/2017 10/31/2017
  • Add a button for setting the destination and stopping the car manually.
  • Add a TextView for displaying the Bluetooth connection status.
Completed
7 11/01/2017 11/07/2017
  • Implement basic obstacle avoidance algorithm based on sensor data and test the same. Adjust sensor orientation based on testing.
  • Continue testing motor driver via commands from CAN bus.
  • Build in speed steps to reverse motor for reverse to work correctly.
  • Calibrate Compass Module. Develop code for GPS and Compass module communication over CAN.
  • Send and recieve current location, destination and checkpoint coordinates to and from App and Geo module via BRIDGE.
Completed 11/07/2017
11/07/2017 DEMO: Motors driven by wheel feedback and sensors, Basic obstacle avoidance

Final Wiki Schedule

Completed 11/07/2017
8 11/08/2017 11/14/2017
  • Filter sensor value readings if necessary and decide on incorporating the filter algorithm either in master controller or sensor controller based on performance testing
  • Begin work on LCD to show vehicle status (speed, fuel status, obstacles, distance to destination etc.) in an intuitive GUI.
  • Finish implementing speed control on motor (to make sure requested speed is met based on RPM read).
  • Fine tune motor reversing.
  • Integrate all modules with the Master to test the data flow.
  • Fine tune obstacle avoidance steering logic with rear sensor input and reversing.
  • Start incorporating Geo module information to master module steering logic.
  • Decide, implement and test data exchange between Geo module and BRIDGE.
  • Calculate and send simple bearing angle and destination status on CAN to figure out initial challenges.
  • Add a Google Map for setting the car's destination.
  • Send car location to app and check points received to Geo module.
  • Test each module individually
  • Verify the stringent requirement of Start-up Sync, Periodic heart-beat messages.
  • Start adding contents to the relevent sections of wiki.
Completed 11/14/2017
9 11/15/2017 11/21/2017
  • Test obstacle avoidance algorithm and fine tune sensor readings
  • Test the LCD at run time for vehicle status and decide on improvements if any.
  • Stabilize navigation logic with multiple checkpoints, bearing angle and destination status info.
  • Identify and mitigate GPS locking, offset and other issues.
  • Assure correctness of compass calibration.
  • Determine if any more changes to DBC are required and lock it down.
  • Implement the steering logic with bearing angle and status provided by geo-module.
  • Consistently communicate current car location to App, get check points from App and relay them to Geo module.
  • Send additional vehicle status information from can bus to the app for display.
  • Send the request to Google for getting the checkpoints (use the Google Maps Directions API).
  • Field test and check for obvious issues in obstacle avoidance, navigation, maintaining speed (up/down hill).
  • Provide feed backs to each team on identified short comings.
  • Update wiki with details.
Completed 11/21/2017
11/21/2017 DEMO: GPS driving Completed 11/21/2017
10 11/22/2017 11/28/2017
  • Analyse areas lagging behind and redeploy team where additional resources are required.
  • Implement turning indicators, break lights and head light.
  • Improvise steering logic based on field tests under various conditions and locations.
  • Analyse field test results to re-calberate GPS offset values if required.
  • Generate new checkpoints manually between the waypoints received from Google for better navigation accuracy.
  • Test the accuracy of check-points from the Bluetooth controller, location data from the Geo-controller sensor and Navigation Algorithm.
  • Check overall robustness of the complete system.
  • Update wiki with details.
Completed
11 11/29/2017 12/19/2017
  • All hands on testing and final bug fixes.
  • Check for tuning or calibration of modules if required.
  • Complete end-to-end testing for various scenarios and conditions.
  • Create the semester long project activity video and upload to YouTube.
  • Update and finalize wiki.
In Progress
12/20/2017 DEMO: Final Project

SUBMISSION: Final Project Wiki

Parts List & Cost

Item # Description Distributor Qty Cost
1 SJOne Board Provided by Preet 5 $400
2 RC Car - Traxxas 1/10 Slash 2WD Amazon 1 $189.95
3 Bluetooth Bee BLE 4.0 Module ebay 1 $15
4 GPS Module Amazon 1 $28.99
5 Compass (CMPS11) Acroname 1 $45.95
6 Traxxas 6520 RPM Sensor Amazon 1 $10.82
7 Traxxas 2991 LiPo Battery and Charger Amazon 1 $199.95
8 Breadboard Jumper Wires Amazon 1 $6.99
9 MIFFLIN Acrylic Plexiglass Clear Plastic Sheet Amazon 1 $9.89
10 Printed Circuit Board Amazon 1 $16.83
11 PCB Mounting Feet Set Amazon 1 $11.99
12 Traxxas 6538 Telemetry Trigger Magnet Holder Amazon 1 $4.63
13 MB1240 XL-MaxSonar EZ4 Ultrasonic Sensor Amazon 2 $73.90
14 Parallax Ping Ultrasonic Range Sensor Amazon 2 $69.98
15 CAN Transceiver Microchip 10 Free
16 4D systems 32u LCD 4D Systems 1 $85.00
17 Miscellaneous Items 1 $100.00

Total cost: $1,269.87

Master Controller

Design & Implementation

The master controller acts as the brainpower of the car and processes the data from the rest of the nodes to achieve smooth navigation of the car to its destination. Basically, it takes data from the sensor and geo node to ensure obstacle avoidance and navigation.

Hardware Design & Interface

Master controller does not need any other additional hardware to be connected/interfaced to it as it is responsible for implementing the obstacle avoidance and directing the car to the destination. Hence, the hardware design of master controller only consists of the node being connected to the CAN bus via CAN transceiver module. The figure shows the hardware design of the master.

Master controller Interface
  • Below is the pin connection table of the master controller to the CAN bus
S.R. CAN Transiever Pins SJOne Board Pins
1 Vdd 3.3v
2 GND GND
3 RXD P0.1 (RXD3)
4 TXD P0.0 (TXD3)

Software Design

Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may show psuedocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.

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.

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.

Sensor Controller

Design & Implementation

XL-Maxbotix-ez4 Sensor

The sensor controller oversees the functioning of ultrasonic sensors for the purpose of obstacle avoidance. The sensor controller comprises of four ultrasonic sensors interfaced to an SJOne board. XL-Maxbotix-ez4 sensors are installed on the front and back of the car respectively and Parallax ping sensors are placed to guard the sides of the car from obstacles. Based on the beam angle of each sensor, they have been mounted to protect the front and rear of the car from hitting obstacles.

XL-Maxbotix-ez4

The XL-Maxbotix-ez4 sensor can detect obstacles up to 7.65 meters and works between a supply voltage range of 3.3 V to 5.5 V. The sensor operates at 42 KHz and is equipped with inbuilt acoustic and electrical noise filtering.

Parallax Ping Sensor

Parallax ping

The Parallax ping sensor requires a supply voltage of 5 V. It can measure the distance of obstacles within a range of 3 cm to 3 m. An LED indicator on the sensor shows that the measurement is in progress. A single General-purpose input/output(GPIO) pin is used to trigger the sensor (to send an ultrasonic burst) as well as to listen for the echo pulse that is returned.

Hardware Design

The sensors are interfaced to the SJOne board on port 2 pins. The ultrasonic sensor triggering and ranging is implemented with the help of GPIO and external interrupts.

Sensor Controller Interface

Maxbotix Ultrasonic Sensor

Position Maxbotix Sensor Pins SJOne Board Pins
Front RX - Trigger 2.1
PWM - Echo 2.3
Back RX - Trigger 2.0
PWM - Echo 2.5

Parallax Ping Ultrasonic Sensor

Position Parallax Sensor Pins SJOne Board Pins
Left SIG 2.4
Right SIG 2.2

Hardware Interface

In this section, you can describe how your hardware communicates, such as which BUSes used. You can discuss your driver implementation here, such that the Software Design section is isolated to talk about high level workings rather than inner working of your project.

Software Design

Flow chart

Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may show pseudocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.

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.

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:

Interference between sensors

Due to the placement of front, left and right sensors in close proximity to each other, we observed that there were inconsistencies in sensor readings on the detection of an obstacle. This was checked by monitoring sensor messages on BusMaster.

We were able to reduce the impact of interference by avoiding overlap of ranging time of sensors. To achieve this, the sensors with non-overlapping ranging areas are being triggered at a time and enough time is provided for the sensors to complete their ranging before the next set of sensors are triggered.

Blind spots to the front of the car

On putting the permanent sensor mounts in place and after subsequent testing, it was observed that there were blind spots at the front end of the car such that obstacles falling in some areas weren't being detected effectively.

To overcome the issue, we isolated the sensing area of each sensor based on their respective beam angles and adjusted the sensor positions. As a result, we were able to minimize the blind spots towards the front of the car with least interference. The tradeoff that we had to make was leaving the extreme left and right sides of the car vulnerable to collision with obstacles.

Motor & I/O Controller

Design & Implementation

Titan 12-turn 550 Modified Motor

The Traxxas Slash is a 2 wheel drive car makes use of two motors.

Titan 12-turn 550 Modified Motor

This motor is responsible for driving the rear wheels. This motor takes in a 100Hz duty cycle - 10-15% drives the motor in reverse, 15-20% drives the motor forward.

Traxxas 2075 Servo Motor

Traxxas 2075 Waterproof Servo Motor

This motor is responsible for turning the two front wheels left and right. The servo operates on the same duty cycle as the driver motor; 10-15% duty cycle turns the wheels left, 15-20% duty cycle turns the wheels right.

Hardware Design

The schematic of the motor controller is:

The Traxxas Slash receiver box contains 3 pin connectors for signal, input voltage (VCC) and ground. There are 4 3 pin connectors that come on the Traxxas Slash receiver - 3 of which are used for the car (Servo motor, Driver motor, and RPM sensor). The VCC of each connector is shorted together, and tied to the car battery. The grounds are all shorted as well and connected to the PCB of everything on the car.

The RPM sensor is connected physically to the gearbox, with a small magnet attached to the largest gear. There is a small hall sensor mounted next to this large gear, and every time the gear makes a revolution the hall sensor provides a high pulse indicating the a rotation. The RPM sensor signal is tied to a GPIO on the SJOne board.

Hardware Interface

The motor controller contains the following interfaces to the SJOne:

  • PWM to the Driver motor
  • PWM to the Servo motor
  • GPIO to the RPM sensor
  • GPIO to the ADC for battery voltage monitoring


I/O Module

LCD Interface

Software Design

The motor is abstracted as a C++ class. The motor class is able to set the Driver motor and the Servo motor.

The motor class is also responsible for taking in a desired speed, and making sure the car is driving at that speed. The motor class interprets the RPM sensor output, determines the current car speed compared to the desired car speed, and drives the motor to make the current car speed as close to the desired speed as possible.

The motor used a PID (proportional, integral, derivative) based control algorithm to keep the actual motor speed as close as possible to the desired speed. The tuning was done with the car mounted on a platform. The PID was tuned with the following method:

1. Select a proportional coefficient and change it until the motor feedback has a minimal oscillation. 2. Increase the derivative coefficient until there are no more oscillations. 3. Increase the integral coefficient until the speed increases fast enough and there is no oscillations.


I/O 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.


I/O Module

LCD Screens

Main Screen
Menu Screen
Sensor Screen
Motor Screen
GPS Screen
Compass Screen

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>

Problems faced by motor:

  • Measure the motor speed accurately (measure for # of pulses vs. time between pulses)
  • How to know when the car is stopped
  • How to make the car be the desired speed (steps vs PID)
  • Tuning the PID loop

Geographical Controller

Group Members

  • Abhilash Tuse
  • Vishal Shrivastava

Design & Implementation

The Geographical Controller is in place for navigation purpose. It has two essential parts, namely GPS and compass. It provides direction to the car, by calculating the heading angle and the distance between the coordinates, based on GPS and compass readings. To calculate heading angle, we need a compass bearing angle and angle between the line joining the two coordinates and the true north (bearing angle for GPS).

Heading angle calculation

GPS Bearing angle calculation

With the reference to the figure, the bearing angle for GPS is the angle between the line joining the two coordinates and the true north. To calculate it graphically, draw a vector pointing towards the destination coordinates from the start point coordinate and measure the angle between the vector and the true north. Use the below formula to calculate the angle mathematically.

 Bearing angle(α) = atan2(sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ)
 where,
       φ1 = Latitude of 1st Coordinate
       φ2 = Latitude of 2nd Coordinate
       λ1 = Longitude of 1st Coordinate
       λ2 = Longitude of 2nd Coordinate
       Δλ = λ2 - λ1

Heading angle calculation

The heading angle is the angle between the compass vector and the vector drawn for calculating GPS bearing angle.

 Heading angle(γ) = α – β
 where, 
       α = Angle between the line joining the two coordinates and the true north
       β = Angle between compass vector and the true north (Compass bearing angle)

If heading angle is positive the car turns right or else turns left.

Distance between the two coordinates calculation

The distance between the two coordinates can be calculated using the Haversine formula.

 a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)
 c = 2 ⋅ atan2(√a, √(1−a))
 d = R ⋅ c
 where,
       φ1 = Latitude of 1st Coordinate
       φ2 = Latitude of 2nd Coordinate
       λ1 = Longitude of 1st Coordinate
       λ2 = Longitude of 2nd Coordinate
       Δφ = φ2 - φ1
       Δλ = λ2 - λ1
       d  = distance between the two coordinates
       R  = earth’s radius (mean radius = 6,371km)
 Note: All the angles should be in radians.

Hardware Design

The diagram below shows the h/w interfacing of SJ One board with GPS module and Compass module. The GPS module and the Compass module is communicating over UART3 and I2C respectively with SJ One board.

Hardware Interface

Pin mapping of GPS module with SJ One board:

GPS Module Pins SJ One Board Pins
Vin 3.3v
GND GND
TX RXD3
RX TXD3

Pin mapping of Compass module with SJ One board:

Compass Module Pins SJ One Board Pins
GND GND
SDA SDA
SCL SCL

Compass module requires an external power supply of 5V.

Hardware Interface

GPS Module

Ublox NEO M8N GPS Module

Gps is communication over UART with SJ One board. The data from the GPS is updated at a 5Hz frequency. The most important part is GPS configuration. It is configured using FTDI cable and Ublox software kit. We are using settings for GPS configuration in Ublox as shown below:

Compass Module

CMPS11 Compass Module

Compass is communicating over I2C with SJ One board. The register 2 and 3 of the compass provide the compass bearing angle (0- 360 range). Calibrating the compass is an important part. We are calibrating it on ‘horizontal calibration mode’, it works for us because the compass has tilt calibration.

Calibration process: First of all, you need to enter the calibration mode by sending a 3-byte sequence of 0xF0,0xF5 and then 0xF7 to the command register, these MUST be sent in 3 separate I2C frames. There MUST be a minimum of 20ms between each I2C frame.

The LED will then extinguish and the CMPS11 should now be rotated in all directions on a horizontal plane, if a new maximum for any of the sensors is detected then the LED will flash, when you cannot get any further LED flashes in any direction then exit the calibration mode with a command of 0xF8.

Note: Please make sure that the CMPS11 is not located near to ferrous objects as this will distort the magnetic field and induce errors in the reading. While calibrating rotate the compass slowly. Only the X and Y magnetometer axis is calibrated in this mode.

We are sending 3-byte sequence command of 0xF0,0xF5 and then 0xF7 on 4th switch press and 0xF8 command on 2nd switch press of the SJ One board. You can always restore factory calibration mode by sending the 3-byte sequence command of 0x20,0x2A,0x60. We are using switch 3 to restore factory calibration.

Software Design

Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may show pseudocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.

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.

Testing & Technical Challenges

GPS doesn’t retain configuration settings

Every time the GPS is powered down it forgets the configuration settings after 4-5 hours and it has to be configured again. It could retain the configuration for some time (after powering down) because of a super capacitor. We replaced the super capacitor with a 3.3v battery and now it retains the configuration after it is powered down

Compass frequently losing calibration

Compass was losing calibration because of the magnetic interference from the motors. We wrapped the acrylic sheet (on which our compass was placed) with aluminum foil that acts as a magnetic shield for the compass. To ease the calibration process, we came up with an idea to do it on a switch press.

Unable to send complete GPS coordinates on CAN bus (with 6 decimal digits)

GPS coordinates require double data type and current python script doesn't handle it. So we had to make changes to Python script. Reference: F16: Titans Team

Communication Controller (Bridge)

Group Members

  • Akinfemi Akin-Aluko

Design & Implementation

The design section can go over your hardware and software design. Organize this section using sub-sections that go over your design and implementation.

Hardware Design

Hardware Components:

SJ-One Board Features Summary :

  • LPC1758
  • 512K ROM, 64K(96K) RAM, 1M(2M) SPI Flash, and Micro-SD card slot.
  • Temperature, Acceleration, Infra Red, and Light.
  • GPIO, SPI, UART, I2C.
  • 2 digit LED display
  • 5V Power Supply
  • Highly efficient software framework with many peripheral drivers.
  • Nordic wireless with mesh network software stack
SJ-One Board Picture


XBee Bluetooth.

  • -80dBm sensitivity.
  • Up to +4dBm RF transmit power.
  • Fully Qualified Bluetooth V2.0+EDR 3Mbps Modulation.
  • Low Power 1.8V Operation, 1.8 to 3.6V I/O.
  • UART interface.
  • Integrated PCB antenna.
  • xBee compatible headers.
XBee Bluetooth

Hardware Interface

In this section, you can describe how your hardware communicates, such as which BUSes used. You can discuss your driver implementation here, such that the Software Design section is isolated to talk about high level workings rather than inner working of your project.

Software Design

Show your software design. For example, if you are designing an MP3 Player, show the tasks that you are using, and what they are doing at a high level. Do not show the details of the code. For example, do not show exact code, but you may show psuedocode and fragments of code. Keep in mind that you are showing DESIGN of your software, not the inner workings of it.

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.

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.

Android Application

Design & Implementation

The app was designed for Android 8.0 (Oreo; API level 26) and requires Android 4.4 (KitKat; API level 19) or higher. Play Services 11.0.0 or higher is required to use the Google Maps portion of the app (to select the destination).

The app plays a crucial role in the project since it provides the checkpoints for the car's route.

Software Design

activity_main.xml

This layout is shown after the app is launched. The parent layout is RelativeLayout and it contains a FrameLayout which is used to load fragments instead of activities.

fragment_main.xml

This is the only fragment in the app. This layout contains an ImageView and TextView for displaying the Bluetooth connection status on the left-hand side of the screen. Both of these components change based on the following conditions:

  • Bluetooth is disabled.
  • The app is connected to the Bluetooth module on the communication controller (the bridge).
  • The app is not connected to the Bluetooth module.
  • The app is trying to connect to the Bluetooth module.

To the right of the Bluetooth status is a Button used to set the destination (if the user has already tapped on a location on the map) or to stop the car manually.

The rest of the screen contains the (Google) MapView for displaying the map. The map shows the location of the vehicle using a green marker and a red marker for the destination (if applicable).

Implementation

MainActivity.java

This is the only activity in the app and it is first loaded when the app is started. It loads the activity_main.xml layout which holds a FrameLayout. The FrameLayout is used for loading fragments.

MainFragment.java

This is the only fragment in the app and contains the ImageView and TextView objects for the Bluetooth connection status, the button for setting the destination and stopping the vehicle, and the (Google) MapView.

locationPoint.java

This is a user-defined class for each location that is used in the app (each of the checkpoints, the vehicle, and the destination). The class contains a String and double field for the latitude and corresponding fields for the longitude (there are also byte array fields for both of these coordinates).

The method processLatLong() processes the latitude and longitude so that each coordinate has six decimal places. This method also calculates the byte array versions of the latitude and longitude.

The String and double coordinates are assigned using the setLatLong(double latitude, double longitude) method, which also calls processLatLong() to get the byte array versions.

The methods getMessageNumberOfBytesLatitude() and getMessageNumberOfBytesLongitude() return the number of bytes for the coordinate in the byte array format.

Testing & Technical Challenges

Conclusion

By completing this project we all learned how to use a very important and necessary tool in development-Git (if we did not have experience with it previously). We also got hands-on experience with the CAN bus protocol which is useful for any embedded system in the automotive industry.

Project Video

Project Source Code

References

Acknowledgement

References Used

Android app

Appendix