Skip to content

Commit 866e898

Browse files
committed
moved kinematics.h, added drive command
1 parent b3c8cbe commit 866e898

File tree

5 files changed

+33
-1
lines changed

5 files changed

+33
-1
lines changed

examples/kinematics/kinematics.ino

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include "Arduino_Alvik_Firmware.h"
2+
3+
Arduino_Alvik_Firmware alvik;
4+
5+
void setup() {
6+
alvik.begin();
7+
}
8+
9+
void loop() {
10+
alvik.drive(1,1);
11+
12+
}

src/Arduino_Alvik_Firmware.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ Arduino_Alvik_Firmware::Arduino_Alvik_Firmware(){
7171
version_high = VERSION_BYTE_HIGH;
7272
version_mid = VERSION_BYTE_MID;
7373
version_low = VERSION_BYTE_LOW;
74+
75+
// kinematics
76+
kinematics = new Kinematics(WHEEL_TRACK_MM,WHEEL_DIAMETER_MM);
77+
7478
}
7579

7680
int Arduino_Alvik_Firmware::begin(){
@@ -599,4 +603,9 @@ void Arduino_Alvik_Firmware::errorLed(const int error_code){
599603
}
600604
delay(5000);
601605
}
602-
}
606+
}
607+
608+
609+
void Arduino_Alvik_Firmware::drive(const float linear, const float angular){
610+
kinematics->forward(linear, angular);
611+
}

src/Arduino_Alvik_Firmware.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
#include "AT42QT2120.h"
3333
#include "LSM6DSOSensor.h"
3434
#include "motion_fx.h"
35+
#include "./robotics/kinematics.h"
36+
3537

3638

3739
class Arduino_Alvik_Firmware{
@@ -73,6 +75,8 @@ class Arduino_Alvik_Firmware{
7375
uint8_t version_mid;
7476
uint8_t version_low;
7577

78+
Kinematics * kinematics;
79+
7680

7781
public:
7882

@@ -196,6 +200,8 @@ class Arduino_Alvik_Firmware{
196200
void errorLed(const int error_code); // error routine, locks on code blinking led
197201

198202

203+
// Kinematics
204+
void drive(const float linear, const float angular);
199205

200206

201207

src/definitions/robot_definitions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,9 @@ const float MOTION_FX_PERIOD = (1000U / MOTION_FX_FREQ);
5757
#define VERSION_BYTE_MID 0
5858
#define VERSION_BYTE_LOW 6
5959

60+
61+
62+
#define WHEEL_TRACK_MM 89
63+
#define WHEEL_DIAMETER_MM 34
64+
6065
#endif
File renamed without changes.

0 commit comments

Comments
 (0)