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@2:89b78367d173, 2014-11-24 (annotated)
- Committer:
- perr1940
- Date:
- Mon Nov 24 03:35:08 2014 +0000
- Revision:
- 2:89b78367d173
- Parent:
- 0:d38d627c922f
- Child:
- 3:9719ad064a2c
Exobed Code.... Going to Italy!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
perr1940 | 0:d38d627c922f | 1 | /************************************** |
perr1940 | 0:d38d627c922f | 2 | |
perr1940 | 0:d38d627c922f | 3 | This is the main file for the "RyanEXO" control software. |
perr1940 | 0:d38d627c922f | 4 | This sets up the main control loop that operates at a 1kHz frequency |
perr1940 | 0:d38d627c922f | 5 | and controls the flow of the rest of the software |
perr1940 | 0:d38d627c922f | 6 | |
perr1940 | 0:d38d627c922f | 7 | The configuration for the exo system that this software runs: |
perr1940 | 0:d38d627c922f | 8 | amplifiers: 2 Copley Controls 10A digital amplifiers |
perr1940 | 0:d38d627c922f | 9 | sensors: 2 Austria Microsystems 12 bit magnetic encoders, handled by encoders.h |
perr1940 | 0:d38d627c922f | 10 | motors: 2 maxon EC90 DC brushless motors, handled by HipMotorControl.h (called in FSM.h) |
perr1940 | 0:d38d627c922f | 11 | Knees: wrap spring clutch controlled by Firgelli PQ12P linear actuators, controlled in linearActuatorControl.h |
perr1940 | 0:d38d627c922f | 12 | |
perr1940 | 0:d38d627c922f | 13 | **************************************/ |
perr1940 | 0:d38d627c922f | 14 | #include "mbed.h" |
perr1940 | 0:d38d627c922f | 15 | #include "initExoVars.h" |
perr1940 | 0:d38d627c922f | 16 | #include "FSM.h" |
perr1940 | 2:89b78367d173 | 17 | #include "dataBedComm.h" |
perr1940 | 2:89b78367d173 | 18 | int dataIn[4]; |
perr1940 | 2:89b78367d173 | 19 | int dataOut[]={0xFF,30,31,0xFE}; |
perr1940 | 0:d38d627c922f | 20 | /////////////////////////////////////////////////////////////////////////// |
perr1940 | 0:d38d627c922f | 21 | void periodicFcns() |
perr1940 | 0:d38d627c922f | 22 | { |
perr1940 | 2:89b78367d173 | 23 | dataOut[1]=encoder_L.readRaw(); |
perr1940 | 2:89b78367d173 | 24 | dataOut[2]=encoder_R.readRaw(); |
perr1940 | 2:89b78367d173 | 25 | int* ptr=dataIn; |
perr1940 | 2:89b78367d173 | 26 | ptr=sendData(dataOut, 4, dataIn); |
perr1940 | 2:89b78367d173 | 27 | pc.printf("%d, %d, %d, ", dataIn[0], dataIn[1], dataIn[2], dataIn[3]); |
perr1940 | 0:d38d627c922f | 28 | int exoState=fsm.state(dataIn[1]); |
perr1940 | 0:d38d627c922f | 29 | |
perr1940 | 0:d38d627c922f | 30 | } |
perr1940 | 0:d38d627c922f | 31 | |
perr1940 | 0:d38d627c922f | 32 | int main() |
perr1940 | 0:d38d627c922f | 33 | { |
perr1940 | 0:d38d627c922f | 34 | pc.printf("ExoStart \r\n"); |
perr1940 | 0:d38d627c922f | 35 | initializeExoIOs(); |
perr1940 | 2:89b78367d173 | 36 | pc.printf("Blah\r\n"); |
perr1940 | 2:89b78367d173 | 37 | |
perr1940 | 0:d38d627c922f | 38 | pc.printf("Starting exo...\n\r"); |
perr1940 | 0:d38d627c922f | 39 | //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 |
perr1940 | 0:d38d627c922f | 40 | wait(2); |
perr1940 | 0:d38d627c922f | 41 | Ticker doControl; |
perr1940 | 0:d38d627c922f | 42 | dataBedSPI.format(8,1); |
perr1940 | 0:d38d627c922f | 43 | doControl.attach(&periodicFcns, SAMPLE_TIME); |
perr1940 | 0:d38d627c922f | 44 | |
perr1940 | 0:d38d627c922f | 45 | while (1); |
perr1940 | 0:d38d627c922f | 46 | } |