Skip to content

Commit

Permalink
added uwb_timer
Browse files Browse the repository at this point in the history
  • Loading branch information
WoozyDragon committed Oct 25, 2023
1 parent 1376c05 commit a518d02
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lunabot_embedded/firmware/teensy_main/teensy_main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
#include <robot.hpp>
#include <stdio.h>

#define TX_PERIOD 10 // ms
#define ENC_TRANSFER_PERIOD 1000 // microsec
#define CURR_UPDATE_PERIOD 8 // ms
#define TX_PERIOD 10 // ms
#define ENC_TRANSFER_PERIOD 1000 // microsec
#define UWB_TRANSFER_PERIOD 10'000 // microsec
#define CURR_UPDATE_PERIOD 8 // ms

RobotState state = RobotState_init_zero;
RobotEffort effort = RobotEffort_init_zero;
Expand Down Expand Up @@ -49,13 +50,15 @@ void send() {
pb_encode(&stream, RobotState_fields, &state);
}
IntervalTimer enc_timer;
IntervalTimer uwb_timer;

void setup() {
STMotorInterface::init_serial(ST_SERIAL, ST_BAUD_RATE);
CurrentSensorBus::init_ads1115();
EncoderBus::init();

enc_timer.begin(EncoderBus::transfer, ENC_TRANSFER_PERIOD);
uwb_timer.begin(UWBBus::transfer, UWB_TRANSFER_PERIOD);

// disable timeout
MC1.setTimeout(0);
Expand Down

0 comments on commit a518d02

Please sign in to comment.