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
Diff: SequenceController/SequenceController.hpp
- Revision:
- 17:7c16b5671d0e
- Child:
- 21:38c8544db6f4
diff -r 3363b9f14913 -r 7c16b5671d0e SequenceController/SequenceController.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SequenceController/SequenceController.hpp Tue Nov 21 22:03:26 2017 +0000 @@ -0,0 +1,52 @@ +#include "mbed.h" +#include "ConfigFile.h" +#include <string> //mbed doesn't use cstring + +#ifndef SEQUENCECONTROLLER_HPP +#define SEQUENCECONTROLLER_HPP + +//struct for saving the data +struct sequenceStruct { + string title; + int state; //for the current StateMachine, states are ID-ed with enumeration + float timeout; + float depth; + float pitch; +}; + +class SequenceController { +public: + SequenceController(); + + sequenceStruct sequenceStructLoaded[256]; + + void loadSequence(); + + sequenceStruct process(string input_string); + + void runSequence(); //start a ticker that will run the sequenceFunction + void sequenceFunction(); //process the sequence + + void setState(int input_state); //manually set the state of the system + int getState(); + void setTimeout(float input_timeout); + void setDepthCommand(float input_depth_command); + void setPitchCommand(float input_pitch_command); + + int getSequenceState(); + +private: + char _neutral_sequence; + char _dive_cycle; + char _exit; + + string _sequence_array[1024]; //1024 characters, or 1024 items total + + int _number_of_sequences; + int _sequence_counter; + + Ticker sequenceTicker; //Ticker for the sequenceFunction + + int _current_state; +}; +#endif