Zur Übersicht - INFO - Neueste 50 Beiträge - Neuer Beitrag - Suchen - Zum C-Control-I-Forum - Zum C-Control-II-Forum

GO_TURN() contains bug Kategorie: Pro-Bot128 (von PepeV - 18.07.2010 16:53)
Ich nutze:
Pro-Bot128
Hi all,

The procedure GO_TURN() from the library PRO-BOT128_Lib.cbas contains a bug.
The assignment
         drive_cnt=drive_cnt+((ODO_LEFT+ODO_RIGHT)/2)
uses an integer division which takes the FLOOR value of (ODO_LEFT+ODO_RIGHT)/2.
The result is that wheel encoder ticks are missed because e.g. (5+4)/2 = 4.5 which is rounded down
to 4 by the integer division. Thus in this case 10% of the encoder ticks is missed and the bot moves
10% farther than it should.
With small values of ODO_LEFT and ODO_RIGHT, that is with low speeds of the bot, the error can be
dramatically larger. (1+0)/2 = 0.5 which is rounded down to 0 by the integer division. In this case 100%
of the encoder ticks is missed and the bot will move on for ever.

I wrote an alternative code for GO_TURN() which is much more accurate and can make bends too, but
which also requires a different SYSTEM_CNT(). Let me know if you are interested.

Regards,
Pepe


    Antwort schreiben


Antworten: