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:
joel_ssc
Date:
2019-05-13
Revision:
92:52a91656458a
Parent:
87:6d95f853dab3

File content as of revision 92:52a91656458a:

#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;
};

//struct for saving the leg data
struct legStruct {
    int state;      //for the current StateMachine, states are ID-ed with enumeration
    float timeout;
    float yo_time;
    float min_depth;
    float max_depth;
    float heading;
    string title;
};

class SequenceController {
public:
    SequenceController();
    
    sequenceStruct sequenceStructLoaded[256];
    
    void loadSequence();
    
    sequenceStruct process(string input_string);
    
    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;
    
    int _number_of_sequences;
    int _sequence_counter;
    
    Ticker sequenceTicker;          //Ticker for the sequenceFunction
    
    int _current_state;
};
class LegController {
public:
    LegController();
    
    legStruct legStructLoaded[32];
    
    int loadLeg();
    
    legStruct process(string input_string);
    legStruct load_def_leg();   //make sure defaults are in the leg structure 
    
    void legFunction();    //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 getLegState();
    
private:
    char _neutral_sequence;
    char _dive_cycle;
    char _exit;
    
    int _number_of_legs;
    int _leg_counter;
    
    Ticker sequenceTicker;          //Ticker for the sequenceFunction
    
    int _current_state;
}; 
#endif