Shop OBEX P1 Docs P2 Docs Learn Events
Boe Bot Navigation With RC Transmitter More Servos — Parallax Forums

Boe Bot Navigation With RC Transmitter More Servos

jonathanmbjonathanmb Posts: 24
edited 2011-12-05 15:43 in Robotics
OK so I got the navigation servos to work. Before that I had made a camera mount to mount a camera on my Boe Bot. Since I no longer have any more servo jacks on my BOE I plugged the servos in the way you would on the Homework Board with an extra battery. So I modified the program I already had and added the camera servos to it. I ran the program and I still had the navigation servos but no camera servos. My current program is attached to this message. Can anyone tell me whats wrong with it?
Thanks
«1

Comments

  • W9GFOW9GFO Posts: 4,010
    edited 2011-11-28 15:22
    It would be helpful to post a picture showing how you have everything hooked up.

    Be sure that the grounds of the servos are tied into the ground of the BS2.
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-28 15:26
    W9GFO wrote: »
    It would be helpful to post a picture showing how you have everything hooked up.

    Be sure that the grounds of the servos are tied into the ground of the BS2.

    OK I will post a picture on here
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-28 15:37
    Here are 3 pictures. They are not the best but I think they will work. I do have the servos grounded to the BS2 through the Vss
    1024 x 766 - 62K
    1024 x 766 - 80K
    1024 x 766 - 71K
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-28 15:47
    Here are some better pictures
    1024 x 575 - 43K
    1024 x 575 - 63K
    1024 x 575 - 72K
    1024 x 575 - 72K
  • ercoerco Posts: 20,255
    edited 2011-11-29 02:01
    jonathanmb wrote: »
    I plugged the servos in the way you would on the Homework Board with an extra battery.

    So you added another battery to power your pan & tilt servos. New battery - terminal goes to original battery - terminal, also to Stamp ground and servo black wires. Your new battery + only goes to both your pan/tilt servos' red wires, and control signals from Stamp into servo white or yellow wires...?
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-29 03:54
    The servo yellow wires are plugged in to PIN # 11 and 10 and the white wires coming from the receiver are going to PIN # 9 and 8. The servo red wires are connected with the two red jumper cables and the same for the wires coming from the receiver. And I just noticed this. I do not have my black wire coming from my receiver plugged into anything. That could be my problem.
  • ercoerco Posts: 20,255
    edited 2011-11-29 10:58
    jonathanmb wrote: »
    And I just noticed this. I do not have my black wire coming from my receiver plugged into anything. That could be my problem.

    Priceless. :)
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-29 11:15
    OK I fixed the black wire it still does not work. Now today I figured out a way to use the servos without the extra battery but it still doesn't work. I know that the servos have power because when I turn everything on they twitch. So I think it must be the program or my receiver input isn't right. My program is attached to the first post.
  • ercoerco Posts: 20,255
    edited 2011-11-29 11:21
    Just looked at your software, that's the problem. Program execution never gets down to run the second pair of servos.

    See anything wrong with your first DO loop? It just loops back on itself.
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-29 12:39
    Thanks the servos are now working. I am very new to this. As I said the servos are working now but what I did not realize is that because these are standard servos and not continuous rotation servos I need a different programming technique. The servos are trying to go beyond the amount they are allowed to travel. Do you know what kind of program I would need for that?
    Thanks
  • ercoerco Posts: 20,255
    edited 2011-11-29 13:04
    PULSOUT values for a BS2 are conservatively in the 500-1000 range, which yield timing pulses of 1-2 milliseconds. Individual servos vary, so you need to carefully experiment to expand that range to hit the mechanical limits for each individual servo. Then you need to come up with some math to scale the numbers read from your RC transmitter into values that work with your servos. If you need help with that, come back and post the range of numbers that the BS2 is reading from your transmitter.
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-29 13:53
    Ok I was able to fix the overtraveling problem but now my servos are not going even half of their travel and I need them to move much further. Also all of the servos including the navigation servos are not smooth they are very jerky. My current program that I am running is attached below
  • ercoerco Posts: 20,255
    edited 2011-11-29 14:12
    One problem at at time, my young Padawan...

    First, try deleting your PAUSE 10 and see if your jitterbuggin' robot calms down a bit.

    Next, tell us the range of values you're getting for tilt & turn. Throw some temporary DEBUG statements in your program to display them on your monitor.
  • ercoerco Posts: 20,255
    edited 2011-11-29 14:17
    Try this and see if your servos settle down. It reads your inputs seperately to keep your servo outputs updated faster.

    DO
    PULSIN Ch1 , state , drive
    PULSIN Ch2 , state , steer
    C_Target = drive - 750 + steer
    D_Target = 750 - drive + steer

    PULSOUT A_servo , A_Target
    PULSOUT B_servo , B_Target
    PULSOUT C_servo , C_Target
    PULSOUT D_servo , D_Target

    PULSIN Ch3 , state , tilt
    PULSIN Ch4 , state , turn
    A_Target = tilt - 500
    B_Target = turn - 500

    PULSOUT A_servo , A_Target
    PULSOUT B_servo , B_Target
    PULSOUT C_servo , C_Target
    PULSOUT D_servo , D_Target

    LOOP
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-29 14:26
    OK I deleted my PAUSE 10 and it still jitters. I am not sure where to put my DEBUG statements in my program or how to tell it to give me the values.
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-29 14:28
    OK with your program it is working smoothly again
  • ercoerco Posts: 20,255
    edited 2011-11-29 16:48
    OK, now let's get them servos going full range. Add this line before LOOP and see what range of values is shown on your screen when you push your pan/tilt joysticks on your transmitter. It will spaz out your servos, but don't worry.

    DEBUG DEC tilt, " ", DEC turn, CR
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-29 17:08
    OK so I added that before the LOOP and I ran the program. The Debug Terminal is giving me a set of numbers for each servo. The the sticks are in their neutral positions the tilt is 716 most of the time and the pan is at 832 most of the time. When the sticks are in their full travel positions the tilt is 1009 and the pan is at 1056 most of the time. My servos did not spaz out when I added the DEBUG command before the LOOP.
  • ercoerco Posts: 20,255
    edited 2011-11-29 20:18
    OK, 1009/1056 max, whats the minimum?
  • ercoerco Posts: 20,255
    edited 2011-11-30 01:14
    Wheredyago...?

    I'm leaving on a trip in a few hours, but I wanted to wrap up. Here's an iterative method you can play with. Suggest you trim your transmitter first so that your program DEBUGs both numbers around 750 when the sticks are neutral. Work with one stick at at time, starting with TILT. Moving the stick will generate a range of TILT values read by the Stamp, perhaps ~600-900. We want to do some math to expand this range for A_Target to drive your servos more in both directions, perhaps 400-1100. And it has to be all integer math along the way. Start with this formula:

    A_Target=400+((TILT-600)*5/2)

    which outputs from 400-1150, centered at 775. That 400 is negotiable, that's the smallest pulsewidth you want to send to your servo. The 600 value is the minimum TILT value your Stamp can read from your receiver (don't let (Tilt-600) get less than zero!). The 5/2 is a negotiable fractional fudge factor (multiplier) to make the overall range bigger. By playing with those values and your trim a bit to maintain center, you should be able to hit the full range of your servos. Each one affects the output a bit, so work slowly and don't overdrive your servos.

    Good luck,

    erco
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-30 04:09
    716/832 is the minimum
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-30 04:44
    OK so I place that formula into my program and I got the tilt servo to work. The Turn servo however is a different story. It is centering correctly and its travel is far enough to right but when you turn it to the left is moves a little bit and then goes to the right at full speed and tries to go past the allowed travel. Also the jitterbugin robot is back. The current program is attached below.
  • ercoerco Posts: 20,255
    edited 2011-11-30 08:46
    Did you trim the TURN stick to output 750 @ neutral? Maybe (TURN-600) is going negative to give that wild left response, so you'll have to adjust the numbers in that formula to work.
  • jonathanmbjonathanmb Posts: 24
    edited 2011-11-30 16:49
    Thanks for all of your help I really appreciate it. I have taken care of that problem. Now I just need to make it stop jittering.
  • ercoerco Posts: 20,255
    edited 2011-11-30 21:17
    Delete that DEBUG statement and you should be all good.
  • jonathanmbjonathanmb Posts: 24
    edited 2011-12-01 03:38
    I already did that.
    Thank you
  • ercoerco Posts: 20,255
    edited 2011-12-01 09:06
    Please attach your latest code, exactly as you are running it.
  • jonathanmbjonathanmb Posts: 24
    edited 2011-12-02 06:56
    Here is the latest code.
  • ercoerco Posts: 20,255
    edited 2011-12-02 18:38
    Kinda weird; in post #17, you said the servos were running smoothly(no jittering) with this nearly-similar code. Is this still true?

    DO
    PULSIN Ch1 , state , drive
    PULSIN Ch2 , state , steer
    C_Target = drive - 750 + steer
    D_Target = 750 - drive + steer

    PULSOUT A_servo , A_Target
    PULSOUT B_servo , B_Target
    PULSOUT C_servo , C_Target
    PULSOUT D_servo , D_Target

    PULSIN Ch3 , state , tilt
    PULSIN Ch4 , state , turn
    A_Target = tilt - 500
    B_Target = turn - 500

    PULSOUT A_servo , A_Target
    PULSOUT B_servo , B_Target
    PULSOUT C_servo , C_Target
    PULSOUT D_servo , D_Target

    LOOP
  • jonathanmbjonathanmb Posts: 24
    edited 2011-12-03 05:36
    I believe so
Sign In or Register to comment.