first publish
Dependencies: MPU9150_DMP MotorControl QuaternionMath SimpleIOMacros mbed
Fork of cool_step by
Revision 25:af166a728c89, committed 2015-06-12
- Comitter:
- heuristics
- Date:
- Fri Jun 12 06:42:56 2015 +0000
- Parent:
- 24:fa52fd530d6e
- Commit message:
- 12.6.2015
Changed in this revision
QuaternionMath.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r fa52fd530d6e -r af166a728c89 QuaternionMath.lib --- a/QuaternionMath.lib Tue Jun 02 06:51:34 2015 +0000 +++ b/QuaternionMath.lib Fri Jun 12 06:42:56 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/teams/TobyRich-GmbH/code/QuaternionMath/#08d9c0010cc0 +http://developer.mbed.org/teams/TobyRich-GmbH/code/QuaternionMath/#69f240dbf0df
diff -r fa52fd530d6e -r af166a728c89 main.cpp --- a/main.cpp Tue Jun 02 06:51:34 2015 +0000 +++ b/main.cpp Fri Jun 12 06:42:56 2015 +0000 @@ -10,11 +10,9 @@ DigitalOut led1(P2_6); DigitalOut led2(P2_7); DigitalOut led3(P2_8); -AnalogIn hallSensor(P0_26); float P=0,I=0,D=0; int pulsesMotor2=0,pulsesMotor1=0; int int_time=0,bint_time=0; -//InterruptIn hall1_(P0_5), hall2_(P0_4); Serial RN42(P0_10, P0_11); @@ -28,12 +26,12 @@ MPU9150 imu(P0_28, P0_27, P2_13); -//Hallsensor hall2(P0_4, P0_5); Motor motor2(P2_2, P2_3, pulsesMotor2); -//Hallsensor hall1(P1_26, P1_27); - Motor motor1(P2_0, P2_1, pulsesMotor1); +AnalogIn sg1(P0_24); +AnalogIn sg2(P0_23); +AnalogIn hallSensor(P0_26); char buffer[200]; void infoTask(void) { @@ -129,7 +127,6 @@ timer.start(); timer2.start(); - //motor2.setVelocity(0.7); imu.setFifoReset(true); imu.setDMPEnabled(true); @@ -187,14 +184,14 @@ */ q1.decode(buffer); - debug.printf("%f, ",hallSensor.read()); + debug.printf("%f, %f ", sg1.read(),sg2.read()); debug.printf("%f, %f, %f, %f ", q1.w, q1.v.x, q1.v.y, q1.v.z); - Vector3 vector_x(1,0,0),vector_y(0,1,0),vector_z(0,0,1); + Vector3 pry=q1.getEulerAngles(); debug.printf("p: %f r: %f y: %f ",pry.x/PI*180,pry.y/PI*180,pry.z/PI*180); - debug.printf("m1: %.2f m2: %.2f ",motor1.getAngle(),motor2.getAngle()); - debug.printf("dt1: %f dt2: %f ",motor1.get_dt(),motor2.get_dt()); + // debug.printf("m1: %.2f m2: %.2f ",motor1.getAngle(),motor2.getAngle()); + //debug.printf("dt1: %f dt2: %f ",motor1.get_dt(),motor2.get_dt()); debug.printf("P: %f I: %f I: %f \r\n ",P,I,D); getCommand(); /* if(!motor1.isRunning()) {