Hi there,
I am trying to control two O drive motors with S1 boards from an Arduino Mega
They are working well in Position, Torque and Velocity mode individually however they just vibrate loads whilst moving when I try telling them a position with a desired velocity e.g
void setPosition(float position, float velocity_feedforward)
Why is this? Any help would be greatly appreciated
Many thanks!
My simple Arduino code is here below
#include <ODriveUART.h>
#include <HardwareSerial.h>
HardwareSerial& odrive1_serial = Serial1;
HardwareSerial& odrive2_serial = Serial2;
int baudrate = 19200;
ODriveUART odrive1(odrive1_serial);
ODriveUART odrive2(odrive2_serial);
void setup() {
odrive1_serial.begin(19200);
odrive2_serial.begin(19200);
Serial1.begin(19200);
Serial2.begin(19200);
Serial.println("Waiting for ODrive...");
while (odrive1.getState() == AXIS_STATE_UNDEFINED) {
delay(100);
}
Serial.println("found ODrive");
Serial.print("DC voltage: ");
Serial.println(odrive1.getParameterAsFloat("vbus_voltage"));
Serial.println("Enabling closed loop control...");
while (odrive1.getState() != AXIS_STATE_CLOSED_LOOP_CONTROL) {
odrive1.clearErrors();
odrive1.setState(AXIS_STATE_CLOSED_LOOP_CONTROL);
delay(10);
}
Serial.print("DC voltage: ");
Serial.println(odrive1.getParameterAsFloat("vbus_voltage"));
Serial.println("Enabling closed loop control...");
while (odrive2.getState() != AXIS_STATE_CLOSED_LOOP_CONTROL) {
odrive2.clearErrors();
odrive2.setState(AXIS_STATE_CLOSED_LOOP_CONTROL);
delay(10);
}
Serial.println("ODrive running!");
}
void loop() {
odrive1.setPosition(20, 5);
}