Why isn't my robot driving in a straight line and turning how much I want it to?

I programmed my robot to move forward 10 inches then turn 90 degrees to the left, but it is not moving in a straight line and turning more than 90 degrees. Can anyone help me with this problem?

Can you post the code? I don’t think new users can upload to vex forum directly, so try sharing it on google drive.

Make sure that the inserts in the wheel are not a circle. That can cause drive shafts not to turn that well with the wheel causing one wheel to start later.

I’m new to vex, so I’m using vex blocks.

What are the values of the velocity for the motors at?
It sound’s like the velocity of your motors might be different.

They are both at the normal 50%.

for the turn 90 degrees, if you code it to go exactly to go 90 degrees, it might overshoot and go farther than targeted.
for going forward, if using omni wheels, you may want to consider the following code as a function:

void gyrocorrection(int time){
repeat(1000){
repeatUntil(gettimervalue(t1)<time){
if(getgyrodegrees(gyrosensor)>3){
setmotor(left,50);
setmotor(right,30);
}
if(getgyrodegrees(gyrosensor)<-3){
setmotor(left,30);
setmotor(right,50);
}
}
}
this code helps correct the path of your robot, but you need a gyro for it.
MAKE SURE TO PUT IT ON THE ABSOLUTE CENTER OF YOUR ROBOT :grin: :wink:

1 Like

Thank you so much! I will buy the inertial sensor.

you don’t actually need to put the gyro on the center of your bot. you can put it anywhere, just try to isolate it from vibrations, so up high away from your drive.

2 Likes

you do, because the robot always turns around the center of weight.

nope. the inertial sensor/gyroscope isn’t effected by where you place it in relation to your turning point. I forget exactly why, but it has something to do with the sensor measuring rotational velocity or something.

1 Like

I have the EDR starter kit. Just curious, if the inertial sensor/gyro is necessary for the movement accuracy, why is it not included in the kit? I have to buy it separately. :frowning:

It’s not strictly necessary. Don’t believe everything you read on the Internet; there’s no expertise requirement to post on these forums.

As for why you’re having this problem, it’s hard to say. None of us have seen your robot or code, so people have been making guesses. The problem could be nearly anything with the information available so far.

3 Likes

My team has experienced several “robots that, when drive motors are given equal spin velocity values and start at the same time, but do not drive straight”. Sometimes they were not able to determine the root cause. Other times it was:

  • Frame out of alignment/ frame not square
  • Wheel axle bent
  • Wheel rubbing part of the robot
  • Wheel axle slipping out of motor
  • Suspected one motor was weaker than the other

We have also determined that a human operator using the joystick to drive a robot is not a valid test of whether the robot drives straight. The operator tends to use visual cues to subtly straighten out an errant robot. Instead, we program a button to make the robot go forward some fixed distance and then we measure the drift. We have never achieved a robot that drives perfectly straight reliably over a 4 foot travel. We typically assume 1 inch drift per 2 feet travel is “good enough”.

I find newcomers to robotics associate “robotics” with “precise” and “exact”. This is not the case. There are build quality factors and other physical limitations. Overcoming these is “Engineering”!

7 Likes

i don’t know. im a vex iq person, but i do more advanced robots and coding than most competitors(not to brag).

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