Shop OBEX P1 Docs P2 Docs Learn Events
Spin-Juke_Bot — Parallax Forums

Spin-Juke_Bot

I have assembled Spin-Juke- bot using .Actvity Bot with Parallax 360 servos hoping it would work as the activity
board is very similer and uses the same pins for 1. The servos
2.sound
3.SD card
I changed the pins for the XBee - the two XBees receive and transit Data - no issue.
The Activity-Bot moves very erratically - Not compatible with the 360 servos
The sound does not play at all - SD card, and VHO speaker connected to the identical pins.I downloaded some
wav files using "audacity" to the micro-SD card and they play well.

This project was put together by Andy Lindsey and posted in the parallax spin tutorials.
I have also attached the files that I have modified for my activity bot.

I would like some help to achieve my goal of working and singing bot.

I hope some body would help me with this.

Siri


Comments

  • I got the sound to work now what want to get activity bot 360 wheels to work.

    I hope Andyt Lindsey will chime.

    Siri
  • msiriwardena,

    Erratic servo behavior is usually caused by weak batteries so check your battery voltages.
  • That project uses the regular continuous rotation servos, not the 360 servos. The spin object in that project does not work with the 360 servos.

    Tom Crawford developed a spin driver for the 360 servos. At the end he had a driver that worked for driving a robot. (I used his spin examples and his PASM driver to make SimpleIDE C functions to drive my activitybot with the 360 servos. His work starts here and goes through page 7 of that thread.

    https://forums.parallax.com/discussion/comment/1422301/#Comment_1422301

    It should be possible to take Tom's Spin + PASM code and replace the regular continuous servo spin object.

    Hope this helps
    Tom M.

  • msiriwardena,

    https://www.parallax.com/sites/default/files/downloads/900-00360-Feedback-360-HS-Servo-v1.2.pdf
    The abdrive360 library uses the same functions as the original abdrive library, so example programs that run on an ActivityBot robot using abdrive will also run using these Feedback 360° servos.
    

    Also note that under specifications the servo needs 1200 mA or 1.2 Amps when stalled.
  • Genetix wrote: »
    msiriwardena,

    https://www.parallax.com/sites/default/files/downloads/900-00360-Feedback-360-HS-Servo-v1.2.pdf
    The abdrive360 library uses the same functions as the original abdrive library, so example programs that run on an ActivityBot robot using abdrive will also run using these Feedback 360° servos.
    

    Also note that under specifications the servo needs 1200 mA or 1.2 Amps when stalled.

    That is when using the SimpleIDE C libraries. There are 2 primary library folders for the ABOTs: ActivityBot and ActivityBot360. Within the libraries the function names are the same so the only thing that needs to be changed when programming for either is to "include" the correct .h library. For example:
    #include "simpletools.h"                      // Libraries included
    #include "sirc.h"
    #include "abdrive360.h"                          // abdrive library
    #include "servo.h"                // for gripper 
    

    However, the OP is using Spin, and I have not been able to find any servo360 objects except for Tom Crawford's which worked when I tried it.

    Tom
  • @ Tom.M - I have downloaded Tom Crawford's 360 driver and I will start
    working on it.

    @Genrtix - I am using spin. Thanks for the response.

    Thanks for the Help

    Siri
  • @ Tom M
    You were right it was a call for a method and I got confused with a call for an Object.
    I will play with the driver and see how it goes.

    Thanks for your help.

    Siri
  • @ Tom M
    .
    I will play with the driver and see how it goes.

    Thanks for your help.

    Siri

    Glad to help however I can, if you need any explanation of how to use the driver methods.
  • @tomcrawford
    I am working with your 360 servo driver, I ran your Demo and it runs a while and then it stops and will not complete
    the whole Demo.

    I have attached a screen shot to show you exactly stops and would not continue any further.

    It would be great help if you would fix the Demo.

    Thank you

    Siri
    1920 x 1080 - 672K
  • How many feedback servos do you have connected and did you define the CPx and FPx for each non-existent servo as zero?

    The program will definitely hang if it attempts to program a servo that isn't there.
  • @tomcrawford

    I only have 2 servos and I have and I think I have CPx and FPx correct.

    I have attached the complete program for your review.

    Thank you for your prompt reply.

    Siri
  • tomcrawfordtomcrawford Posts: 1,126
    edited 2019-02-10 17:16
    Okay, your CPx and FPx are just fine and since the constant pw is working, I believe you have everything wired correctly.

    Here is where the program gets stuck:
    repeat angle from 0 to 3              'four cases
          commanded := lookupz(angle: 180, 0, 359, 0)
          pst.char(" ")
          pst.str(string("Cmnd: "))
          pst.dec(Commanded)                           'show commanded angle
          FBS.SetPos(theservo, Commanded)              'set it
          waitcnt(clkfreq/100+cnt)
          repeat while FBS.CheckDone(theservo) <> 0    'await completion   <---  it thinks it never completes the move to 180 deg.
                  insert here:   pst.char("*")
          pst.str(string("  Final: "))
          pst.dec(FBS.GetPos(theServo))
          pst.str(string("   "))
    

    To prove you are getting stuck where I think you are, insert a command to print something while it is waiting for the command to complete. Should get a string of ******* If that IS the problem, you can adjust DeltaMin(decrease increase) and/or MaxError (increase).

    Saturday night here in California, I'll look tomorrow morning for feedback. I'm pretty sure we can get this working. :-)
  • @msiriwardena

    Sunday morning in California.

    I think you are getting caught in the dead zone (the feedback servo doesn't actually do anything until the pulse width gets a good distance from 1500 microseconds). Here is how to fix that:

    1. Make absolutely certain your activity board is jumped so that the servos are powered from Vin, not 5V. Running the servos from 5V makes the dead zone much worse.

    2. Increase DeltaMin, say to 30 or 35. This code is right at the top of the demo.
    pst.str(string("Setting the DeadZone value(s) for my specific Servo(s)"))
      pst.newline
      pst.str(string("Your values will almost certainly vary"))
      pst.newline
      pst.str(string("The default is 31"))
      pst.newline
      FBS.setDeltaMin(servo0, 24)
      if (LastServo > 0)
        FBS.setDeltaMin(servo1, 33)
    

    Let me know.
  • @tomcrawford

    I changed the power to vin from 5V and did the changes as you advised.

    Now the Demo works well

    Thank you

    Siri
  • @tomcrawford

    I am trying to set 2 servos to drive a bot forward/backward at a constant velocity.

    I have tried the SetVelocity method they hardly move so I placed a wait time then it works for the specified time.
    But I would like the wheels go forward/backwared indefinitely until directed to do
    something else, like turn right etc.

    Attached is ( spin file) what I have been my attempts.Make any changes and Delete
    redundant code etc.

    I would like some help.

    Thank you.

    Siri
  • @msiriwardena
    Looks like a good test program. But you need to end it with something that keeps the "master" cog alive. Say
      FBS.start(CP0,FP0, CP1,FP1, CP2,FP2, CP3,FP3)
          waitcnt(clkfreq/10+cnt)
    
           FBS.setDeltaMin(servo0, 40)
           FBS.setDeltaMin(servo1, 40)
          waitcnt(clkfreq/10+cnt)   
    
    
        
        Forward
       ' waitcnt(clkfreq *5+cnt)
       ' Backward
       ' waitcnt(clkfreq *5+cnt)
       ' FastForward
       ' waitcnt(clkfreq *5+cnt)
      '  FastBackward
      '  waitcnt(clkfreq *5+cnt)
       ' RightTurn
      '  waitcnt(clkfreq *5+cnt)
       ' LeftTurn
      '  waitcnt(clkfreq *5+cnt)
       ' Stop 
      '
    
         repeat            'hang here forever    <------added by tom
    
    . Otherwise spin will terminate that cog which in turn terminates the code I have running in that cog. Honestly, I don't know in detail what that would do, but it can't be good.

    Now, that added, the program should drive the robot forward forever. "Uncomment" the waitcnt and the Backward and it should drive forward for 5 seconds and then backward forever. And so on.

    Let me know.
  • @tomcrawford

    It worked as you expected.

    Thanks you

    Siri
  • Keep us posted.

    If I may ask, where are you? I am in northern California, in the foothills of Sierra Nevada.
  • @tomcrawford
    Tom, I am in Trinity Florida about 15 miles north of Tampa.
    Electronics is my hobby.

    Thanks for all your Help.

    Siri
Sign In or Register to comment.