most functionality to splashdwon, find neutral and start mission. short timeouts still in code for testing, will adjust to go directly to sit_idle after splashdown
Dependencies: mbed MODSERIAL FATFileSystem
SequenceController.hpp
00001 #include "mbed.h" 00002 #include "ConfigFile.h" 00003 #include <string> //mbed doesn't use cstring 00004 00005 #ifndef SEQUENCECONTROLLER_HPP 00006 #define SEQUENCECONTROLLER_HPP 00007 00008 //struct for saving the data 00009 struct sequenceStruct { 00010 string title; 00011 int state; //for the current StateMachine, states are ID-ed with enumeration 00012 float timeout; 00013 float depth; 00014 float pitch; 00015 }; 00016 00017 //struct for saving the leg data 00018 struct legStruct { 00019 int state; //for the current StateMachine, states are ID-ed with enumeration 00020 float timeout; 00021 float yo_time; 00022 float min_depth; 00023 float max_depth; 00024 float heading; 00025 string title; 00026 }; 00027 00028 class SequenceController { 00029 public: 00030 SequenceController(); 00031 00032 sequenceStruct sequenceStructLoaded[256]; 00033 00034 void loadSequence(); 00035 00036 sequenceStruct process(string input_string); 00037 00038 void sequenceFunction(); //process the sequence 00039 00040 void setState(int input_state); //manually set the state of the system 00041 int getState(); 00042 void setTimeout(float input_timeout); 00043 void setDepthCommand(float input_depth_command); 00044 void setPitchCommand(float input_pitch_command); 00045 00046 int getSequenceState(); 00047 00048 private: 00049 char _neutral_sequence; 00050 char _dive_cycle; 00051 char _exit; 00052 00053 int _number_of_sequences; 00054 int _sequence_counter; 00055 00056 Ticker sequenceTicker; //Ticker for the sequenceFunction 00057 00058 int _current_state; 00059 }; 00060 class LegController { 00061 public: 00062 LegController(); 00063 00064 legStruct legStructLoaded[32]; 00065 00066 int loadLeg(); 00067 00068 legStruct process(string input_string); 00069 legStruct load_def_leg(); //make sure defaults are in the leg structure 00070 00071 void legFunction(); //process the sequence 00072 00073 void setState(int input_state); //manually set the state of the system 00074 int getState(); 00075 void setTimeout(float input_timeout); 00076 void setDepthCommand(float input_depth_command); 00077 void setPitchCommand(float input_pitch_command); 00078 00079 int getLegState(); 00080 00081 private: 00082 char _neutral_sequence; 00083 char _dive_cycle; 00084 char _exit; 00085 00086 int _number_of_legs; 00087 int _leg_counter; 00088 00089 Ticker sequenceTicker; //Ticker for the sequenceFunction 00090 00091 int _current_state; 00092 }; 00093 #endif
Generated on Thu Jul 14 2022 10:54:35 by 1.7.2