PDA

View Full Version : go staight using BS2px



qiuqiuaaa
01-04-2012, 06:15 AM
I am using BS2px, and I want it to go straight. I found a strange problem.
My program is as below:

' {$STAMP BS2px}
' {$PBASIC 2.0}
counter VAR Word
FOR counter = 1 TO 244
PULSOUT 12,650
PULSOUT 13,850
NEXT

It turns right, but I think it must be straight in BS2. I also tried 650,750,850 for each wheel, and none of them works, always rotates. I am confused .
Thanks.

erco
01-04-2012, 06:52 AM
We're talking about a BoeBot?

Did you adjust both of your servos to stop at 750? That's the first step. Then you have to realize that it will never go perfectly straight since the servos are slightly different. You can adjust by manually slowing one down like 660,850. The BoeBot wheel encoder kit can help make it go straighter, FYI.

Please clarify what you have/haven't done and what you do/don't understand for us to help you best.

Phil Pilgrim (PhiPi)
01-04-2012, 07:10 AM
qiuqiuaaa,

Welcome to the Parallax Forum!

The pulse duration for each PULSOUT increment in the BS2px is 0.8 us, compared with 2 us for the BS2. Therefore, to get the same pulse width from the BS2px as the BS2, the duration argument to PULSOUT has to be multiplied by 2 / 0.8 = 2.5. So try


PULSOUT 12,1625
PULSOUT 13,2375

instead of what you're currently using.

-Phil

erco
01-04-2012, 07:12 AM
Genious, PhiPi!

qiuqiuaaa
01-04-2012, 07:34 AM
Wow, it works! Thank you so much.


qiuqiuaaa,

Welcome to the Parallax Forum!

The pulse duration for each PULSOUT increment in the BS2px is 0.8 us, compared with 2 us for the BS2. Therefore, to get the same pulse width from the BS2px as the BS2, the duration argument to PULSOUT has to be multiplied by 2 / 0.8 = 2.5. So try

PULSOUT 12,1625
PULSOUT 13,2375

instead of what you're currently using.

-Phil