Shop OBEX P1 Docs P2 Docs Learn Events
MR.Ken — Parallax Forums

MR.Ken

kenner12kenner12 Posts: 7
edited 2012-07-18 14:30 in Robotics
Hello parallax experts,

Does any one know what command or basic stamp code would keep my boe-bot gripper arm tightly holding an object until time for the object to be dropped.The code I have written here works fine except after ''for counter= 1 to 64'' which is about 1 and a half seconds the gripper arm becomes loose and makes the object drops prematurely.The gripper arm is operated with a standard servo and the servo port is connect to pin 14.What pulses should I apply to the gripper arm servo to continously hold an object tighly within it's grips until the next stage? here is my program code:

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



irDetectLeft VAR Bit 'Left IR reading
irDetectRight VAR Bit 'Right IR reading
pulseLeft VAR Word 'pulse values for servos
pulseRight VAR Word
counter VAR Word
'[Initialization]

DEBUG "Program Running!"
FREQOUT 4, 2000, 3000

DEBUG CLS,
"IR DETECTORS", CR,
"LEFT RIGHT", CR
'[Main Routine]

Main:

'Spin around slowly until an object is spotted
DO

FREQOUT 8, 1, 38500
irDetectLeft = IN0
FREQOUT 2, 1, 38500
irDetectRight = IN9


PULSOUT 13, 780 'Rotate slowly
PULSOUT 12, 780
PAUSE 20 '5ms for detectors


LOOP UNTIL (irDetectLeft = 0) AND (irDetectRight = 0)


HIGH 10
HIGH 1
FOR counter= 1 TO 122
pulseLeft = 850 'move Forward
pulseRight = 650
PAUSE 20
NEXT
LOW 10
LOW 1
FOR counter=1 TO 64 ' stay still 1 and a half seconds'
PULSOUT 12,750
PULSOUT 13,750
PAUSE 20
NEXT


FOR counter=1 TO 64 'close gripper to grab object'
PULSOUT 14,1000
PAUSE 20
NEXT
FOR counter= 1 TO 64 ' stay still for 1 and a half second'
PULSOUT 12,750
PULSOUT 13,750
PAUSE 20
NEXT
FOR counter=1 TO 64 ' move forward'
PULSOUT 12,650
PULSOUT 13,850
PAUSE 20
NEXT
FOR counter= 1 TO 64 'stay still for 1 and a half seconds'
PULSOUT 12,750
PULSOUT 13,750
PAUSE 20
NEXT

FOR counter= 1 TO 64 'open gripper and drop object'
PULSOUT 14,500
PAUSE 20
NEXT
FOR counter=1 TO 64 'stay still for 1 and a half seconds'
PULSOUT 12,750
PULSOUT 13,750
PAUSE 20
NEXT
FOR counter=1 TO 64 ' move backwards
PULSOUT 12,850
PULSOUT 13,650
PAUSE 20
NEXT
GOTO main ' loop'


Thanks


ken.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-07-17 18:33
    In order to keep the gripper tightly gripping an object, you have to continue to output pulses about 50 times a second to the gripper servo. You could add a PULSOUT 14,1000 to each of the FOR loops following the one that closes the gripper so the gripper remains tight while the BoeBot stays still, moves forward, then stays still again.

    When you stop sending pulses to any servo, it will turn itself off. A standard servo will slowly slip if there's pressure on it to move when it's turned off.
  • ercoerco Posts: 20,256
    edited 2012-07-18 00:49
    And/or add a rubber band to your gripper to add closing force at all times (even when the servo is off). This makes it harder to open the gripper and easier to close it.
  • kenner12kenner12 Posts: 7
    edited 2012-07-18 07:50
    Mike Green wrote: »
    In order to keep the gripper tightly gripping an object, you have to continue to output pulses about 50 times a second to the gripper servo. You could add a PULSOUT 14,1000 to each of the FOR loops following the one that closes the gripper so the gripper remains tight while the BoeBot stays still, moves forward, then stays still again.

    When you stop sending pulses to any servo, it will turn itself off. A standard servo will slowly slip if there's pressure on it to move when it's turned off.

    Mike,

    Thanks.Your suggestion is really great and makes alot of sense.I'm going to try it out and let you know how it goes.

    Ken.
  • kenner12kenner12 Posts: 7
    edited 2012-07-18 09:07
    Mike,

    Thanks.I have tried your suggestion and it works great.The only thing I now want to work on is the range for my infra red detector.It's range seems to be to small.One foot range would probably be good for a project.If I can remember,adjusting the resistor value on the IR detector circuit respectively coresponds with the range to which the IR detector can cover, i.e less resistance on the circuit,the more sensitive the detector will be and more resistance less sensive the detector is.The only caution I have with experimenting with this is that I don't know the minimun resistance I have to put with this circuit to get the longest range with the detector and not to blow the detector circuit.Any advice on this?I have IR reciever no.35000014 and I got it from parallax.

    Ken.
  • PublisonPublison Posts: 12,366
    edited 2012-07-18 09:55
    kenner12 wrote: »
    Mike,

    Thanks.I have tried your suggestion and it works great.The only thing I now want to work on is the range for my infra red detector.It's range seems to be to small.One foot range would probably be good for a project.If I can remember,adjusting the resistor value on the IR detector circuit respectively coresponds with the range to which the IR detector can cover, i.e less resistance on the circuit,the more sensitive the detector will be and more resistance less sensive the detector is.The only caution I have with experimenting with this is that I don't know the minimun resistance I have to put with this circuit to get the longest range with the detector and not to blow the detector circuit.Any advice on this?I have IR reciever no.35000014 and I got it from parallax.

    Ken.

    @Ken,

    This may be what you were referring too?:

    http://forums.parallax.com/showthread.php?82131-Better-Boe-Bot-IR-Distance-Measurements-(Circuit-Programs)&highlight=IR+Range

    Jim
  • ercoerco Posts: 20,256
    edited 2012-07-18 14:30
    Another version of the IR distance measuring code used just one IR LED, doing a frequency sweep away from the IR receiver's center frequency. This correlated the detection of decreased off-center sensitivity to yield a relative distance. Sure saved a lot of I/O pins!

    Can't locate that link just now. Edit: See chapter 8 http://www.parallax.com/Portals/0/Downloads/docs/books/edu/Roboticsv3_0.pdf

    But Ken, to maximize your detection distance, first make sure you're using the right frequency for your particular detector, usually 36, 37, 38, 39 or (now rarely) 40 kHz. The P/N you referenced says 38 kHz on the website. You can also decrease the series resistor on your LED to send higher currents to it. [You can decrease the resistor CONSIDERABLY (to nearly zero, but you didn't hear that from me) if you use it properly, since the IR LED's duty cycle is so low, but you run the risk of blowing that I/O pin on the Stamp if you mess up and leave it on steadily.] So forget that option, do yourself a favor and decrease the resistor value slowly and test detection range methodically.

    For a stronger output signal, you could also drive several series or parallel IR LEDs in unison, using a transistor switch between the I/O pin and the LEDs.
Sign In or Register to comment.