Shop OBEX P1 Docs P2 Docs Learn Events
Activity bot to tank tread conversion - won't drive! — Parallax Forums

Activity bot to tank tread conversion - won't drive!

dsomashedsomashe Posts: 21
edited 2016-11-10 18:43 in General Discussion
Hi Everyone, sorry if this has already been answered. I recently converted my activity bot to the tank with the tank tread kit. The only problem is now, when I use commands such as drive_speed and drive_goto, only one tread will spin (the right one).

I'm assuming this has to do with the fact that the optical encoders were removed (the tank tread directions say to remove the encoders).

How do I get it to drive again?

-Deepak

Comments

  • Courtney JacobsCourtney Jacobs Posts: 903
    edited 2016-11-10 17:49
    After removing encoders, you should be cautious when using commands that depend on encoder feedback. While you can use drive_speed (with some modification, see below) drive_goto will be unreliable because it depends on encoders being present and counting ticks to get you a precise distance.

    Your treads should have come with or pointed you to the Tank Tread Product Guide. The following section, last page of this document, is what you need to get going:

    ActivityBot abdrive.h library
    To “turn off” the abdrive library’s expectation of encoder feedback with a calibrated ActivityBot,
    use drive_feedback(0); at the beginning of the main routine. Then, your program may still use the functions
    drive_speed, drive_ramp, and drive_rampStep. Do not use drive_goto. Ramping into and out of high-
    speed maneuvers is recommended.
  • Thank you so much!! So I tried that and still only the right wheel will turn. I know that the left servo is working, because if I type in negative numbers for reversing, it seems to work. What gives? Thank you so much for any help you can offer, I really appreciate it!

    [code][/#include "simpletools.h"
    #include "fdserial.h"
    #include "abdrive.h"
    #include "wavplayer.h"
    #include "servo.h"
    #include "ping.h"

    int main()
    {
    drive_feedback(0);
    drive_speed(50,50);
    pause(3000);
    drive_speed(0, 0);
    pause(3000);
    }code]
  • Sorry, I tried using the code button above during my prior post but it didn't seem to take :(
    #include "simpletools.h"
    #include "fdserial.h"
    #include "abdrive.h"
    #include "wavplayer.h"
    #include "servo.h"
    #include "ping.h"
    
    int main() 
    {
    drive_feedback(0); 
    drive_speed(50,50); 
    pause(3000);
    drive_speed(0, 0);
    pause(3000);
    }
    
  • Courtney JacobsCourtney Jacobs Posts: 903
    edited 2016-11-10 19:10
    I tried your program on my unit, and it runs. There are extraneous calls to libraries you don't need, though, I would recommend removing the #includes for fdserial, wavplayer, servo, and ping to keep things tidy.

    Have you checked batteries and electrical connections? Be sure to try with fresh batteries, and double-check all connections you have made for errors. Including clear images of your robot and its wiring can also help with diagnosing an issue.

    Also, did your program run as expected with the unmodified robot?
  • kwinnkwinn Posts: 8,697
    dsomashe wrote: »
    Thank you so much!! So I tried that and still only the right wheel will turn. I know that the left servo is working, because if I type in negative numbers for reversing, it seems to work. What gives? Thank you so much for any help you can offer, I really appreciate it!

    [code][/#include "simpletools.h"
    #include "fdserial.h"
    #include "abdrive.h"
    #include "wavplayer.h"
    #include "servo.h"
    #include "ping.h"

    int main()
    {
    drive_feedback(0);
    drive_speed(50,50);
    pause(3000);
    drive_speed(0, 0);
    pause(3000);
    }code]

    If the motor will run in one direction and not the other the wiring must be ok. Perhaps the problem is in the H bridge. Try switching the motor to H bridge connections to see if the problem switches sides.
  • kwinn wrote:
    Perhaps the problem is in the H bridge.
    ActivityBot uses continuous-rotation servos, not H-bridge-driven DC motors.

    -Phil
  • ercoerco Posts: 20,256
    And HIGH SPEED CR servos at that. :)
  • Hi Courtney, thanks so much! All those additional things are from a more complex program using and xbee controller/roaming etc. I just simplified for the purposes of testing the servos.

    The program definitely worked literally right before changing to the tread system.

    I switched the servo pins to see if it was a problem with the motor or what. When switched, the opposite side now works in forward and reverse and the other side (which was previously working) only works in reverse. WTF? So weird, I cannot understand why....could the pin be bad? but then why would reverse commands work?

    -Deepak
  • kwinnkwinn Posts: 8,697
    kwinn wrote:
    Perhaps the problem is in the H bridge.
    ActivityBot uses continuous-rotation servos, not H-bridge-driven DC motors.

    -Phil

    Servos, DC motors, or whatever, switching the motor wires around will tell you whether it is a motor problem or not. Divide and conquer.
    dsomashe wrote: »
    Hi Courtney, thanks so much! All those additional things are from a more complex program using and xbee controller/roaming etc. I just simplified for the purposes of testing the servos.

    The program definitely worked literally right before changing to the tread system.

    I switched the servo pins to see if it was a problem with the motor or what. When switched, the opposite side now works in forward and reverse and the other side (which was previously working) only works in reverse. WTF? So weird, I cannot understand why....could the pin be bad? but then why would reverse commands work?

    -Deepak

    Time to look at the servo pulse width with a scope or other means. If the pulse width is not right then check the code.
  • Help!

    I recalibrated to make pin 14 and 15 the servo pins. It isn't the pins, and it isn't the servos. As far as I can tell, there is absolutely nothing wrong with the hardware or the connections, I've tried every possible combination. The code I am typing in SHOULD make the wheels move forward at a rate of 50 for 3 seconds, and then stop. INSTEAD what is happening is the right wheel will spin much much faster than the left for about 3 seconds, and then the wheels will spin at equal speeds, the right one moving in forward and the left moving in reverse. They will spin in this opposite fashion indefinitely.

    I cannot fathom what transpired during the conversion between the regular set up and the tank tread other than removing the encoders. I reiterate that the batteries are fresh and the robot was working fine before. It HAS to be something about removing the encoders or something.
    #include "simpletools.h"
    #include "abdrive.h"
    
    int main() 
    {
    drive_feedback(0);
    drive_speed(50,50); 
    pause(3000);
    drive_speed(0, 0);
    pause(3000);
    }
    
  • ercoerco Posts: 20,256
    A dollar servo tester would be worth its weight in gold right now. Grab one for next time. Better yet, get some extras for your friends. Christmas stocking stuffers for geeks!

    http://www.ebay.com/itm/112071339989
  • dsomashe wrote:
    INSTEAD what is happening is the right wheel will spin much much faster than the left for about 3 seconds, and then the wheels will spin at equal speeds, the right one moving in forward and the left moving in reverse. They will spin in this opposite fashion indefinitely.
    I think your servos need to be null adjusted. Run with just the drive_speed(0, 0); command and, with a screwdriver, adjust the screw in each one until it stops rotating.

    -Phil
  • Did you use the screwdriver to set the CR servos to stop on drive_speed(0,0)?
  • Lol how did you post that after and before me?
  • Courtney JacobsCourtney Jacobs Posts: 903
    edited 2016-11-14 16:18
    I agree with xanadu and Phil that you should try manual centering of your servos.

    Run this program:
    #include "simpletools.h"                      // Include simple tools
    #include "servo.h"
    
    int main()                                    // Main function
    {
      servo_set(12, 1500);
      servo_set(13, 1500);
    }
    

    If your servos are centered, they should not rotate at all when this program runs. If they are not centered, they will start rotating, and then you will need a small screwdriver to very gently adjust them (via the small hole in one end of the servo) until they stop.

    If you have changed the pins your servos are connected to, make sure you adjust this program to match or reconnect your servos to P12 and P13.
Sign In or Register to comment.