Shop OBEX P1 Docs P2 Docs Learn Events
Help with gripper arm "closing" and "opening" — Parallax Forums

Help with gripper arm "closing" and "opening"

kenner12kenner12 Posts: 7
edited 2012-05-15 17:59 in Robotics
Hello parallax forum experts,

I have a boe -bot robot that I'm trying to program to detect objects put in front of it using IR detectors.So far the IR detectors are working fine but I'm mostly having hard time with the code for the gripper,in closing and opening in a cordinated smooth way.Here is the order of how I want the boe-bot to move in executing this particular task.

(1) the boe-bot should have it's gripper arm ''open'' initially

(2)rotate slowly in a circle as it looks for an object

(3)calculate how far the object in front of it is,align itself to it and move forward towards it,grab it, close the gripper in a gentle manner,

(4)move with the object to the right a few inches and drop the object and finally return to original position of rotating around while looking for an object.This can done in a loop until an object is detected .

I want the 2 RED LED connected to light up when object is detected.

These are some of the codes I have been trying out.I'm still learning.Could someone help me out to organize this.I have been looking at sample codes and reading the boe-bot student guidebook and have not been able to pick up one that is related to the gripper arm.Any help with this would be highly appreciated.

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


DEBUG "Program Running!"



irDetectLeft VAR Bit ' Variable Declarations..
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
pulseGrip VAR Word

DEBUG "Testing piezospeaker..."
FREQOUT 4, 2000, 3000 ' Signal program start/reset..

DEBUG CLS,
"IR DETECTORS", CR,
"Left Right", CR


DO ' Main Routine..

FREQOUT 8, 1, 38500 ' Check IR Detectors..
irDetectLeft = IN9

FREQOUT 2, 1, 38500
irDetectRight = IN0
' Gripper Action..
IF (irDetectLeft = 1) AND (irDetectRight = 1) THEN 'Gripper IF..
LOW 13
LOW 12

pulseGrip = 1000 ' Close Gripper


ELSE
HIGH 13
HIGH 12
pulseGrip = 500 ' Open Gripper

ENDIF


DEBUG CRSRXY, 2, 3, BIN1 irDetectLeft,
CRSRXY, 9, 3, BIN1 irDetectRight

PAUSE 20

PULSOUT 13,pulseLeft
PULSOUT 12,pulseRight
PULSOUT 14,pulseGrip
LOOP

Thanks,

Ken.

Comments

  • tobdectobdec Posts: 267
    edited 2012-05-14 16:48
    You need encoders to pinpoint the posistion of the gripper rotation and maybe a reed switch or another encoder to pinpoint the posistion of the gripper.
    http://www.parallax.com/dl/docs/cols/nv/vol1/col/nv8.pdf heres a quick how-to to get you started.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-05-14 18:36
    tobdec wrote: »
    You need encoders to pinpoint the posistion of the gripper rotation and maybe a reed switch or another encoder to pinpoint the posistion of the gripper.

    I don't think Ken needs encoders if he is using normal servos and not continuous rotation servos. He can try out different pulse length so see which lengths work best to move the gripper to the desired position.

    @Ken, Have you tried to getting the gripper to open and close by itself? It looks like you're using a pulse length of 2ms to close the gripper and 1ms to open it.

    I don't understand what you're doing with pins 12 and 13. Why are they set high or low and then also pulsed?

    It would help us read your code more easily if you use code tags. Here's a link to learn how.

    attachment.php?attachmentid=78421&d=1297987572
  • tobdectobdec Posts: 267
    edited 2012-05-14 19:25
    Yet again my lack of reading has turned me into an idiot lol I didnt see the boe-bot
  • kenner12kenner12 Posts: 7
    edited 2012-05-15 13:44
    Duane,
    Thanks for mentioning the ''standard servo motor'',I thought I was using the standard servo which I posted with my earlier thread but I mistakenly had the continous rotation servo on instead.I got the ''standard servo'' and I'm installing it now and I'll update you How it goes.

    Thanks.

    Ken.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-05-15 14:50
    kenner12 wrote: »
    Duane,
    Thanks for mentioning the ''standard servo motor'',I thought I was using the standard servo which I posted with my earlier thread but I mistakenly had the continous rotation servo on instead.I got the ''standard servo'' and I'm installing it now and I'll update you How it goes.

    Thanks.

    Ken.

    You ought to thank tobdec. If he hadn't misread your post, I wouldn't have felt the need to claify about a "standard servo". :smile:
  • tobdectobdec Posts: 267
    edited 2012-05-15 17:59
    lol what a solution! A mistake..a mistake...a correcttion (that was a mistake) a realization and then a solution! Love it!
Sign In or Register to comment.