Propeller Servo Controller Code
ajward
Posts: 1,130
Hey All...
I have a question concerning the code that resides in the Prop Servo Controller. If I understand correctly, the enabled servos are initialized (centered) in this section of code:
The initialization works, but for my application (my biped Wally) it happens just too quickly.
https://www.youtube.com/watch?v=gXV6dJJyQ4o
It is certainly impressive to see a "pile" of servos and metal parts snap to attention, but it ofter results in Wally falling over which lessens the impressiveness. :-)
I'd like to slow down the process, but I'm not sure how to slowly bring the hip and knee servos to the center position (~750) from different starting positions. The goal would be to have him in a squatting position and slowly stand erect.
Any guidance would be greatly appreciated!
Amanda
I have a question concerning the code that resides in the Prop Servo Controller. If I understand correctly, the enabled servos are initialized (centered) in this section of code:
''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 Servo.Set(temp,PW<<1) '' Initialize servo position
The initialization works, but for my application (my biped Wally) it happens just too quickly.
https://www.youtube.com/watch?v=gXV6dJJyQ4o
It is certainly impressive to see a "pile" of servos and metal parts snap to attention, but it ofter results in Wally falling over which lessens the impressiveness. :-)
I'd like to slow down the process, but I'm not sure how to slowly bring the hip and knee servos to the center position (~750) from different starting positions. The goal would be to have him in a squatting position and slowly stand erect.
Any guidance would be greatly appreciated!
Amanda
Comments
I would try to use the Start Up Mode to set the servos to the idle position (flat):
Then use the Position Command in you main program :
to set the centering using the ramp speed function, with 63 being the slowest ramping.
Maybe Beau will chime in as he is the servo guru.
Jim
The only way I can see doing it is to ensure that the servos are already close to center when you turn on the power.
If you pre-program the firmware with the !SCEDD command for the servos involved, That servo position would be saved into the upper EEPROM. On the next startup, the servos would not move, ( if programmed to the resting pulse, say 1000 for "lay down".
Then the servo.ramp command could be issued from the top object, (or BS2) to bring those servos up with the "delay"
There are provisions in the servo.spin code for saving starting positions in the upper EEPROM. They don'y have to be center.