aboutsummaryrefslogtreecommitdiff
path: root/zumo/zumo.ino
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-05-14 14:05:03 +0200
committerlonkaars <loek@pipeframe.xyz>2023-05-14 14:05:03 +0200
commit6472b77eb6582e5133a28f61a448eb6a00cd25b6 (patch)
tree43a9009b311373171ba0fabb4b2a0466f0ff6ea5 /zumo/zumo.ino
parent7b76b2c73d53a2ed31e3c887926f44dd02de44d2 (diff)
initial robot driver code
Diffstat (limited to 'zumo/zumo.ino')
-rw-r--r--zumo/zumo.ino31
1 files changed, 31 insertions, 0 deletions
diff --git a/zumo/zumo.ino b/zumo/zumo.ino
new file mode 100644
index 0000000..ed63f6e
--- /dev/null
+++ b/zumo/zumo.ino
@@ -0,0 +1,31 @@
+#include <Zumo32U4.h>
+#include <Arduino.h>
+#include <Wire.h>
+
+#include "protocol.h"
+
+dui_state_t g_dui_target_state = {
+ .steer = 1.0f,
+ .speed = 1.0f,
+ .current_sign = DUI_SIGN_NONE,
+ .speed_mod =96.0,
+};
+dui_state_t g_dui_current_state = {
+ .steer = 0,
+ .speed = 0,
+ .current_sign = DUI_SIGN_NONE,
+ .speed_mod = 1.0,
+};
+
+void setup() {
+}
+
+void loop() {
+ unsigned char cmd = 0;
+ while ((cmd = uart_read()))
+ handle_cmd(cmd, &g_dui_target_state);
+
+ //TODO: PID controllers + sign handlers
+
+ apply_state(&g_dui_target_state);
+}