Hello everyone,
I am trying to make a turn. I am using Arduino for control. First I read the motor position and then make the turn. If the number returned by odrive.Getposition is less than 1 it works fine but if it is greater than 1 it does not work. I have seen people use the cos function to make the number between 0 and 1, but the problem with that is that it makes a jump from the initial position to the cos position. Any ideas to solve the problem?
If you need more information let me know.
Thanks in advance
// Sinusoidal test move
if (c == 's') {
Serial.println("Executing test move");
float pos_motor;
float pos_motor_ini;
pos_motor = odrive.GetPosition(0);
pos_motor_inicial = odrive.GetPosition(0);
Serial.println(pos_motor);
for ( pos_motor; pos_motor < 1.0f + pos_motor_inicial; pos_motor += 0.005f) {
float pos_m0 = cos(pos_motor);
Serial.print(pos_motor);
Serial.print("--");
Serial.print(pos_m0);
Serial.println("*******");
odrive.SetPosition(pos_motor_ini, pos_m0);
delay(5);
}
}