Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 30:18724a8fb2bf, committed 2013-11-24
- Comitter:
- calamaridudeman
- Date:
- Sun Nov 24 19:52:28 2013 +0000
- Parent:
- 29:33c5c61f1068
- Child:
- 31:d079a9d70407
- Commit message:
- encoders are at least all reporting correctly. Kangaroo now houses the kangaroo class, leaves room in dynamics for inverse kinematics etc.
Changed in this revision
--- a/Master.cpp Sun Nov 24 19:21:47 2013 +0000
+++ b/Master.cpp Sun Nov 24 19:52:28 2013 +0000
@@ -10,8 +10,8 @@
Motor m1(p15,p17,p18,p21,mEnc1);//hip
Motor m2(p16,p19,p20,p22,mEnc2);//knee
-QEI bEnc1(p27, p28, p29, 1200, QEI::X4_ENCODING);//change pins!!!!!!!!!!!!!!!!!!!!!!!
-QEI bEnc2(p8, p9, p10, 1200, QEI::X4_ENCODING);//these too
+QEI bEnc1(p27, p28, p29, 1200, QEI::X4_ENCODING); //track
+QEI bEnc2(p8, p9, p10, 1200, QEI::X4_ENCODING); //body
Kangaroo kankan(m1,m2,bEnc1,bEnc2);
@@ -21,4 +21,7 @@
kankan.testEncoders(pc);
wait(.25);
}
+
+
+ //kankan.zero();
}
--- a/Master.hpp Sun Nov 24 19:21:47 2013 +0000 +++ b/Master.hpp Sun Nov 24 19:52:28 2013 +0000 @@ -4,6 +4,7 @@ #include "include/geom.hpp" #include "include/motor.hpp" #include "include/dynamics.hpp" +#include "include/kangaroo.hpp" #ifndef MASTER_HPP #define MASTER_HPP
--- a/include/dynamics.hpp Sun Nov 24 19:21:47 2013 +0000
+++ b/include/dynamics.hpp Sun Nov 24 19:52:28 2013 +0000
@@ -11,22 +11,5 @@
#define l3 1 //leg length
#define l4 1 //foot length
-class Kangaroo {
-
- public:
- Kangaroo(Motor &M1, Motor &M2, QEI &e1, QEI &e2);
- void zero();
- void start();
- void run();
- void stop();
- void updatePose();
- void testEncoders(Serial &pc);
-
- private:
- QEI& enc1;
- QEI& enc2;
- Motor& m1;
- Motor& m2;
-};
#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/include/kangaroo.hpp Sun Nov 24 19:52:28 2013 +0000
@@ -0,0 +1,29 @@
+#include "mbed.h"
+#include "include/dynamics.hpp"
+#include "include/motor.hpp"
+
+#ifndef KANGAROO_HPP
+#define KANGAROO_HPP
+
+
+class Kangaroo {
+
+ public:
+ Kangaroo(Motor &M1, Motor &M2, QEI &e1, QEI &e2);
+ void zero();
+ void start();
+ void run();
+ void stop();
+ void updatePose();
+ void testEncoders(Serial &pc);
+
+ private:
+ QEI& enc1;
+ QEI& enc2;
+ Motor& m1;
+ Motor& m2;
+
+ DigitalOut led1, led2, led3, led4;
+};
+
+#endif
\ No newline at end of file
--- a/src/dynamics.cpp Sun Nov 24 19:21:47 2013 +0000
+++ b/src/dynamics.cpp Sun Nov 24 19:52:28 2013 +0000
@@ -1,35 +1,3 @@
#include "mbed.h"
#include "include/dynamics.hpp"
-#include "include/motor.hpp"
-Kangaroo::Kangaroo(Motor &M1, Motor &M2, QEI &e1, QEI &e2):enc1(e1),enc2(e2),m1(M1),m2(M2){
-
-}
-
-void Kangaroo::zero(){
- m1.setVel(-.002);//wait for the legs to go to stopping points
- m2.setVel(-.002);
- wait(1);
-
- m1.zero();
- m2.zero();
-
- enc1.reset();
- enc2.reset();
-
- while((enc1.getRevolutions()==0)&&(enc2.getRevolutions()==0)){
- wait(0.1);
- }
-
-
-}
-
-void Kangaroo::testEncoders(Serial &pc){
- //pc.printf("hello world\n");
-
- //pc.printf("motor1: %i\n",m1.getPos());
- pc.printf("clix1: %i, rots1: %i\n",enc1.getPulses(), enc1.getRevolutions());
-
- //pc.printf("motor2: %i\n",);
- pc.printf("clix2: %i, rots2: %i\n",enc2.getPulses(), enc2.getRevolutions());
-}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/kangaroo.cpp Sun Nov 24 19:52:28 2013 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "include/kangaroo.hpp"
+
+
+Kangaroo::Kangaroo(Motor &M1, Motor &M2, QEI &e1, QEI &e2):enc1(e1),enc2(e2),m1(M1),m2(M2),led1(LED1),led2(LED2),led3(LED3),led4(LED4){
+
+}
+
+void Kangaroo::zero(){
+ m1.setVel(-.002);//wait for the legs to go to stopping points
+ m2.setVel(-.002);
+ led4=1;
+ wait(1);
+
+ m1.zero();
+ m2.zero();
+
+ enc1.reset();
+ enc2.reset();
+ led2=1;
+ while(((enc1.getRevolutions()==0)||(enc2.getRevolutions()==0))){
+ wait(0.1);
+ }
+
+ led1=1;
+ led3=1;
+
+}
+
+void Kangaroo::testEncoders(Serial &pc){
+ //pc.printf("hello world\n");
+
+ //pc.printf("motor1: %i\n",m1.getPos());
+ pc.printf("clix1: %i, rots1: %i\n",enc1.getPulses(), enc1.getRevolutions());
+
+ //pc.printf("motor2: %i\n",);
+ pc.printf("clix2: %i, rots2: %i\n",enc2.getPulses(), enc2.getRevolutions());
+}
\ No newline at end of file
