Main Site Documentation

Mini Robot can't go straight


#1

Excited with the new FEZ mini Robot, however using the simple test code to move backward and forward the robot keeps turning to the one side traveling diagonally. Even when switching the motor connectors it still pulls more to the left. I can see the LED on motor A is always ahead of motor B, it turns red while the other is still green/orange.

I’m using the sample code in FEZMini_Robot.cs

Any suggestions would be most appreciated since if it can’t go in a straight line, it’s gonna have to go back. :frowning:

Thanks,
Alistair


#2

Is one of the wheels too close to the frame?

If both are free, you can calibrate the speed in software.

Welcome to the community.


#3

Thanks for the welcome and quick response.

Both wheels are clear and move freely. I have tried doing the calibration in software, but because the one motor always starts turning before the other one, it starts out going to the left then pulls to the right to straighten up. The overall travel is then a curve. The slower the ramp the more noticable the pull.


#4

If you try to turn the wheels by hand, does one feel different?


#5

Most definately, there is certainly more play on the one axle and the wheel turns much easier.


#6

For some of the 23 FEZ Mini Robots that are used in a workshop had the same problem.
One solution is an adjustment in the driver FEZMini_Robot.cs see the code part of the adjustment.


       static public void Move(sbyte speed_left, sbyte speed_right)
        {
            if (speed_left > 100 || speed_left < -100 || speed_right > 100 || speed_right < -100)
                new ArgumentException();

            _last_speed_left = speed_left;
            _last_speed_right = speed_right;


            if (speed_left < 0)
            {
                speed_left = (sbyte)((speed_left * 0.91) - 9);
                _dir1.Write(true);
                _pwm1.Set(1000, (byte)(100 - Math.Abs(speed_left)));
            }
            else if (speed_left > 0)
            {
                speed_left = (sbyte)((speed_left * 0.80) + 20);
                _dir1.Write(false);
                _pwm1.Set(1000, (byte)speed_left);
            }
            else
            {
                _dir1.Write(false);
                _pwm1.Set(1000, (byte)0);
            }

            ////////////////////////////

            if (speed_right < 0)
            {
                speed_right = (sbyte)((speed_right * 0.80) - 20); 
                _dir2.Write(true);
                _pwm2.Set(1000, (byte)(100 - Math.Abs(speed_right)));
            }
            else if (speed_right > 0)
            {
                speed_right = (sbyte)((speed_right * 0.72) + 28);  
                _dir2.Write(false);
                _pwm2.Set(1000, (byte)speed_right);
            }
            else
            {
                _dir2.Write(false);
                _pwm2.Set(1000, (byte)0);
            }
        }

The correction factor test set up I have an e-block “Variable Resistor” connected to an analog input port and a test program with which the pot meter value for the PWM value of the motor. Determines when the PWM voltage to the motor to move.
The results “preliminary” hard coded in the driver.


#7

Do you want to try to find out what causing this?


#8

Yes, I’d love to find out what the problem is.

Currently to move forward in a straight line I use:
FEZMini_Robot.MoveRamp(95, 100, 1);

Going backward is even more off:
FEZMini_Robot.MoveRamp(-68, -100, 1);

Thanks.

(Busy playing with the new code you posted).


#9

You are right.
My robot does the same, and when visiting hinnie and the crew I noticed that every robot does that.
Basically both wheels do not move at the same speed.


#10

I had the same problem on one of the 3 robots I have and it was one of the gears that was assembled wrong, I dissasembled it, and it was a little plastic loose inside, removed it and it worked.

By moving it by hand you should feel the difference.