Browse Source

Cleanup comments and more

master
Lukas Bachschwell 1 year ago
parent
commit
d21a52d6b2
2 changed files with 17 additions and 33 deletions
  1. 15
    32
      src/LARS.cpp
  2. 2
    1
      src/LARS.h

+ 15
- 32
src/LARS.cpp View File

@@ -16,40 +16,23 @@
16 16
 */
17 17
 
18 18
 
19
-LARS::LARS(int FRH, int FLH, int BRH, int BLH, int FRL, int FLL, int BRL, int BLL): reverse{0, 0, 0, 0, 0, 0, 0, 0}, trim{0, 0, 0, 0, 0, 0, 0, 0} {
20
-  board_pins[FRONT_RIGHT_HIP] = FRH; // front right inner
21
-	board_pins[FRONT_LEFT_HIP] = FLH; // front left inner
22
-	board_pins[BACK_RIGHT_HIP] = BRH; // back right inner
23
-	board_pins[BACK_LEFT_HIP] = BLH; // back left inner
24
-	board_pins[FRONT_RIGHT_LEG] = FRL; // front right outer
25
-	board_pins[FRONT_LEFT_LEG] = FLL; //  front left outer       // POSITIONS LOOKING FROM THE MIDDLE OF THE ROBOT!!!!!
26
-	board_pins[BACK_RIGHT_LEG] = BRL; // back right outer
27
-	board_pins[BACK_LEFT_LEG] = BLL; // back left outer
19
+LARS::LARS(): reverse{0, 0, 0, 0, 0, 0, 0, 0}, trim{0, 0, 0, 0, 0, 0, 0, 0} {
20
+}
21
+
22
+void LARS::init(){
23
+  init(26, 25, 17, 16, 27, 5, 23, 13); // Calling init with default values
28 24
 }
29 25
 
30
-void LARS::init() {
31
-  /*
32
-     trim[] for calibrating servo deviation,
33
-     initial posture (home) should like below
34
-     in symmetric
35
-        \       /
36
-         \_____/
37
-         |     |
38
-         |_____|
39
-         /     \
40
-        /       \
41
-  */
42
-  /*
43
-    trim[FRONT_LEFT_HIP] = 0;
44
-    trim[FRONT_RIGHT_HIP] = -8;
45
-    trim[BACK_LEFT_HIP] = 8;
46
-    trim[BACK_RIGHT_HIP] = 5;
47
-
48
-    trim[FRONT_LEFT_LEG] = 2;
49
-    trim[FRONT_RIGHT_LEG] = -6;
50
-    trim[BACK_LEFT_LEG] = 6;
51
-    trim[BACK_RIGHT_LEG] = 5;
52
-  */
26
+void LARS::init(int FRH, int FLH, int BRH, int BLH, int FRL, int FLL, int BRL, int BLL) {
27
+
28
+  board_pins[FRONT_RIGHT_HIP] = FRH; // front right inner
29
+  board_pins[FRONT_LEFT_HIP] = FLH; // front left inner
30
+  board_pins[BACK_RIGHT_HIP] = BRH; // back right inner
31
+  board_pins[BACK_LEFT_HIP] = BLH; // back left inner
32
+  board_pins[FRONT_RIGHT_LEG] = FRL; // front right outer
33
+  board_pins[FRONT_LEFT_LEG] = FLL; //  front left outer       // POSITIONS LOOKING FROM THE MIDDLE OF THE ROBOT!!!!!
34
+  board_pins[BACK_RIGHT_LEG] = BRL; // back right outer
35
+  board_pins[BACK_LEFT_LEG] = BLL; // back left outer
53 36
 
54 37
   for (int i = 0; i < 8; i++) {
55 38
     oscillator[i].start();

+ 2
- 1
src/LARS.h View File

@@ -24,8 +24,9 @@
24 24
 class LARS {
25 25
 
26 26
   public:
27
-    LARS(int FRH = 26, int FLH = 25, int BRH = 17, int BLH = 16, int FRL = 27, int FLL = 5, int BRL = 23, int BLL = 13);
27
+    LARS();
28 28
     void init();
29
+    void init(int FRH = 26, int FLH = 25, int BRH = 17, int BLH = 16, int FRL = 27, int FLL = 5, int BRL = 23, int BLL = 13);
29 30
     void walk(int dir = 1, float steps = 1, float T = 800); // T initial 400
30 31
     void omniWalk(float steps, float T, bool side, float turn_factor);
31 32
     void turnL(float steps, float period);

Loading…
Cancel
Save