Corrected header file include guards.
Dependencies: FiniteStateMachine HipControl Knee LinearBlend1 LocalFileSystem_Read dataComm hapticFeedback initExoVars mbed Blend_Generator Brad_poly_gait Gait_Generator MM_gait Encoders IMUdriver
Fork of Motion Control by
main.cpp
- Committer:
- mzling
- Date:
- 2015-03-14
- Revision:
- 16:e69f063a2068
- Parent:
- 15:3596b7ca1c20
- Child:
- 17:b77c31807825
File content as of revision 16:e69f063a2068:
/************************************** This is the main file for the "RyanEXO" control software. This sets up the main control loop that operates at a 1kHz frequency and controls the flow of the rest of the software The configuration for the exo system that this software runs: amplifiers: 2 Copley Controls 10A digital amplifiers sensors: 2 Austria Microsystems 12 bit magnetic encoders, handled by encoders.h motors: 2 maxon EC90 DC brushless motors, handled by HipMotorControl.h (called in FSM.h) Knees: wrap spring clutch controlled by Firgelli PQ12P linear actuators, controlled in linearActuatorControl.h **************************************/ #include "mbed.h" #include "initExoVars.h" #include "FSM.h" #include "dataBedComm.h" #include "dataComm.h" dataComm *dc = new dataComm(); short int dataIn[32]; short int dataOut[]={0xFF,30,31,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFE}; union short_or_char { char c[2]; short s; } short_or_char; //short_or_char soc; /////////////////////////////////////////////////////////////////////////// // periodicFcns runs at the start of every control loop cycle // It initiates communication with dataBed, checks for errors/safety, and starts the FSM void periodicFcns() { dataOut[1]=encoder_L.readRaw(); dataOut[2]=fsm.error(); int* ptr=(int*)dataIn; ptr=sendData((int*)dataOut, 21, (int*)dataIn); dc->process_write((char*)dataIn,42); //dc->process_write(dataIn, 21); //pc.printf("%d, %d, %d, %d,", dataIn[0], dataIn[1], dataIn[2], dataIn[3]); // Run state change/analysis in FSM //int exoState=fsm.state(dataIn[1]); } int main() { pc.printf("\r\nExoStart \r\n"); initializeExoIOs(); pc.printf("Test\r\n"); // keep for debugging compile errors pc.printf("Starting exo...\n\r"); //If desired, a startup sound can be played. This function is defined in the DatabedCode, because it will command a sound to be played once it detects a heartbeat from ControlBed wait(2); Ticker doControl; dataBedSPI.format(16,0); doControl.attach(&periodicFcns, SAMPLE_TIME); while (1); }