Parallax Servo Controler - Ping)))
kevinb2050
Posts: 56
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
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
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
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.
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.