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.
Dependencies: EPOS2 mbed-rtos mbed
Fork of MarsRover_ExoMars by
Revision 5:524e83ec5174, committed 2016-09-29
- Comitter:
- joe_feubli
- Date:
- Thu Sep 29 10:12:24 2016 +0000
- Parent:
- 4:8fb30d6c2855
- Child:
- 6:3eaa420dc2f5
- Commit message:
- Erste Tests mit Homing
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Sep 22 07:58:15 2016 +0000
+++ b/main.cpp Thu Sep 29 10:12:24 2016 +0000
@@ -27,6 +27,12 @@
int counter_s = false;
int counter_s2 = false;
*/
+DigitalIn mySwitch1(p21);
+DigitalIn mySwitch2(p22);
+DigitalIn mySwitch3(p23);
+/*mySwitch1.mode(PullUp);
+mySwitch2.mode(PullUp);
+mySwitch3.mode(PullUp);*/
int ausfahren = false;
int einfahren = false;
int current_step = 1;
@@ -55,51 +61,75 @@
//************** Initialisierung **************//
- MyEpos1.SetPar(10,2660, 1, 3100, 2.76); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)
- MyEpos1.SetHomingPar(23, 10, 10, 0); //Set Homing Parameter (homing mode->35=Actual Position, speed, acceleration, offset)
+ /* HOMING METHODEN:
+ Homing Method 7 :Home Switch Positive Speed & Index
+ Homing Method 11:Home Switch Negative Speed & Index
+ Homing Method 23: Home Switch Positive Speed
+ Homing Method 27: Home Switch Negative Speed
+ */
+ //Motortype 10: EC-Motor
+
+ MyEpos1.SetPar(10,4430, 7, 3500, 40); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)#EINGESTELLT
+ MyEpos1.SetHomingPar(23, 100, 100, 0); //Set Homing Parameter (homing mode, speed, acceleration, offset)
MyEpos1.Reset();
- MyEpos2.SetPar(10,2660, 1, 3100, 2.76); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)
- MyEpos2.SetHomingPar(23, 10, 10, 0); //Set Homing Parameter (homing mode->35=Actual Position, speed, acceleration, offset)
+ MyEpos2.SetPar(10,4430, 7, 3500, 40); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)#EINGESTELLT
+ MyEpos2.SetHomingPar(23, 100, 100, 0); //Set Homing Parameter (homing mode, speed, acceleration, offset)
MyEpos2.Reset();
- MyEpos3.SetPar(10,2660, 1, 3100, 2.76); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)
- MyEpos3.SetHomingPar(23, 10, 10, 0); //Set Homing Parameter (homing mode->35=Actual Position, speed, acceleration, offset)
+ MyEpos3.SetPar(10,4430, 7, 3500, 40); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)#EINGESTELLT
+ MyEpos3.SetHomingPar(23, 100, 100, 0); //Set Homing Parameter (homing mode, speed, acceleration, offset) #EINGESTELLT
MyEpos3.Reset();
- MyEpos4.SetPar(10,2660, 1, 3100, 2.76); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)
- MyEpos4.SetHomingPar(23, 10, 10, 0); //Set Homing Parameter (homing mode->35=Actual Position, speed, acceleration, offset)
+ MyEpos4.SetPar(10,4430, 7, 3500, 40); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)#EINGESTELLT
+ MyEpos4.SetHomingPar(23, 100, 100, 8000); //Set Homing Parameter (homing mode, speed, acceleration, offset)#EINGESTELLT
MyEpos4.Reset();
- MyEpos5.SetPar(10,2660, 1, 3100, 2.76); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)
- MyEpos5.SetHomingPar(23, 10, 10, 0); //Set Homing Parameter (homing mode->35=Actual Position, speed, acceleration, offset)
+ MyEpos5.SetPar(10,4430, 7, 3500, 40); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)#EINGESTELLT
+ MyEpos5.SetHomingPar(27, 100, 100, 0); //Set Homing Parameter (homing mode, speed, acceleration, offset)#EINGESTELLT
MyEpos5.Reset();
- MyEpos6.SetPar(10,2660, 1, 3100, 2.76); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)
- MyEpos6.SetHomingPar(23, 10, 10, 0); //Set Homing Parameter (homing mode->35=Actual Position, speed, acceleration, offset)
+ MyEpos6.SetPar(10,3440, 1, 12000, 3.8); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)#EINGESTELLT
+ MyEpos6.SetHomingPar(11, 100, 100, -7000); //Set Homing Parameter (homing mode->35=Actual Position, speed, acceleration, offset)#EINGESTELLT
MyEpos6.Reset();
MyEpos7.SetPar(10,2660, 1, 3100, 2.76); //Set the motor parameter( Motortype, Current limit, Pole pairs, max velocity, thermal time constant winding)
- MyEpos7.SetHomingPar(23, 10, 10, 0); //Set Homing Parameter (homing mode->35=Actual Position, speed, acceleration, offset)
+ MyEpos7.SetHomingPar(23, 100, 100, 0); //Set Homing Parameter (homing mode, speed, acceleration, offset)
MyEpos7.Reset();
while(1){
switch (current_step){
case 1://HOMING:
- MyEpos1.Homing(); //Solarpanel_Aussen_Links
- MyEpos3.Homing(); //Solarpanel_Aussen_Rechts
- MyEpos7.Homing(); //Bohrer
- while (MyEpos2.GetDigIn(4)!=1 or MyEpos4.GetDigIn(4)!=1){ //warten solange Solarpanels Aussen NICHT in Grundposition
- wait(0.1);
- }
- MyEpos2.Homing(); //Solarpanel_Innen_Links
+
+ MyEpos1.Reset();
+ MyEpos2.Reset();
+ MyEpos3.Reset();
+ MyEpos4.Reset();
+ MyEpos5.Reset();
+ MyEpos6.Reset();
+ MyEpos7.Reset();
+
+// MyEpos1.Power(1);
+// MyEpos2.Power(1);
+ MyEpos3.Power(1);
+ MyEpos4.Power(1);
+ MyEpos5.Power(1);
+ MyEpos6.Power(1);
+// MyEpos7.Power(1);
+// MyEpos1.Homing(); //Solarpanel_Aussen_Links
+// MyEpos3.Homing(); //Solarpanel_Aussen_Rechts
+// MyEpos7.Homing(); //Bohrer
+// while (/*MyEpos1.GetDigIn(4)!=1 or*/ MyEpos3.GetDigIn(4)!=1){ //warten solange Solarpanels Aussen NICHT in Grundposition
+// wait(0.1);
+// }
+// MyEpos2.Homing(); //Solarpanel_Innen_Links
MyEpos4.Homing(); //Solarpanel_Innen_Rechts
- while (MyEpos7.GetDigIn(4)!=1){ //warten solange Bohrer NICHT eingefahren
+/* while (MyEpos7.GetDigIn(4)!=1){ //warten solange Bohrer NICHT eingefahren
wait(0.1);
}
MyEpos6.Homing();//Bohrgestell
- while (MyEpos1.GetDigIn(4)!=1 or MyEpos3.GetDigIn(4)!=1) { //warten solange Solarpanels Innen NICHT in Grundposition
+*/ while (/*MyEpos2.GetDigIn(4)!=1 or */MyEpos4.GetDigIn(4)!=1) { //warten solange Solarpanels Innen NICHT in Grundposition
wait(0.1);
}
MyEpos5.Homing();//Kopf
@@ -111,10 +141,11 @@
case 2://BEREIT:
- while (MyEpos6.GetDigIn(1)!=1) { //Kontrolle ob: Kopf in Grundposition
+/* while (MyEpos6.GetDigIn(1)!=1) { //warten solange Buzzer nicht gedrückt
wait_ms(10);
}
current_step = 3;//START_AUSFAHREN
+*/ current_step = 6; //Test
break;
@@ -171,7 +202,7 @@
case 5://USV:
- while (MyEpos1.GetDigIn()){
+ while (MyEpos1.GetDigIn(1)){
MyEpos1.MoveAbsolute(0,200,500,500); //Panel_Aussen_Links
MyEpos3.MoveAbsolute(0,200,500,500); //Panel_Aussen_Rechts
MyEpos7.MoveAbsolute(0,200,500,500); // Bohrer
@@ -188,7 +219,20 @@
}
break;
- case 6://ERROR2
+ case 6://Test
+ MyEpos5.Power(1);
+ wait(1);
+ MyEpos5.MoveAbsolute(-151000,200,100,100); //Kopf
+ wait_ms(10);
+ while (MyEpos5.TargetReached()!=1){
+ wait(1);
+ }
+ MyEpos5.MoveAbsolute(0,200,100,100); //Kopf
+ wait_ms(10);
+ while (MyEpos5.TargetReached()!=1){
+ wait(1);
+ }
+ current_step = 2;//Bereit
break;
}//case
}//while
