Shop OBEX P1 Docs P2 Docs Learn Events
Program problems - RC Linear Servo speed or step controling — Parallax Forums

Program problems - RC Linear Servo speed or step controling

Ryan1234Ryan1234 Posts: 23
edited 2012-12-12 08:39 in BASIC Stamp
Hi I am having issues trying to control this servo (Frigelli L12-100-210-12-R, http://www.firgelli.com/Uploads/L12_datasheet.pdf), it seems to work fine but i cannot control the speed. Adjusting the RA=1 to 63 dose not seem to do anything. I want my program to transition slower between the different positions of the linear servo.

Note: I am using the basic stamp and the parallax servo controler.

Please see example graph of what i am trying to do with position. And Servo info. Is there a way that i can adjust the speed a different way or add some kind of step feature so the serve changes position gradually.

Can someone please help!!!


Current-Servo-Position.jpg
Desired-Servo-Position.jpg





' {$STAMP BS2}
' {$PBASIC 2.5}

CH VAR Byte
PW VAR Word
RA VAR Byte
X VAR Byte
BUFF VAR Byte(3)
SDAT CON 15
BAUD CON 396
COL VAR Nib
ROW VAR Nib

INIT:
RA =1
CH = 15
COL = 0

DEBUG "
ENGINE, WARM UP- 12-17-12 ---"

'PW = 780: GOSUB WRSERVO1 'OC IDLE - 30 SEC
'PW = 760: GOSUB WRSERVO2 'F8 5-7 MPH WARM - 60 SEC 3200
'PW = 750: GOSUB WRSERVO1 'EE 15-20 MPH WARM - 30 SEC 4400
'PW = 740: GOSUB WRSERVO1 'E4 27-35 MPH WARM - 30 SEC 5300
'PW = 760: GOSUB WRIDEL1 'F8 5-22 MPH WARM - 15 SEC 4100
'PW = 780: GOSUB WRIDEL1 'OC IDLE - 15 SEC

DEBUG CLS
DEBUG"
ENGINE, WARM UP- 12-17-12 ---"

DYNOCYCLE1: 'ENGINE DYNO CYCLE

DEBUG "
ENGINE, WARM UP - COMPLETE ---"
DEBUG "
BEGIN ENGINE CYCLE ---"
DEBUG "
ENGINE, WATER TANK 45 min Cycle Test- 12-17-12 ---"

DO WHILE (COL < 10)
FOR ROW = 0 TO 15
IF (ROW > 9) THEN EXIT
DEBUG CRSRXY, (COL * 8), ROW,
DEC COL, "/", DEC ROW, CR
NEXT

COL = COL + 1

IF (COL = 5) THEN GOSUB ENGSTOP '4 COMPLETE CYCLE AND STOP

PW = 780: GOSUB WRIDEL1 'OC IDLE - 15 SEC 1400
PW = 760: GOSUB WRIDEL1 'F8 5-10 MPH WARM - 15 SEC 3000
PW = 730: GOSUB WRSERVO1 'DA 39-40 MPH WARM - 20 SEC 5700
PW = 758: GOSUB WRIDEL1 'F6 19-21 MPH WARM - 15 SEC 4400
PW = 730: GOSUB WRSERVO1 'DA 39-40 MPH WARM - 30 SEC 5700
PW = 780: GOSUB WRIDEL1 'OC IDLE - 15 SEC 1400

DEBUG CLS
DEBUG "
45 min Cycle Test- 12-17-12
"
LOOP

ENGSTOP: 'ENGINE STOP
PW = 780:
SEROUT SDAT, BAUD+$8000,["!SC", CH, RA, PW.LOWBYTE, PW.HIGHBYTE, CR]
DEBUG CLS, "
45 min Cycle Test- 12-17-12
"
DEBUG "-- CYCLE COMPLETE -- ", DEC COL (0), "-- ENGINE STOP"
END

WRIDEL1: 'IDEL 15 SECONDS
SEROUT SDAT, BAUD+$8000,["!SC", CH, RA, PW.LOWBYTE, PW.HIGHBYTE, CR]
FOR X = 0 TO 6
PAUSE 1800
SEROUT SDAT, BAUD+$8000,["!SCRSP", CH, CR]
SERIN SDAT, BAUD, 1000, INIT,[STR BUFF\3]
DEBUG "CURRENT CYCLE -", DEC COL(0), "- IDEL 1-", DEC BUFF(1), " LOCATION - ", HEX2 BUFF(2), CR
NEXT
RETURN

WRSERVO1: 'FASTEST SERVO 20 SECONDS
SEROUT SDAT, BAUD+$8000,["!SC", CH, RA, PW.LOWBYTE, PW.HIGHBYTE, CR]
FOR X = 0 TO 6
PAUSE 3800
SEROUT SDAT, BAUD+$8000,["!SCRSP", CH, CR]
SERIN SDAT, BAUD, 1000, INIT,[STR BUFF\3]
DEBUG "CURRENT CYCLE -", DEC COL(0), "- SERVO 1-", DEC BUFF(1), " LOCATION - ", HEX2 BUFF(2), CR
NEXT
RETURN
568 x 493 - 22K
568 x 493 - 27K

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-12-10 10:21
    When posting code you should always use the code tags to preserve formatting or attach the code instead. I guess the best question in troubleshooting here is have you tried your code with a standard servo? That way you can determine if the code is doing what you expect and the linear actuator is not. That would be the best way to start with something like this.
  • Ryan1234Ryan1234 Posts: 23
    edited 2012-12-10 13:06
    When posting code you should always use the code tags to preserve formatting or attach the code instead. I guess the best question in troubleshooting here is have you tried your code with a standard servo? That way you can determine if the code is doing what you expect and the linear actuator is not. That would be the best way to start with something like this.


    Is there a good way to slowly step to the next position, like a step delay or something. i think it works with a redular servo. so i think i have to find another way to get this linear servo to work the way i want.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-12-10 13:12
    The point of my question was to determine if the linear actuator does in fact work just like an ordinary servo. Without comparing against a known good example it is impossible to tell. I still recommend trying the regular servo with the existing code to compare the results. The PSC handles rotation speed by interpolating the values and sending the new values to the servos over time, so that should work unless there is an issue with the command not being recognized. But that's what troubleshooting entails sometimes, replacing a problematic part with a known good to compare.
  • Ryan1234Ryan1234 Posts: 23
    edited 2012-12-11 07:50
    It works with a regular servo. Is there another way that i can have the program slowly step or progress to the next point, using the actuator that i am currently using.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-12-11 08:06
    The 'ramp speed' parameter (RA) sets the speed the controller uses to transition from one position to another. In your program, you've got this set to 1. Try other values (up to 63). The higher the value, the slower the change from one position to another.

    Normally, the servo controller just sends the new position to the servo when you change the servo's position and the servo moves as quickly as it can to the new position. With higher ramp values, the servo controller breaks up the difference between the two positions into segments and outputs successive segments to the servo. The servo still moves as quickly as possible from one position to another, but these are closer together and, with enough segments, the motion seems slower and smoother.
  • Ryan1234Ryan1234 Posts: 23
    edited 2012-12-12 06:03
    Yes i have tried to update the RA to 63 no effect. is there a good way to manualy step or progresess slower to the next points.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-12-12 08:39
    The fact that a standard servo works fine and the linear actuator does not tells me that the way it responds to servo pulse changes is not the same as a standard servo. Given that it is hard to say how you could accomplish this. By all rights the 63 value for speed should be the slowest change and would use interpolation to step the servo by varying the pulse widths over time. This is exactly what you're asking how to do and since the PSCU is doing it, I'm not sure another approach will yeild different results.

    Is there any reason a servo could be used in place of the actuator?
Sign In or Register to comment.