GitLab system status is available here and here

Commit 0f7402ac authored by Singaravelavan Rajesh's avatar Singaravelavan Rajesh
Browse files

Working Part 8: Pending Checkoff

parent c38f0789
This diff is collapsed.
......@@ -44,6 +44,9 @@
******************************************************************************/
#define FWD_TIMEOUT 1000
#define TR_TIMEOUT 250
#define RIGHT_TIMEOUT 510
/*******************************************************************************
* PRIVATE FUNCTION PROTOTYPES *
******************************************************************************/
......@@ -65,6 +68,8 @@ typedef enum {
TRBACK,
TRFWD,
TR,
STOP,
FINISH,
} TemplateFSMState_t;
static const char *StateNames[] = {
......@@ -74,6 +79,8 @@ static const char *StateNames[] = {
"TRBACK",
"TRFWD",
"TR",
"STOP",
"FINISH",
};
......@@ -151,67 +158,108 @@ ES_Event RunTemplateFSM(ES_Event ThisEvent) {
// now put the machine into the actual initial state
nextState = FORWARD;
stuck = 1;
ES_Timer_InitTimer(1, 5000);
ES_Timer_InitTimer(1, FWD_TIMEOUT);
makeTransition = TRUE;
ThisEvent.EventType = ES_NO_EVENT;
}
break;
case FORWARD: // in the first state, replace this with appropriate state
// goes forward at 75%
Roach_RightMtrSpeed(-75);
Roach_LeftMtrSpeed(-75);
Roach_LEDSSet(0);
// If not stuck
if (ThisEvent.EventType == ES_TIMEOUT && ThisEvent.EventParam == 1) {
stuck = 0;
}
// Goes to backward state
if (ThisEvent.EventType == FRONT && stuck) {
nextState = BACKWARD;
makeTransition = TRUE;
}
// Goes back a little bit to turn right
if (ThisEvent.EventType == FRONT && !stuck) {
ES_Timer_InitTimer(1, 500);
ES_Timer_InitTimer(1, TR_TIMEOUT);
nextState = TRBACK;
makeTransition = TRUE;
}
// if we reach the dark
if (ThisEvent.EventType == DARK) {
ES_Timer_InitTimer(1, 1000);
nextState = STOP;
makeTransition = TRUE;
}
break;
case BACKWARD:
// goes backward
Roach_RightMtrSpeed(75);
Roach_LeftMtrSpeed(75);
Roach_LEDSSet(0);
// goes forward a little bit to turn right
if (ThisEvent.EventType == BACK) {
ES_Timer_InitTimer(1, 500);
ES_Timer_InitTimer(1, TR_TIMEOUT);
nextState = TRFWD;
makeTransition = TRUE;
}
break;
case TRBACK:
// goes back a little bit
Roach_RightMtrSpeed(75);
Roach_LeftMtrSpeed(75);
// goes to turn right state
if (ThisEvent.EventType == ES_TIMEOUT && ThisEvent.EventParam == 1) {
ES_Timer_InitTimer(1, 500);
ES_Timer_InitTimer(1, RIGHT_TIMEOUT);
nextState = TR;
makeTransition = TRUE;
}
break;
case TRFWD:
// goes forward a little bit
Roach_RightMtrSpeed(-75);
Roach_LeftMtrSpeed(-75);
// goes to turn right state
if (ThisEvent.EventType == ES_TIMEOUT && ThisEvent.EventParam == 1) {
ES_Timer_InitTimer(1, 500);
ES_Timer_InitTimer(1, RIGHT_TIMEOUT);
nextState = TR;
makeTransition = TRUE;
}
break;
case TR:
// turn right
Roach_RightMtrSpeed(75);
Roach_LeftMtrSpeed(-75);
if (ThisEvent.EventType == ES_TIMEOUT && ThisEvent.EventParam == 1) {
ES_Timer_InitTimer(1, 500);
// goes to forward state after turning right
if (ThisEvent.EventType == ES_TIMEOUT && ThisEvent.EventParam == 1) {
stuck = 1;
ES_Timer_InitTimer(1, FWD_TIMEOUT);
nextState = FORWARD;
makeTransition = TRUE;
}
break;
case STOP:
// Edge case to make sure we arent stuck and are fully in the dark
Roach_RightMtrSpeed(-100);
Roach_LeftMtrSpeed(-100);
if (ThisEvent.EventType == ES_TIMEOUT && ThisEvent.EventParam == 1) {
nextState = FINISH;
makeTransition = TRUE;
}
break;
case FINISH:
// FINISH in the dark
Roach_RightMtrSpeed(0);
Roach_LeftMtrSpeed(0);
Roach_LEDSSet(0xFFF);
default: // all unhandled states fall into here
break;
} // end switch on Current State
......
......@@ -4,14 +4,14 @@
<memory name="program">
<units>bytes</units>
<length>126464</length>
<used>33592</used>
<free>92872</free>
<used>33796</used>
<free>92668</free>
</memory>
<memory name="data">
<units>bytes</units>
<length>16384</length>
<used>3798</used>
<free>12586</free>
<used>3806</used>
<free>12578</free>
</memory>
</executable>
</project>
......@@ -2,15 +2,6 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/Lab0Part7.X/TemplateFSM.c</file>
<file>file:/C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/Lab0Part7.X/TemplateES_Main.c</file>
<file>file:/C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/include/ES_Timers.h</file>
<file>file:/C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/include/ES_Events.h</file>
<file>file:/C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/Lab0Part7.X/TemplateService.c</file>
<file>file:/C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/src/ES_Timers.c</file>
<file>file:/C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/Lab0Part7.X/ES_Configure.h</file>
<file>file:/C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/include/roach.h</file>
</group>
<group/>
</open-files>
</project-private>
$(MP_EXTRA_CC_PRE) -g -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/src/ES_KeyboardInput.c
\ No newline at end of file
$(MP_EXTRA_CC_PRE) -g -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/src/ES_PostList.c
\ No newline at end of file
#
# Generated Makefile - do not edit!
#
#
# This file contains information about the location of compilers and other tools.
# If you commmit this file into your revision control server, you will be able to
# to checkout the project and build it from the command line with make. However,
# if more than one person works on the same project, then this file might show
# conflicts since different users are bound to have compilers in different places.
# In that case you might choose to not commit this file and let MPLAB X recreate this file
# for each user. The disadvantage of not commiting this file is that you must run MPLAB X at
# least once so the file gets created and the project can be built. Finally, you can also
# avoid using this file at all if you are only building from the command line with make.
# You can invoke make with the values of the macros:
# $ makeMP_CC="/opt/microchip/mplabc30/v3.30c/bin/pic30-gcc" ...
#
SHELL=cmd.exe
PATH_TO_IDE_BIN=C:/Program Files/Microchip/MPLABX/v5.50/mplab_platform/platform/../mplab_ide/modules/../../bin/
# Adding MPLAB X bin directory to path.
PATH:=C:/Program Files/Microchip/MPLABX/v5.50/mplab_platform/platform/../mplab_ide/modules/../../bin/:$(PATH)
# Path to java used to run MPLAB X when this makefile was created
MP_JAVA_PATH="C:\Program Files\Microchip\MPLABX\v5.50\sys\java\zulu8.40.0.25-ca-fx-jre8.0.222-win_x64/bin/"
OS_CURRENT="$(shell uname -s)"
MP_CC="C:\Program Files\Microchip\xc32\v3.01\bin\xc32-gcc.exe"
MP_CPPC="C:\Program Files\Microchip\xc32\v3.01\bin\xc32-g++.exe"
# MP_BC is not defined
MP_AS="C:\Program Files\Microchip\xc32\v3.01\bin\xc32-as.exe"
MP_LD="C:\Program Files\Microchip\xc32\v3.01\bin\xc32-ld.exe"
MP_AR="C:\Program Files\Microchip\xc32\v3.01\bin\xc32-ar.exe"
DEP_GEN=${MP_JAVA_PATH}java -jar "C:/Program Files/Microchip/MPLABX/v5.50/mplab_platform/platform/../mplab_ide/modules/../../bin/extractobjectdependencies.jar"
MP_CC_DIR="C:\Program Files\Microchip\xc32\v3.01\bin"
MP_CPPC_DIR="C:\Program Files\Microchip\xc32\v3.01\bin"
# MP_BC_DIR is not defined
MP_AS_DIR="C:\Program Files\Microchip\xc32\v3.01\bin"
MP_LD_DIR="C:\Program Files\Microchip\xc32\v3.01\bin"
MP_AR_DIR="C:\Program Files\Microchip\xc32\v3.01\bin"
# MP_BC_DIR is not defined
DFP_DIR=C:/Program Files/Microchip/MPLABX/v5.50/packs/Microchip/PIC32MX_DFP/1.5.259
$(MP_EXTRA_CC_PRE) -g -D__DEBUG -fframe-base-loclist -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/src/serial.c
\ No newline at end of file
$(MP_EXTRA_CC_PRE) -g -D__DEBUG -fframe-base-loclist -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/Lab0Part8.X/TemplateES_Main.c
\ No newline at end of file
$(MP_EXTRA_CC_PRE) -g -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/Lab0Part8.X/TemplateHSM.c
\ No newline at end of file
$(MP_EXTRA_CC_PRE) -g -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/src/ES_Queue.c
\ No newline at end of file
$(MP_EXTRA_CC_PRE) -g -D__DEBUG -fframe-base-loclist -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/src/ES_Queue.c
\ No newline at end of file
$(MP_EXTRA_CC_PRE) -g -D__DEBUG -fframe-base-loclist -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/src/timers.c
\ No newline at end of file
$(MP_EXTRA_CC_PRE) -g -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/Lab0Part8.X/TemplateES_Main.c
\ No newline at end of file
$(MP_EXTRA_CC_PRE) -g -D__DEBUG -fframe-base-loclist -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/ECE118/src/LED.c
\ No newline at end of file
$(MP_EXTRA_CC_PRE) -g -D__DEBUG -fframe-base-loclist -x c -c -mprocessor=$(MP_PROCESSOR_OPTION) -fno-common -I"." -I"../ECE118/include" -DXPRJ_default=$(CND_CONF) -legacy-libc $(COMPARISON_BUILD) -mdfp="${DFP_DIR}" C:/Users/sirajesh/Desktop/ECE118/ece118-lab-0/Lab0Part8.X/BumperSubHSM.c
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment