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
Diff: main.cpp
- Revision:
- 0:d38d627c922f
- Child:
- 2:89b78367d173
diff -r 000000000000 -r d38d627c922f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Nov 14 22:39:10 2014 +0000 @@ -0,0 +1,54 @@ +/************************************** + +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" +int dataIn[3]; +/////////////////////////////////////////////////////////////////////////// +void periodicFcns() +{ + DB_cs=0; + dataIn[0]=dataBedSPI.write(7); + DB_cs=1; + wait_us(5); + DB_cs=0; + dataIn[1]=dataBedSPI.write(30); + DB_cs=1; + wait_us(5); + DB_cs=0; + dataIn[2]=dataBedSPI.write(22); + DB_cs=1; + //pc.printf("%d, %d, %d, ", dataIn[0], dataIn[1], dataIn[2]); + int exoState=fsm.state(dataIn[1]); + /*pc.printf("State: %u, ", exoState); + pc.printf("Angle: %f, ", translate_L(Read_Encoder())); + pc.printf("Data: %u, %u, %u\r\n", dataIn[0], dataIn[1], dataIn[2]);*/ + +} + +int main() +{ + pc.printf("ExoStart \r\n"); + initializeExoIOs(); + pc.printf("Blah \r\n"); + pc.printf("Here \r\n"); + 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(8,1); + doControl.attach(&periodicFcns, SAMPLE_TIME); + + while (1); +}