Shop OBEX P1 Docs P2 Docs Learn Events
Configuring wheel motions (CW, CCW) — Parallax Forums

Configuring wheel motions (CW, CCW)

coldmolassescoldmolasses Posts: 3
edited 2014-05-12 15:41 in Robotics
Hey guys,
Started with building the Boe-Bot today. I have already center the motors and have made it to the testing stage. I have encountered a problem.

My RIGHT wheel works fine. It will spin clockwise, stop and then reverse counter clockwise.

However, my LEFT wheel spins counter clockwise first, then clock wise.

To my knowledge I do not have the motor installed "upside down" because the wires are both coming from the bottom of the motors before entering through the rubber grommet. Any help on what I could be doing wrong?

Thanks,
Chris

Comments

  • kwinnkwinn Posts: 8,697
    edited 2014-05-10 18:03
    That's because they are mounted on opposite sides of the robot. When viewed in relation to how they are mounted on the robot one wheel has to go CW and the other CCW to make the robot go straight. If they both rotated CW or CCW the robot would turn in place.
  • ElectrodudeElectrodude Posts: 1,646
    edited 2014-05-10 18:17
    Installing the motor upside down wouldn't change anything - that would just rotate it
  • coldmolassescoldmolasses Posts: 3
    edited 2014-05-11 07:27
    kwinn wrote: »
    That's because they are mounted on opposite sides of the robot. When viewed in relation to how they are mounted on the robot one wheel has to go CW and the other CCW to make the robot go straight. If they both rotated CW or CCW the robot would turn in place.
    Oh okay, so then what is happening is supposed to happen?
  • ercoerco Posts: 20,256
    edited 2014-05-11 07:52
    Yes, and welcome to the forums, coldmolasses. Going straight forward or back will require sending two different PULSOUT numbers to the servos, such as 500/1000 or 900/600 using a BS2. It seems odd at first, but you get used to it pretty quickly. Standard fare for new roboticists.

    I have modified a few servos by reversing the two motor wires to make them operate in reverse. Using one of those with a standard servo will make the bot respond more intuitively with the same numbers (ie, 500/500 or 900/900 to drive straight). Arguably better, but then you have a non-standard servo. You can't swap & share code with other people without modifying your code.
  • kwinnkwinn Posts: 8,697
    edited 2014-05-11 14:31
    I'm surprised that no one has come up with a snippet of code that takes commands like 500/500 or 900/900 and applies correction factors to straighten and invert the direction before passing it on to the servos.
    erco wrote: »
    Yes, and welcome to the forums, coldmolasses. Going straight forward or back will require sending two different PULSOUT numbers to the servos, such as 500/1000 or 900/600 using a BS2. It seems odd at first, but you get used to it pretty quickly. Standard fare for new roboticists.

    I have modified a few servos by reversing the two motor wires to make them operate in reverse. Using one of those with a standard servo will make the bot respond more intuitively with the same numbers (ie, 500/500 or 900/900 to drive straight). Arguably better, but then you have a non-standard servo. You can't swap & share code with other people without modifying your code.
  • ercoerco Posts: 20,256
    edited 2014-05-11 21:41
    kwinn wrote: »
    I'm surprised that no one has come up with a snippet of code that takes commands like 500/500 or 900/900 and applies correction factors to straighten and invert the direction before passing it on to the servos.

    Simple enough to do in a subroutine, certainly, if you want to adjust numbers on the fly. With only 2K of memory in a BS2, efficient code crunching is the name of the game. I prefer to experimentally determine the numbers for any given pair of servos and hard code them into the program for navigation routines.
  • GordonMcCombGordonMcComb Posts: 3,366
    edited 2014-05-12 07:49
    kwinn wrote: »
    I'm surprised that no one has come up with a snippet of code that takes commands like 500/500 or 900/900 and applies correction factors to straighten and invert the direction before passing it on to the servos.

    But that wouldn't teach you what is supposed to be happening, just provide a further disconnect to understanding how robots work.

    The issue is a simple one, and all vehicles, including cars, with wheels on both sides work the same way. When a wheel turns clockwise, the one on the other side turns opposite. It's just not something we think about until we need to. And for beginning robotics, we need to.
  • coldmolassescoldmolasses Posts: 3
    edited 2014-05-12 15:41
    Great! Thanks everyone for your help. Look forward to reading the forums and (most likely) asking more questions. Thanks again :)
Sign In or Register to comment.