Shop OBEX P1 Docs P2 Docs Learn Events
Parallax Servo Controler - Ping))) — Parallax Forums

Parallax Servo Controler - Ping)))

kevinb2050kevinb2050 Posts: 56
edited 2008-10-27 00:40 in BASIC Stamp
I have a Parallax Ping mounted on a Parallax standard servo operated by a Parallax Servo Controller by a BS2e.
when I set PosPing to 750 it Points Straight ahead
when i set PosPing to 300 it moves 90 deg right of centre (750)
when I set PosPing to 1200 it moves to 90 deg left of centre (750)

I expected 250 to be 90deg right of centre and 1250 to be 90 deg left of centre
My problem is i am trying to convert servo movements to brads and need a full swing of 1000
is there something about the servo controller I am missing

DO
'DEBUGIN SDEC PosPing
DEBUG ?PosPing
SEROUT Sdat, PSCBaud+$8000,[noparse][[/noparse]"!SC", PingServo, ra, PosPing.LOWBYTE, PosPing.HIGHBYTE, CR]
PAUSE 20······························
GOSUB Get_Ping_Cm·· ' pulseout for ping)) unit
DEBUG ?distance
LOOP

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-26 13:45
    This is well within the normal range of behavior of R/C (radio control) servos. They are not precise devices.
    The range of movement for a given pulse width will vary from manufacturer to manufacturer and from
    model to model and will even vary somewhat from one servo to the next. Programs where the position of
    the servo has to be computed generally scale the value to match the specific servo being used. The "*/"
    operator is very handy for that. Look at the description in the Stamp Basic Manual (page 112 ?). You will
    also want to subtract off the lower end of the range before scaling and add it back afterwards.

    I think this will do what you want (the CON declarations can go at the beginning of your program):

    lowerVal CON 300 ' actual lower end of servo range
    upperVal CON 1200 ' actual upper end of servo range
    rangeVal CON upperVal - lowerVal ' range of servo PULSOUT values
    newRange CON 1000 / 4 ' desired range of values scaled by 4
    scaleVal CON rangeVal * 64 / newRange ' scale factor for "*/". Extra factors of 4 used because of 16 bit limitation

    PSCvalue = PosPing */ scaleVal + lowerVal ' PosPing ranges from 0 to 999
  • kevinb2050kevinb2050 Posts: 56
    edited 2008-10-26 23:24
    Thanks Mike I will try the code tonight -
    Do you have any ideas on how to get more precise movement out of Continuous rotation servos - I have fitted encoders and used Philip C. Pilgrim - brilliant Applying the Boe-Bot Digital Encoder paper. My Bot will roam free and on command return to Start XY or can be sent to any XY location
    However - my aim is for the Bot to ping out to find object (done this to +- 2 PosPing) then rotate on axis (this is my problem), move to object, pickup object with robotic arm (done this), return to home (done this).
    As the encoders work on 16 counts /rotation = approx 14mm per count the Accuracy on rotating on the axis is not good enough i.e. ping works on 0 - 1000, convert to brads 0 - 128, convert to encoder counts 1 = 14mm movement in rotation.
    I have thought about doing timed counts i.e. PSC Servo on - count time - PSC Servo Off to get smaller movements - similar to Pulseout counts
    Any thoughts would be Appreciated.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-10-27 00:26
    You really need some kind of accurate position sensing. Unfortunately, the wheels will slip enough to even throw off navigation with wheel encoders. You probably need some kind of IR beacons that you can locate and use triangulation to determine the robot's position. You could have different beacons use different frequencies or somehow transmit their identification and use both a wide view and narrow view sensor to locate the beacon(s). Alternatively, you could try to map out the obstacles in the environment and use that for orientation. Neither of these are particularly easy to accomplish.
  • kevinb2050kevinb2050 Posts: 56
    edited 2008-10-27 00:40
    Thanks Mike, At present I am using the Ping)) to get Bot close to the object and then IR detectors mounted on the robotic arm clamp that rotates left to right to get accurate pickup.
    Was just looking for a quicker (easier) more accurate 1 option method.
    It would be great if the PSC had both options available i.e. single pulsed movements as well as its self controlled continuous movement.
    Your second option of mapping out the environment I am doing but again it is only as accurate as 1 (14mm) count from the encoders.
Sign In or Register to comment.