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/SequenceController.hpp@17:7c16b5671d0e, 2017-11-21 (annotated)
- Committer:
- tnhnrl
- Date:
- Tue Nov 21 22:03:26 2017 +0000
- Revision:
- 17:7c16b5671d0e
- Child:
- 21:38c8544db6f4
FSG code commit 11/21
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tnhnrl | 17:7c16b5671d0e | 1 | #include "mbed.h" |
tnhnrl | 17:7c16b5671d0e | 2 | #include "ConfigFile.h" |
tnhnrl | 17:7c16b5671d0e | 3 | #include <string> //mbed doesn't use cstring |
tnhnrl | 17:7c16b5671d0e | 4 | |
tnhnrl | 17:7c16b5671d0e | 5 | #ifndef SEQUENCECONTROLLER_HPP |
tnhnrl | 17:7c16b5671d0e | 6 | #define SEQUENCECONTROLLER_HPP |
tnhnrl | 17:7c16b5671d0e | 7 | |
tnhnrl | 17:7c16b5671d0e | 8 | //struct for saving the data |
tnhnrl | 17:7c16b5671d0e | 9 | struct sequenceStruct { |
tnhnrl | 17:7c16b5671d0e | 10 | string title; |
tnhnrl | 17:7c16b5671d0e | 11 | int state; //for the current StateMachine, states are ID-ed with enumeration |
tnhnrl | 17:7c16b5671d0e | 12 | float timeout; |
tnhnrl | 17:7c16b5671d0e | 13 | float depth; |
tnhnrl | 17:7c16b5671d0e | 14 | float pitch; |
tnhnrl | 17:7c16b5671d0e | 15 | }; |
tnhnrl | 17:7c16b5671d0e | 16 | |
tnhnrl | 17:7c16b5671d0e | 17 | class SequenceController { |
tnhnrl | 17:7c16b5671d0e | 18 | public: |
tnhnrl | 17:7c16b5671d0e | 19 | SequenceController(); |
tnhnrl | 17:7c16b5671d0e | 20 | |
tnhnrl | 17:7c16b5671d0e | 21 | sequenceStruct sequenceStructLoaded[256]; |
tnhnrl | 17:7c16b5671d0e | 22 | |
tnhnrl | 17:7c16b5671d0e | 23 | void loadSequence(); |
tnhnrl | 17:7c16b5671d0e | 24 | |
tnhnrl | 17:7c16b5671d0e | 25 | sequenceStruct process(string input_string); |
tnhnrl | 17:7c16b5671d0e | 26 | |
tnhnrl | 17:7c16b5671d0e | 27 | void runSequence(); //start a ticker that will run the sequenceFunction |
tnhnrl | 17:7c16b5671d0e | 28 | void sequenceFunction(); //process the sequence |
tnhnrl | 17:7c16b5671d0e | 29 | |
tnhnrl | 17:7c16b5671d0e | 30 | void setState(int input_state); //manually set the state of the system |
tnhnrl | 17:7c16b5671d0e | 31 | int getState(); |
tnhnrl | 17:7c16b5671d0e | 32 | void setTimeout(float input_timeout); |
tnhnrl | 17:7c16b5671d0e | 33 | void setDepthCommand(float input_depth_command); |
tnhnrl | 17:7c16b5671d0e | 34 | void setPitchCommand(float input_pitch_command); |
tnhnrl | 17:7c16b5671d0e | 35 | |
tnhnrl | 17:7c16b5671d0e | 36 | int getSequenceState(); |
tnhnrl | 17:7c16b5671d0e | 37 | |
tnhnrl | 17:7c16b5671d0e | 38 | private: |
tnhnrl | 17:7c16b5671d0e | 39 | char _neutral_sequence; |
tnhnrl | 17:7c16b5671d0e | 40 | char _dive_cycle; |
tnhnrl | 17:7c16b5671d0e | 41 | char _exit; |
tnhnrl | 17:7c16b5671d0e | 42 | |
tnhnrl | 17:7c16b5671d0e | 43 | string _sequence_array[1024]; //1024 characters, or 1024 items total |
tnhnrl | 17:7c16b5671d0e | 44 | |
tnhnrl | 17:7c16b5671d0e | 45 | int _number_of_sequences; |
tnhnrl | 17:7c16b5671d0e | 46 | int _sequence_counter; |
tnhnrl | 17:7c16b5671d0e | 47 | |
tnhnrl | 17:7c16b5671d0e | 48 | Ticker sequenceTicker; //Ticker for the sequenceFunction |
tnhnrl | 17:7c16b5671d0e | 49 | |
tnhnrl | 17:7c16b5671d0e | 50 | int _current_state; |
tnhnrl | 17:7c16b5671d0e | 51 | }; |
tnhnrl | 17:7c16b5671d0e | 52 | #endif |