Shop OBEX P1 Docs P2 Docs Learn Events
emergency help needed with the propeller serial servo controller.. — Parallax Forums

emergency help needed with the propeller serial servo controller..

FireHopperFireHopper Posts: 180
edited 2010-06-28 00:19 in Robotics
I am trying to use it with my animatronic costume. but its not ramping. I need help asap. please tell me what you need to see. (I am using my own custom firmware hacked from the standard firmware. I only edited the main firmware, but when I use setservoposition it zooms right away to the position. it dont slowly move, which is what I need.. please help asap!!

Comments

  • hover1hover1 Posts: 1,929
    edited 2010-06-18 23:14
    It's really hard to help with your code when you do not include it. Are we phycsic?

    Jim
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2010-06-19 00:19
    FireHopper,

    Try increasing your Ramp value... right now you have it set to 3. Doing it this way uses the Lookup table with pre-set, pre-calculated values that are meant to be compatible with the original servo controller.


    You can also try setting the Ramp directly using the 'SetRamp' command from within the 'Servo32v7.spin' file.

    Since you already have an OBject aliased to it as 'SERVO', you code might look something like this...

    SERVO.SetRamp(Pin,Width,Delay)

    Where:
    Pin is the Servo Pin
    Width is the Pulse Width you want to move to
    Delay is how quickly you want to get there.


    Note: The resolution of Delay is about 38.75us or 3100 clocks at 80 MHz


    Keep in Mind:

    The SERVO.Set command moves the servo immediately to a defined position
    The SERVO.SetRamp command moves the servo to a defined position with a specific delay

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

    IC Layout Engineer
    Parallax, Inc.
  • FireHopperFireHopper Posts: 180
    edited 2010-06-19 04:29
    Beau Schwabe (Parallax) said...
    FireHopper,

    Try increasing your Ramp value... right now you have it set to 3. Doing it this way uses the Lookup table with pre-set, pre-calculated values that are meant to be compatible with the original servo controller.


    You can also try setting the Ramp directly using the 'SetRamp' command from within the 'Servo32v7.spin' file.

    Since you already have an OBject aliased to it as 'SERVO', you code might look something like this...

    SERVO.SetRamp(Pin,Width,Delay)

    Where:
    Pin is the Servo Pin
    Width is the Pulse Width you want to move to
    Delay is how quickly you want to get there.


    Note: The resolution of Delay is about 38.75us or 3100 clocks at 80 MHz


    so thats the range of 0-63?



    Keep in Mind:

    The SERVO.Set command moves the servo immediately to a defined position
    The SERVO.SetRamp command moves the servo to a defined position with a specific delay
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2010-06-19 08:35
    FireHopper,

    The numbers 0 to 63 represent a preset value in a lookup table designed to maintain compatability with the previous Servo Controller that we Discontinued.




    Take a look at the Servo32v7_RampDemo from the OBEX ... obex.parallax.com/objects/51/

        SERVO.Start                 'Start Servo handler
        SERVO.Ramp  '<-OPTIONAL     'Start Background Ramping
    
                                    'Note: Ramping requires another COG
                                    '      If ramping is not started, then
                                    '      'SetRamp' commands within the
                                    '      program are ignored
                                    '
                                    'Note: At ANY time, the 'Set' command overides
                                    '      the servo position.  To 'Ramp' from the
                                    '      current position to the next position,
                                    '      you must use the 'SetRamp' command 
    
    




    Now take a look at your code right after you set the Ramp value to 3 ... you are combining objects in a way that effectively uses the 'SetRamp' command from 'Servo32v7' which overrides any value your setting within 'Ramp'.

    If instead you used the 'SERVO.SetRamp' command instead of just the 'SERVO.Set' command with the appropriate ramp delay your code would probably be ok.


    For approximate Ramp values, 100 = 1 sec 6000 = 1 min

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

    IC Layout Engineer
    Parallax, Inc.
  • FranklinFranklin Posts: 4,747
    edited 2010-06-21 01:37
    Somebody said...
    sigh.. guess I need to post code again
    No, you need to attach the actual "yourcode.bs?" file rather than a .zip or a .doc file then we can load and test the code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • FireHopperFireHopper Posts: 180
    edited 2010-06-21 01:41
    my code is several files. You need to extract the zip file.
  • hover1hover1 Posts: 1,929
    edited 2010-06-21 01:52
    You new code posted still has:
    (''Initialize Loop ------------------------------------------------------------------  
         Ramp := 3                        ' wings closed position
         Servo.Set(Servo_0,750)           'left shoulder starting point
         Servo.Set(Servo_1,750)           'right shoulder starting point  
         Servo.Set(Servo_2,750)           'left elbow starting point
         Servo.Set(Servo_3,750)           'right elbow starting point
         Servo.Set(Servo_4,750)           'left wingtip starting point
         Servo.Set(Servo_5,750)           'right wingtip starting point
           
    

    It should have something like this:
    ''Initialize Loop ------------------------------------------------------------------  
         'Ramp := 3                        ' wings closed position
         Servo.Setramp(Servo_0,750,500)           'left shoulder starting point
         Servo.Setramp(Servo_1,750,500)           'right shoulder starting point  
         Servo.Setramp(Servo_2,750,500)           'left elbow starting point
         Servo.Setramp(Servo_3,750,500)           'right elbow starting point
         Servo.Setramp(Servo_4,750,500)           'left wingtip starting point
         Servo.Setramp(Servo_5,750,500)           'right wingtip starting point
           
    

    Should be 5 second ramp, (delay), to bring all servos to center position.

    Jim
    FireHopper said...
    I've replaced all the setservo and other things with servo.setramp and now its not moving properly at all [noparse]:([/noparse] sigh.. guess I need to post code again.
  • hover1hover1 Posts: 1,929
    edited 2010-06-21 01:53
    Franklin,

    It's a Propeller archive zip file. Not Stamp Software.

    Extracts fine here.

    Jim
    Franklin said...
    Somebody said...
    sigh.. guess I need to post code again
    No, you need to attach the actual "yourcode.bs?" file rather than a .zip or a .doc file then we can load and test the code.

    Post Edited (hover1) : 6/21/2010 1:58:27 AM GMT
  • FireHopperFireHopper Posts: 180
    edited 2010-06-21 02:27
    I'll have to check that.. maybe it didnt save properly.


    hover1 said...
    You new code posted still has:
    (''Initialize Loop ------------------------------------------------------------------  
         Ramp := 3                        ' wings closed position
         Servo.Set(Servo_0,750)           'left shoulder starting point
         Servo.Set(Servo_1,750)           'right shoulder starting point  
         Servo.Set(Servo_2,750)           'left elbow starting point
         Servo.Set(Servo_3,750)           'right elbow starting point
         Servo.Set(Servo_4,750)           'left wingtip starting point
         Servo.Set(Servo_5,750)           'right wingtip starting point
            
    
    It should have something like this:
    
    [size=2][code]
    
    ''Initialize Loop ------------------------------------------------------------------  
         'Ramp := 3                        ' wings closed position
         Servo.Setramp(Servo_0,750,500)           'left shoulder starting point
         Servo.Setramp(Servo_1,750,500)           'right shoulder starting point  
         Servo.Setramp(Servo_2,750,500)           'left elbow starting point
         Servo.Setramp(Servo_3,750,500)           'right elbow starting point
         Servo.Setramp(Servo_4,750,500)           'left wingtip starting point
         Servo.Setramp(Servo_5,750,500)           'right wingtip starting point
            
    
    Should be 5 second ramp, (delay), to bring all servos to center position.
    
    Jim
    
    
    




    [/code][/size]



    FireHopper said...

    I've replaced all the setservo and other things with servo.setramp and now its not moving properly at all [noparse]:([/noparse] sigh.. guess I need to post code again.
  • FireHopperFireHopper Posts: 180
    edited 2010-06-21 12:12
    okay fixing the zip file then reuploading.
  • FireHopperFireHopper Posts: 180
    edited 2010-06-21 12:19
    okay it should be correct now. it was the dumb way that the netbook was making zip files.
  • Beau SchwabeBeau Schwabe Posts: 6,566
    edited 2010-06-21 14:32
    FireHopper,

    I'm not exactly sure why your trying to wrap around the PSC Propeller Firmware when you have essentially made your own. Have you tried the Servo32v7 demo from the OBEX? That's all the PSC Propeller Firmware is doing, is to interpret a serial stream of commands and use the Servo32v7 object. The PSC Propeller Firmware was mainly designed for compatibility with an existing Servo Controller (<-Read before Propeller was introduced) where a Basic Stamp pulse width resolution of 2us was the smallest number you could send. I say this because the resolution of the Servo32v7 object is 1us. For reference, the line you have that reads ... SERVO.SetRamp(Servo_0,400,300) 'left wingtip starting point ... attempts to set the pulse width of the servo to 400us, when I think you meant for it to be set to 800us. The PSC Propeller Firmware would normally take the value you sent it of 400 and double it to 800 for compatibility with what the BS2 would have given it. Since you are bypassing this portion of the PSC Propeller Firmware it is attempting to send a width of 400 instead. I say attempting, because there are limits set within the Servo32v7 object designed to protect the servo from mechanical damage if you send a pulse width that is considered 'out of bounds'. Consequently it uses this 'out of bounds' as a software switch to disable a servo channel once it has been enabled. If the specified servo width is 'out of bounds', then the I/O assigned to that servo is made into an INPUT effectively disabling the servo. This default range is set within the Servo32v7 object to be between 500 and 2500. So if you are sending a pulse width of 400, then you end up disabling the servo.

    I encourage you to take a look at the Servo32v7 object in the OBEX and take a look at the demo that has been provided with that object ... obex.parallax.com/objects/51/

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

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 6/21/2010 2:37:32 PM GMT
  • FireHopperFireHopper Posts: 180
    edited 2010-06-22 11:30
    I was Wondering about that.. [noparse]:)[/noparse] I thought maybe that I should send the standard pulse width, if so then that explains my results. I will try it again with the non divided pulse width points
  • FireHopperFireHopper Posts: 180
    edited 2010-06-23 01:03
    Beau Schwabe (Parallax) said...
    FireHopper,

    I'm not exactly sure why your trying to wrap around the PSC Propeller Firmware when you have essentially made your own. Have you tried the Servo32v7 demo from the OBEX? That's all the PSC Propeller Firmware is doing, is to interpret a serial stream of commands and use the Servo32v7 object. The PSC Propeller Firmware was mainly designed for compatibility with an existing Servo Controller (<-Read before Propeller was introduced) where a Basic Stamp pulse width resolution of 2us was the smallest number you could send. I say this because the resolution of the Servo32v7 object is 1us. For reference, the line you have that reads ... SERVO.SetRamp(Servo_0,400,300) 'left wingtip starting point ... attempts to set the pulse width of the servo to 400us, when I think you meant for it to be set to 800us. The PSC Propeller Firmware would normally take the value you sent it of 400 and double it to 800 for compatibility with what the BS2 would have given it. Since you are bypassing this portion of the PSC Propeller Firmware it is attempting to send a width of 400 instead. I say attempting, because there are limits set within the Servo32v7 object designed to protect the servo from mechanical damage if you send a pulse width that is considered 'out of bounds'. Consequently it uses this 'out of bounds' as a software switch to disable a servo channel once it has been enabled. If the specified servo width is 'out of bounds', then the I/O assigned to that servo is made into an INPUT effectively disabling the servo. This default range is set within the Servo32v7 object to be between 500 and 2500. So if you are sending a pulse width of 400, then you end up disabling the servo.

    I encourage you to take a look at the Servo32v7 object in the OBEX and take a look at the demo that has been provided with that object ... obex.parallax.com/objects/51/

    that solved it thanks. now to figure out why the wings spaz when the prop first starts. I have to examine the code around the Start Pub.

    another method to avoid that would be to power the prop first, let it get settled then power the servos. which is fairly easy to do [noparse]:)[/noparse] now I just need to figure out my i2c issues with it.. I have the second i2c bus on pins 8 and 9, but I am not getting any response from the leds.. I have wires running from those pins to a small bit of pcb where the pullups are located. then I have wires leading from that to two BlinkM's, 2 on each side, 4 total. I am wondering if I need to put more pullups on. or put some 4.7K resistors in the line like I had to for the servos.

    I dont have access to a 'scope so I cant show any waveforms or anything.. or do I need to insert some delays in the i2c driver..

    anyone have a propeller servo controller and some i2c devices and can get them to work together?

    Post Edited (FireHopper) : 6/24/2010 1:28:12 AM GMT
  • FireHopperFireHopper Posts: 180
    edited 2010-06-24 09:04
    anyone able to help with i2c issues?
  • FranklinFranklin Posts: 4,747
    edited 2010-06-24 14:10
    What i2c issues are you having?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • hover1hover1 Posts: 1,929
    edited 2010-06-24 22:29
    Just thinking out load.. I'm not sure anyone has tried I2c through the voltage translators yet. I don't know if there are any timing or impeadence issues with that connection to I2C.
    What is the distance from the servo headers to the first board that has the pullups? And what is the distance to the board with the BlinkM's? There is a maximum bus capacitance of 400pf. Are you running Standard; 100kbps [noparse][[/noparse]Bits per Second], Fast mode; 400kbps, or High speed mode 3.4Mbps?
    Jim
    ·FireHopper said...
    now I just need to figure out my i2c issues with it.. I have the second i2c bus on pins 8 and 9, but I am not getting any response from the leds.. I have wires running from those pins to a small bit of pcb where the pullups are located. then I have wires leading from that to two BlinkM's, 2 on each side, 4 total. I am wondering if I need to put more pullups on. or put some 4.7K resistors in the line like I had to for the servos.
  • FireHopperFireHopper Posts: 180
    edited 2010-06-28 00:19
    the distance is roughly one foot between the prop and the pullups, then roughly another foot on each side to the first blinkm then another foot to the second blinkm.

    unknown what speed the buss is going at, as I didnt write the i2c driver I am using for the blinkm's
    I am guessing as fast as it can go. dont know for sure..


    hover1 said...
    Just thinking out load.. I'm not sure anyone has tried I2c through the voltage translators yet. I don't know if there are any timing or impeadence issues with that connection to I2C.
    What is the distance from the servo headers to the first board that has the pullups? And what is the distance to the board with the BlinkM's? There is a maximum bus capacitance of 400pf. Are you running Standard; 100kbps [noparse][[/noparse]Bits per Second], Fast mode; 400kbps, or High speed mode 3.4Mbps?
    Jim
    FireHopper said...


    now I just need to figure out my i2c issues with it.. I have the second i2c bus on pins 8 and 9, but I am not getting any response from the leds.. I have wires running from those pins to a small bit of pcb where the pullups are located. then I have wires leading from that to two BlinkM's, 2 on each side, 4 total. I am wondering if I need to put more pullups on. or put some 4.7K resistors in the line like I had to for the servos.
Sign In or Register to comment.