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

Committer:
tnhnrl
Date:
2017-11-21
Revision:
17:7c16b5671d0e
Child:
21:38c8544db6f4

File content as of revision 17:7c16b5671d0e:

#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