F15: Undergrads++

From Embedded Systems Learning Academy
Revision as of 00:50, 12 December 2015 by 243 user2 (talk | contribs) (Bluetooth/Bridge Controller)

Jump to: navigation, search

Undergrads++

Abstract

The project is an autonomous car that shall avoid obstacles. The car will consist of five SJ One controllers connected and communicating via one operational CAN bus. Each controller shall be handled by teams of two people per component and integrated to 1 working autonomous car. The Master Controller team shall be responsible for collecting data from the other controllers and guiding the car using high-level logic. The Motor I/O Controller team shall be responsible for the operation of the motors and operation of the LCD display, which will display debugging or current status messages. The Sensor Controller team shall be responsible for collecting data from the sonar sensor and sending the appropriate data. The Geographical Controller team shall be responsible for calculating the orientation of the car. The Bluetooth/Bridge Controller team shall be responsible for the interface to the end user and sending the way-points. All of these five devices shall operate simultaneously and reach the requested destination.

Objectives & Introduction

  • The user shall be able to set a longitude/latitude using an Android app
  • The user shall be able to send a Start command to start the navigation routine
  • The car shall avoid obstacles and navigate appropriately around them
  • The car shall contain sensors in the front and back to go forward and backward without intervention
  • The car shall reach the destination before the battery dies
  • The car shall contain a GPS and compass to calculate the heading, longitude, and latitude
  • The car shall contain a Bluetooth device to receive information from the Android App
  • The car shall contain appropriate sensors to internally calculate the speed of the car
  • The car shall be able to adjust it's speed appropriately when commanded by the Master controller
  • The car shall display appropriate information on the LCD display
System Communication Overview

Team Members & Responsibilities

Master Controller

  • Marvin Flores
  • Hassan Naveed

Sensor Controller & Finances

  • Arlen Eskandari
  • Onyema Ude

GPS Controller

  • Calvin Lai
  • Jonathon Hongpananon

Motor/LCD Controller

  • Hector Prado-Guerrero
  • Jashan Singh

Bridge/Android Controller

  • Phil Tran
  • Shangming Wong

Parts List & Cost

This section goes over the parts that we ordered and the cost of each item.

Item# Part Desciption Vendor Part Number Qty Cost
1 RC Car Amazon.com Traxxas Slash 2WD VXL 58076 1 $339.94
2 +++++ ++++ +++ ++
++
3 CAN Transceiver Texas Instrument SN65HVD232D 5 Sample
4 Assembly Components Amazon.com, Anchor & HSC PCBs, Mechnical & Electical Components NA $++++
5 ++++++++++ ++++++++ ++++++++++++++ 1 $+++
6 Sonar sensor Maxbotix 3 $
7 Sonar sensor Given by Preet LV-MaxSonar-EZ1 MB1010 3 Free
8 Adafruit Tripleaxis Accelerometer+Magnetometer(Compass) Board - LSM303 Adafruit LSM303 1 $20.97
9 LCD Display 1 $
10 1 $

Design & Implementation

The section goes over our top-level designs of our project.

CAN Message ID Table

Sl. No Module ID Type/Bits xxxxx Source bits SSS Destination bits DDD Hex value Source Destination
1 Android 001 CRITICAL_ERROR_BUS_OFF 0 0 0 0 0 x x x 0 0 0 0x008 Android

0x010 Master

0x018 Sensor

0x020 GPS

0x028 Motor-LCD

ANY ALL
2 Master 010 ANDROID->MASTER 0 0 0 0 1 0 0 1 0 1 0 0x04A


Android Master
3 Sensor 011 RC_PARAMS 0 0 0 1 0 0 0 1 0 1 0 0x08A


Android Master
4 GPS 100 SET_DEST 0 0 0 1 1 0 0 1 0 1 0 0x0CA


Android Master
5 MOTOR_LCD 101 COORDINATES ANDROID->MASTER 0 0 1 0 0 0 0 1 0 1 0 0x10A


Android Master
6 X X SENSOR_MASTER_REG 0 0 1 0 1 0 1 1 0 1 0 0x14A


Sensor Master
7 X X MASTER_ANDROID_REG 0 0 1 1 0 0 1 0 0 0 1 0x14A


Master Android
8 X X COORDINATES MASTER->ANDROID 0 0 1 1 1 0 1 0 0 0 1 0x1D1


Master Android
9 X X MASTER_COMMANDS-> Motor 0 1 0 0 0 0 1 0 1 0 1 0x215


Master IO_Motor
10 X X MASTER_COMMANDS->SENSOR 0 1 0 0 1 0 1 0 0 1 1 0x253


Master Sensor
11 X X MASTER_COMMANDS_READ-> IO 0 1 0 1 0 0 1 0 1 0 1 0x295


Master IO_Motor
12 X X IO_MOTOR_MASTER_REG 0 1 0 1 1 1 0 1 0 1 0 0x2D5


IO_Motor Master
13 X X MASTER_COMMANDS->GPS 0 1 1 0 0 0 1 0 1 0 0 0x314


Master GPS
14 X X GPS_MASTER_REG 0 1 1 0 1 1 0 0 0 1 0 0x362


GPS Master
15 X X MASTER_COMMANDS_WRITE-> IO 0 1 1 1 0 0 1 0 1 0 1 0x395


Master IO_Motor

DBC File Implementation

Throughout the development and life-cycle of our project we used a DBC file and a python parser to generate C-code for the five controllers. The DBC file contained CAN messages organized in a particular format, which the python parser generated appropriate code for each CAN node. The C-code generated contained inline functions to convert messages to and from raw CAN messages using marshal and unmarshal operations. This provided a centralized CAN message base for all of the teams to use so that there was consistency throughout the project.

  • The DBC file :
 VERSION ""
  
 
 NS_ : 
 	NS_DESC_
 	CM_
 	BA_DEF_
 	BA_
 	VAL_
 	CAT_DEF_
 	CAT_
 	FILTER
 	BA_DEF_DEF_
 	EV_DATA_
 	ENVVAR_DATA_
 	SGTYPE_
 	SGTYPE_VAL_
 	BA_DEF_SGTYPE_
 	BA_SGTYPE_
 	SIG_TYPE_REF_
 	VAL_TABLE_
 	SIG_GROUP_
 	SIG_VALTYPE_
 	SIGTYPE_VALTYPE_
 	BO_TX_BU_
 	BA_DEF_REL_
 	BA_REL_
 	BA_DEF_DEF_REL_
 	BU_SG_REL_
 	BU_EV_REL_
 	BU_BO_REL_
 	SG_MUL_VAL_
 
 BS_:
 
 BU_: NOONE SENSOR MASTER MOTOR GPS ANDROID
 
 BO_ 100 HEARTBEAT: 1 MASTER
  SG_ MASTER_HEARTBEAT_cmd : 0|8@1+ (1,0) [0|0] "" SENSOR,MOTOR
 
 BO_ 600 INFO_SONARS: 4 SENSOR
  SG_ SENSOR_INFO_SONARS_left : 0|8@1+ (1,0) [0|255] "inch" MASTER
  SG_ SENSOR_INFO_SONARS_middle : 8|8@1+ (1,0) [0|255] "inch" MASTER
  SG_ SENSOR_INFO_SONARS_right : 16|8@1+ (1,0) [0|255] "inch" MASTER
  SG_ SENSOR_INFO_SONARS_rear : 24|8@1+ (1,0) [0|255] "inch" MASTER
 
 BO_ 604 MOTOR_CMD: 2 MASTER
  SG_ MASTER_MOTOR_CMD_steer : 0|8@1+ (1,0) [0|20] "" MOTOR
  SG_ MASTER_MOTOR_CMD_drive : 8|8@1+ (1,0) [0|20] "" MOTOR
 
 BO_ 700 STOP_GO_CMD: 1 ANDROID
  SG_ ANDROID_STOP_CMD_signal : 0|8@1+ (1,0) [0|0] "" MASTER,GPS
 
 BO_ 708 INFO_CHECKPOINTS: 1 ANDROID
  SG_ ANDROID_INFO_CHECKPOINTS_count : 0|8@1+ (1,0) [0|255] "" MASTER,GPS 
 
 BO_ 712 INFO_COORDINATES: 8 ANDROID
  SG_ GPS_INFO_COORDINATES_lat : 0|32@1+ (0.00001,0) [0|0] "" MASTER,GPS
  SG_ GPS_INFO_COORDINATES_long : 32|32@1+ (0.00001,0) [0|0] "" MASTER,GPS
 
 BO_ 716 INFO_HEADING: 4 GPS
  SG_ GPS_INFO_HEADING_current : 0|16@1- (1,0) [0|0] "" MASTER
  SG_ GPS_INFO_HEADING_dst : 16|16@1- (1,0) [0|0] "" MASTER
 
 BO_ 720 DESTINATION_REACHED: 1 GPS
  SG_ GPS_DESTINATION_REACHED_signal : 0|8@1+ (1,0) [0|0] "" MASTER,ANDROID
 
 CM_ BU_ NOONE "No node, used to indicate if it's a debug message going to no one";
 CM_ BU_ MASTER "The driver controller driving the car";
CM_ BU_ SENSOR "The sensor controller of the car";
 CM_ BU_ MOTOR "The motor controller of the car";
 CM_ BU_ ANDROID "The android controller of the car";
 CM_ BO_ 100 "Sync message used to synchronize the controllers";
 
 BA_DEF_  "BusType" STRING ;
 BA_DEF_ SG_ "FieldType" STRING ;
 BA_DEF_ BO_ "GenMsgCycleTime" INT 0 0;
 
 BA_DEF_DEF_ "BusType" "CAN";
 BA_DEF_DEF_ "FieldType" ""; 
 
 BA_ "GenMsgCycleTime" BO_ 100 1000;
 BA_ "GenMsgCycleTime" BO_ 200 100;
 BA_ "GenMsgCycleTime" BO_ 300 100;
 BA_ "FieldType" SG_ 100 MASTER_HEARTBEAT_cmd "MASTER_HEARTBEAT_cmd" 
 BA_ "FieldType" SG_ 604 MASTER_MOTOR_CMD_drive "MASTER_MOTOR_CMD_drive"
 BA_ "FieldType" SG_ 604 MASTER_MOTOR_CMD_steer "MASTER_MOTOR_CMD_steer"
 
 VAL_ 100 MASTER_HEARTBEAT_cmd 0 "MASTER_HEARTBEAT_cmd_NOOP" 1 "MASTER_HEARTBEAT_cmd_SYNC" 2 "MASTER_HEARTBEAT_cmd_REBOOT" ;
 VAL_ 604 MASTER_MOTOR_CMD_drive 4 "MASTER_MOTOR_CMD_drive_FAST" 3 "MASTER_MOTOR_CMD_drive_MEDIUM" 2 "MASTER_MOTOR_CMD_drive_SLOW" 1 "MASTER_MOTOR_CMD_drive_REVERSE" 0 "MASTER_MOTOR_CMD_drive_STOP" ;
 VAL_ 604 MASTER_MOTOR_CMD_steer 4 "MASTER_MOTOR_CMD_steer_HARD_RIGHT" 3 "MASTER_MOTOR_CMD_steer_SOFT_RIGHT" 2 "MASTER_MOTOR_CMD_steer_STRAIGHT" 1 "MASTER_MOTOR_CMD_steer_SOFT_LEFT" 0 "MASTER_MOTOR_CMD_steer_HARD_LEFT"   ;
 

Git Submodule Add-on

To increase productivity and be more organized through the life-cycle of this project our team implemented and used a git submodule. A git submodule is a separate Git repository, which is a subdirectory of our entire main Git repository. What this does is lets us clone another repository within our project and keep commit history of this submodule separate from the separated projects. The Git submodule allowed a central repository to be used for common code such as the DBC file, python parser, and other source/header files we shared. Every team had a separate branch they were working off of the master branch so there was no way for us to share common code. The submodule made code portable to all teams instead of manually making chances when necessary. For example, if 1 team made a change to a file, then the other 4 teams already have the recent change without having to manually update. The update is automatic to everyone who has the Git submodule set up.

  • To set up a git submodule you can perform the following instructions:
    • Create your separate repository on GitLab.com or GitHub.com, whichever Git repository you prefer to use.
    • Execute : git submodule add ssh_url relative_path_to_new_dir
    • Execute : git status
    • Notice a new change to be commited. There should be a .gitmodule created. This contains details supplied about the new submodule.
    • Execute : git submodule init
    • Execute : git submodule update
  • To use the git submodule you just 'cd' into the directory where the git submodule repo is located, and treat it as an independent Git project. There is a master branch you can checkout and pull from to pull-in the most recent changes. Make commits and push like you would to any other Git project. When there are changes made to this Git submodule then there will be new changes shown in the top project directory. You will want to add this change to your next commit so that your top project points to the correct Git submodule commit number.

Master Controller

Master Controller

  • Marvin Flores
  • Hassan Naveed

Master Controller Team Schedule

Sl. No Start Date End Date Task Status Actual Completion Date
1 10/6/2015 10/13/2015 propose CAN message IDs, data length, and priorities. testing communication between the other boards via CAN bus Complete 10/19/2015
2 10/13/2015 10/20/2015 Process motor and Sensor data. Vehicle should be able to run and stop based on the sensor readings. Incomplete 10/**/2015
3 10/20/2015 10/27/2015 Process GPS data and sends appropriate message to the LCD for display. Incomplete 10/**/2015
4 10/27/2015 11/10/2015 Overall CAN bus system implementation. all boards should be able to communicate properly. Master should be able to send/receive message to/from any module(board.) The master should be able to process the messages accordingly. Incomplete 11/**/2015
5 11/10/2015 11/17/2015 Testing/debugging part 1. Master should be able to receive commands from the Android team and be able execute these commands properly. The master should be able to send commands to the other boards. The vehicle should be running and avoiding obstacles. Incomplete 11/**/2015
6 11/17/2015 11/24/2015 Testing/debugging part 2. Master should be able to request GPS coordinates information from the GPS team and be able to make the car move from origin point to the target point. Incomplete 11/**/2015
7 11/24/2015 12/01/2015 Testing/debugging part 3, Finalizing the project. All messages, commands, and requests are handled accordingly. The vehicle should be avoiding obstacles, and is able to go to the target location. Incomplete 12/**/2015

Hardware Design

Discuss your hardware design here. Show detailed schematics, and the interface here.

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.

Motor I/O Controller

Motor/LCD Controller

  • Hector Prado-Guerrero
  • Jashan Singh

Motor control/LCD Team Schedule

Sl. No Start Date End Date Task Status Actual Completion Date
1 10/06/15 10/13/15 Write and test drivers for the brushless motor In progress 10/**/15
2 10/13/15 10/20/15 Write and test drivers for the LCD Incomplete 10/**/15
3 10/20/15 10/27/15 Interface motor to the rest of the software and get moving under power Incomplete 10/**/15
4 10/27/15 11/03/15 Interface LCD to accept and display CAN messages Incomplete 11/**/15
5 11/03/15 11/10/15 Debugging week 1 Incomplete 11/**/15

Hardware Design

Discuss your hardware design here. Show detailed schematics, and the interface here.

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

The Android program was written with the Android SDK. The program uses one Activity and three fragments under that Activity (as seen in the Visio diagram). The Activity is the base of the program, and it manages the three fragments in it using a FragmentTransaction and FragmentManager class. There is another layout in the Activity's layout that is specifically made as a fragment container. The Activity features three buttons at the bottom of the screen. Each button with show a fragment. All fragments are constantly running, and the Activity simply hides fragments from the user when the user clicks on a button in the bottom menu. Fragments communicate with each other by using the Activity as a middle man. Information from Fragment A can pass its information to Fragment B by first going through Activity.

Google Maps was inserted into the Maps Fragment. An API key was needed in order for Google Maps to work on the phone. An open source API was used to get the directions and and coordinates of the start and end position. A LatLng list array was inserted to the API to get the list of coordinates. After choosing a point, the "SET" button should be pressed, and the array will be transmitted through bluetooth. The Maps Fragment features buttons that allow operation of the vehicle. These buttons will transmit data to the SJOne board through Bluetooth.

The Bluetooth API was used to send data to and from the Android and SJOne board. When transmitting data from Android to SJOne, a terminal command is used on the SJOne board side to receive data. This is done by using the UART2 ports of the board, and connecting it with a Bluetooth transceiver.

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.

Sensor Controller

Sensor Controller & Finances

  • Arlen Eskandari
  • Onyema Ude

Sensor Controller Team Schedule

Sl. No Start Date End Date Task Status Actual Completion Date
1 10/7/2015 10/14/2015 Ordering the sensors and studying the sensor's datasheet Complete 10/17/2015
2 10/14/2015 10/30/2015 Reading Sensor's data and preparing it to be sent over the CAN bus Complete 10/17/2015
3 10/30/2015 11/7/2015 Normalizing sensor data values and sending it to the Master through CAN bus Complete 11/09/2015
4 10/24/2015 10/30/2015 Implementation with multiple sensors Complete 11/09/2015
5 10/30/2015 11/24/2015 Sending multiple sensor data to the master through CAN bus Complete 11/09/2015
6 10/24/2015 11/25/2015 Optimizing the code Incomplete
7 12/01/2015 12/17/2015 Collaborating with other teams and updating the code as needed Incomplete

Hardware Design

In our project we used four LV-MaxSonar sensors for object detection to avoid obstacles and navigate clear paths. These sensors are able to detect obstacles 0 – 254 inches, though objects 6 inches or closer are simply registered as 6 inches. These sensors are able to take readings up to every 50mS and have triggered operation for controlled readings. In our project, we configured three of sensors on the front of our car and one additional sensor on the rear. The image below is a schematic of connectivity between the sensors and SJOne board.

Sensor Hardware Design(to be updated)

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.

Bluetooth/Bridge Controller

Bridge/Android Controller

  • Phil Tran
  • Shangming Wong

Android/Bluetooth Team Schedule

Sl. No Start Date End Date Task Status Actual Completion Date
1 10/6/2015 10/15/2015 Familiarize ourselves with the Android SDK and Java and Google Maps API Complete 10/15/2015
2 10/6/2015 10/30/2015 Have a working menu. Complete 10/30/2015
3 10/10/2015 10/30/2015 Have the phone communicating with the SJOne board using Bluetooth Bee (UART). Complete 11/10/2015
4 10/16/2015 11/10/2015 Relay CAN Bus messages/tasks. Incomplete
5 10/18/2015 11/15/2015 Be able to input GPS coordinates and have a working map available. Complete 10/30/2015
6 10/25/2015 11/20/2015 Start and stop commands should be up and running. Test with GPS. Complete 11/05/2015
7 10/20/2015 11/27/2015 Working sensor readings including speed and collisions. Incomplete
8 11/15/2015 12/01/2015 Extensive testing of the application and its bridge Incomplete

Hardware Design

Discuss your hardware design here. Show detailed schematics, and the interface here.

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

The Android program was written with the Android SDK. The program uses one Activity and three fragments under that Activity (as seen in the Visio diagram). The Activity is the base of the program, and it manages the three fragments in it using a FragmentTransaction and FragmentManager class. There is another layout in the Activity's layout that is specifically made as a fragment container. The Activity features three buttons at the bottom of the screen. Each button with show a fragment. All fragments are constantly running, and the Activity simply hides fragments from the user when the user clicks on a button in the bottom menu. Fragments communicate with each other by using the Activity as a middle man. Information from Fragment A can pass its information to Fragment B by first going through Activity.

Google Maps was inserted into the Maps Fragment. An API key was needed in order for Google Maps to work on the phone. An open source API was used to get the directions and and coordinates of the start and end position. A LatLng list array was inserted to the API to get the list of coordinates. After choosing a point, the "SET" button should be pressed, and the array will be transmitted through bluetooth. The Maps Fragment features buttons that allow operation of the vehicle. These buttons will transmit data to the SJOne board through Bluetooth.

The Bluetooth API was used to send data to and from the Android and SJOne board. When transmitting data from Android to SJOne, a terminal command is used on the SJOne board side to receive data. This is done by using the UART2 ports of the board, and connecting it with a Bluetooth transceiver.

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.

Geographical Controller

GPS Controller

  • Calvin Lai
  • Jonathon Hongpananon

GPS Controller Team Schedule

Sl. No Start Date End Date Task Status Actual Completion Date
1 09/29/2015 10/06/2015 Order Adafruit Compass and GPS and solder header pins Complete 10/05/2015
2 10/06/2015 10/13/2015 Connect and get minimum UART connection working and interface compass via I2C Complete 10/20/2015
3 10/13/2015 10/20/2015 Design GPS task to parse data and get compass heading info Complete 10/27/2015
4 10/20/2015 10/27/2015 Integrate GPS, SJSU board, and CAN rx/tx task Complete 11/03/2015
5 10/27/2015 11/3/2015 Test Communication with Master Controller and determine final heading using GPS and compass Complete 11/10/2015
6 11/03/2015 11/10/2015 Test and debug (if there are any errors/corner cases) Complete 11/17/2015
7 11/10/2015 11/17/2015 Optimize the code and testing for stability and report. Incomplete 11/xx/2015


Hardware Design

The figure below illustrates the high-level design for the Geographical Controller. The Geographical controller uses an Adafruit GPS Breakout and an Adafruit 10 Degrees Of Freedom (DOF) IMU Breakout. The Adafruit GPS breakout is a GPS module with a 10Hz update rate with a low current draw, which makes this an excellent device for low power consumption. The Adafruit 10-DOF IMU Breakout contains an accelerometer, gyroscope, magnetometer, barometer, and temperature sensor; however, only the magnetometer was used to calculate the heading direction.

Geographical Hardware Design

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.

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:

Problems Encountered

# Module Issue Resolution Impact
1 (Module(s) involved) (Description) (Our fix) (High/Medium/Low)

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.