Shop OBEX P1 Docs P2 Docs Learn Events
RAMP SPEED Servo controller — Parallax Forums

RAMP SPEED Servo controller

RNRN Posts: 28
edited 2010-08-09 04:47 in Propeller 1
I am back again but with a new problem. Finally my servos are moving through serial commands thanks to stefan and mike.

I have a robotic arm(self made) in which i have three servos. As soon as the servo board is turned on the robotic arm is reset to default position but it moves to the initial speed at ramp speed of 0(max). I want to slow that down. the documentation has a new default position but that doesn't have a ramp speed as an option. where should i change it in the firmware

Comments

  • StefanL38StefanL38 Posts: 2,292
    edited 2010-08-04 08:48
    OK after looking inside the firmware into

    PUB SetServoPosition            '' Set a new servo position
        Ramp := 0#>Ramp<#63
        If ((Enabled & |<Channel)>>Channel) == 1     '' Check if servo is enabled
           Servo.Set(Channel,0)        '' Disable Servo if servo flag is disabled 
        else
           If ServoRamp[noparse][[/noparse]Channel] == 0
              Servo.Set(Channel,500#> PW*2 <# 2500)
           Servo.SetRamp(Channel,500#> PW*2 <# 2500,RampSpeed[noparse][[/noparse]Ramp])
        ServoRamp[noparse][[/noparse]Channel] := Ramp
        ServoPosition[noparse][[/noparse]Channel] := PW   
    
    



    I guess

    you have to add

              Servo.SetRamp(temp,500#> PW*2 <# 2500,RampSpeed[noparse][[/noparse]"your-ramp-value"])                    
    
    



    in the initilise loop sepction

    ''Initialize Loop ------------------------------------------------------------------
    
         repeat temp from 0 to 15   '' Initialize ALL servos to center position that are Enabled on Startup
           If ((Enabled & |<temp)>>temp) == 0               '' Check if servo is enabled on startup
              PW := 750                                     '' Set default Servo Width value
              If LoadDetect == 1                            '' Check if pre-defined Servo position has been selected
                 PW_highbyte := EEPROM.RandomRead(ServoCh0+(temp<<1)+0)             '' Load pre-defined HIGH BYTE
                 PW_lowbyte  := EEPROM.RandomRead(ServoCh0+(temp<<1)+1)             '' Load pre-defined LOW BYTE
                 if PW < 250 or PW > 1250                   '' Check if pre-defined Servo position is within valid range 
                    PW := 750                               '' ...If not default to center position
                    
              'insert SetRamp-value here
              Servo.SetRamp(temp,500#> PW*2 <# 2500,RampSpeed[noparse][[/noparse]"your-ramp-value"])                    
    
              Servo.Set(temp,PW<<1)                         '' Initialize servo position
    
    



    @Beau Schwabe from Parallax:
    it would be very good if you add a pre-set value for the ramp and for servos enabled/disabled

    best regards

    Stefan
  • Beau SchwabeBeau Schwabe Posts: 6,569
    edited 2010-08-04 16:47
    StefanL38,

    "it would be very good if you add a pre-set value for the ramp and for servos enabled/disabled"

    - Why not just set the ramp to the same default "Set" position?

    - With using the larger EEPROM, you can set the default servo position and if it's enabled or disabled. The Propeller Servo Controller USB firmware makes use of a feature similar to this. The PSC firmware just provides a wrapper for the Servo32 object


    Example:
    SERVO.Start
    SERVO.Ramp
    
              'Set(Pin, Width)
    SERVO.Set(ServoCh1,1500)
    
               'SetRamp(Pin, Width,Delay)<-- 100 = 1 sec 6000 = 1 min
    SERVO.SetRamp(ServoCh1,1500,200)
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • RNRN Posts: 28
    edited 2010-08-09 03:55
    a very strange problem is coming. Their is no effect of sending any ramp speed from 0-63 from the code. It is running at the same speed 0 but from the servo controller GUI their is effect of speed and it is running at specified speed. The code is as following

    s=serial('com3','baud',2400);
    s.readasyncmode='continuous';
    s.timeout=2;
    s.inputbuffersize=25555;
    fopen(s);
    X=[33,83,67,0,63,0,2,13];
    fwrite(s,X,'char');
    and I haven't made any change in the firmware
  • Andrey DemenevAndrey Demenev Posts: 377
    edited 2010-08-09 04:15
    There is no such thing as ramp speed for initial position. To perform smooth movement, servo controller needs to know current position. At startup, the position is unknown
  • HughHugh Posts: 362
    edited 2010-08-09 04:47
    RN wrote: »
    I have a robotic arm(self made) in which i have three servos.

    Are you a T1000 Terminator by any chance? :)
Sign In or Register to comment.