Shop OBEX P1 Docs P2 Docs Learn Events
How to make S2 robot move extremely straight — Parallax Forums

How to make S2 robot move extremely straight

william chanwilliam chan Posts: 1,326
edited 2011-03-25 10:18 in Robotics
Hi,

I tried to move S2 over long distances, about 75 feet on thin carpet using the command

s2.set_speed(15)
s2.go_Forward(35000)

but I noticed that over long distances, there is a definite lean to one side.
For about 75 feet movement, the error from the straight line target would be about 12 to 20 inches.
What is the reason for this small error?
Could it be that the wheel encoder missed a few pulses at this speed?
Is it due to the free-play wobble on the wheels?
Is there a way to auto-correct the straightness if the propeller detects that the left and right encoder total pulses are not equal?

Comments

  • Martin_HMartin_H Posts: 4,051
    edited 2011-03-25 05:12
    Is it always the same side, or does it vary?

    I don't own an S2, so I am answering using general principals. I would guess the shaft encoders and propeller are all working fine, and the error is introduced through wheel slip. So ramping the motors may help a bit, as well as going a bit slower.

    According to Phil's wheel encoder document as you alternately pulse the right and left motors, the robot tends to slowly creep in the opposite direction of the motor first pulsed. So this might be due to that effect. You might consider measuring the error and every ten feet or so introducing a small error correction step.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-03-25 06:31
    William,

    "Could it be that the wheel encoder missed a few pulses at this speed?" No.

    "Is it due to the free-play wobble on the wheels?" Possibly.

    "Is there a way to auto-correct the straightness if the propeller detects that the left and right encoder total pulses are not equal?" It does that now. That's how the motor/encoder software works. If you pick up the S2 with both wheels turning, and hold one wheel to slow it down, the other one will slow down, too.

    That small a deviation could also be caused by a minute difference in wheel size or the fact that you're running on carpet instead of a hard, flat surface. Or you may simply not be pointing it as straight as you think. To check the wheel size hypothesis, swap the wheels and see if it deviates the other way.

    -Phil

    BTW, the document Martin refers to is for the BOE Bot wheel encoders. The S2 wheel encoders are slightly different in this regard.
  • Martin_HMartin_H Posts: 4,051
    edited 2011-03-25 06:52
    Phil, I assumed from the document that the sidewards creep was a general problem. Is this only a problem with pulsing servos? Does the S2 avoid this problem?
  • william chanwilliam chan Posts: 1,326
    edited 2011-03-25 07:25
    I did notice that the free play wobble on one wheel is more than the other wheel.
    I then opened the case to try to adjust or tighten the amount of free play but it made no difference.
    One side still has definitively more free play than the other.
    Is it possible to add washers to reduce the free play?
  • Martin_HMartin_H Posts: 4,051
    edited 2011-03-25 08:51
    I would first follow Phil's suggestion and swap the wheels and see if the robot veers the other direction.
  • ercoerco Posts: 20,256
    edited 2011-03-25 10:18
    A straight-line "lean" is probably an initial aiming problem. A constant curve is something else. Different wheel diameters (plastic wheel or O-ring, or how deep the O-ring sits in the groove) could explain a curve discrepency.

    The wheel wobble issue is just manufacturing tolerances. I improved my blue Scribbler's wobble by CAREFULLY using thick gap-filling superglue and accelerator to build up material inside the square hole on the hub and eliminate play while keeping the wheel true. The superglue won't stick to the nylon/delrin square motor shaft, but it will stick to the ABS hub. You must constantly check the wheel trueness as you methodically build up the material a bit at a time ro achieve a tight but removeable press fit.
Sign In or Register to comment.