Help coding 4WD omni robot arduino

Hello, i bought this 4WD omni wheel robot, i succeded rotating the robot.
I want to add a function with input the direction (radians or degrees) and the the robot can move to this direction. Can someone help me for coding ?

Rotation function that works :

void rotation () {

  analogWrite(PWM1,200);
  digitalWrite(IN1,HIGH);
  analogWrite(PWM2,200);
  digitalWrite(IN2,HIGH);
  analogWrite(PWM3,200);
  digitalWrite(IN3,HIGH);
  analogWrite(PWM4,200);
  digitalWrite(IN4,HIGH);   

}

Welcome to the forum

How will the sketch detect that the robot has moved through the required angle ? You cannot rely on time because the motors will run at different speeds as the voltage changes over time.

You also need some common calibration point so each motor knows when it’s pointing to ‘north’ or ‘up’ etc,
otherwise you’ll be in a pickle.

I will add an IMU. I just need the first move to a directin. I can move the robot to 0°, 90%, 180° and 270°. But i don't know how to move to a specific direction.
I found this equation but didn't work.

image

If it is omni directional, there is never a need to turn or rotate.... just "go that way."

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.