Shop OBEX P1 Docs P2 Docs Learn Events
Servo Controller Help — Parallax Forums

Servo Controller Help

ajwardajward Posts: 1,130
edited 2014-01-04 16:17 in General Discussion
Hi All...

I'm using the Prop servo controller to run my biped Wally. It works well (still working on getting him walking), but I have one problem.
When I first power up the servos they =snap= to the center position. The center position is with the 'bot standing up and ready to start walking.
Not a major problem I suppose, but (if possible) I would like to have them move slowly so standing up would be a little more a human getting up off the floor.

If I understand correctly, everything the PSC does is controlled with Spin code. I've looked at the code in the firmware package and I'm not ashamed to admit that stuff is WAY over my head. I'm not afraid to tinker with it (how else can you learn), but I have no clue where to start.

Can anyone point me in the right direction to slow the darn servos down a little?

Thanks for any advice!

Amanda

Comments

  • PublisonPublison Posts: 12,366
    edited 2014-01-04 10:33
    ajward wrote: »
    Hi All...

    I'm using the Prop servo controller to run my biped Wally. It works well (still working on getting him walking), but I have one problem.
    When I first power up the servos they =snap= to the center position. The center position is with the 'bot standing up and ready to start walking.
    Not a major problem I suppose, but (if possible) I would like to have them move slowly so standing up would be a little more a human getting up off the floor.

    If I understand correctly, everything the PSC does is controlled with Spin code. I've looked at the code in the firmware package and I'm not ashamed to admit that stuff is WAY over my head. I'm not afraid to tinker with it (how else can you learn), but I have no clue where to start.

    Can anyone point me in the right direction to slow the darn servos down a little?

    Thanks for any advice!

    Amanda

    Hi Amanda,

    You could use the “!SCEDD” <1> <CR> command to set a default position at power up.

    The default position is set by the “!SCD” <channel> <lowbyte> <highbyte> <CR> command. This is saved in the EEPROM.

    The position could be the last servo position command before you power off, (if you know that position.

    Another thought would be to invoke the "Servo32_Ramp_v2.spin". I wouldn't know where to put it unless you can share your complete code.

    Jim
  • ratronicratronic Posts: 1,451
    edited 2014-01-04 13:28
    Amanda try loading this into the servo controller. You can change the "RAMP" # in the Con section higher for slower servo movement and lower for faster servo movement. Plug a servo into P1 and play with that "RAMP" #

    to get it to move at the speed you want. This sample program just moves the servo from one end to the other at the "RAMP" rate.
    Con                                                         
                                                             
      _CLKMODE = XTAL1 + PLL16X                              
      _XINFREQ = 5_000_000
      
      SERVO1 = 1 'P1
    
      RAMP   = 400
        
    Var
    
    Obj
    
      srv : "servo32v7"
    
    Pub Main
    
      srv.start
      srv.ramp
    
      repeat
      
        srv.setramp(SERVO1, 1100, RAMP)  'set servo to begining position
    
        waitcnt(clkfreq * 2 + cnt)       'wait 2 seconds for servo to move
    
        srv.setramp(SERVO1, 1900, RAMP)  'set servo to other end 
    
        waitcnt(clkfreq * 2 + cnt)       'wait 2 seconds for servo to move
    
  • ratronicratronic Posts: 1,451
    edited 2014-01-04 14:53
    I have noticed on the startup of the program above the servo quickly rotates clockwise before ramping. I believe that is because the servo has to be set first to know how far to ramp too. I tried the PropBOE Servos.spin object and on it's

    first ramping command without setting the position first and it quickly rotates to the middle before ramping. Maybe someone else will chime in on how to slowly move a servo in a unknown position to the starting position that you want?
  • ajwardajward Posts: 1,130
    edited 2014-01-04 15:59
    @ publison: I'm not sure posting my code would help, but i can. I'm letting the BS2 BOE run through it's program before applying power to the servos, then the servos =jump= to their center position. Same thing if I have a null program loaded to the Stamp.
  • ajwardajward Posts: 1,130
    edited 2014-01-04 16:17
    @ ratronic: As I understand, a characteristic of the PSC is to set all active servo channels to the center position on PSC powerup, before I've sent any code from the BOE. This has to be done in the PSC firmware (spin code), I think... and this is modify-able... right?

    I can always arrange the 'bot to be standing up when I power up the system, I'd like to have him slowly stand up from a pile of "parts on the floor"! :-)

    Amanda
Sign In or Register to comment.