M User Defined Command to use with a Gripper

More
10 years 5 months ago #74745 by jstoquica
Hi,

I want control a electromechanical gripper for my robot, with a M User Defined Command.

I have a Breakout board for do that. I have 2 free outputs (pin 1 and 16) to active two relays, and each one can control a state of the gripper (OPEN and CLOSE) with two independent solenoids.

I only need a pulse for control the gripper states, for example:

- M101 to open
- M102 to close

How can I do that?

This is the correct way? But I need only a HI pulse (e.g. 25 ms), I can't leave active the solenoids, I need temporize the output state. Is this possible?
Code:
#!/bin/bash # file to turn on parport pin 14 to open the collet closer halcmd setp parport.0.pin-14-out True exit 0

I normally can use two buttons with PyVCP, one for each gripper state, and I can control the timing while push and release the buttons. But I want use the gripper with a G program.

Thanks a lot.

Please Log in to join the conversation.

More
10 years 5 months ago #74750 by Todd Zuercher
That might sort of work. The command "halcmd setp parport.0.pin-14-out True" will turn on the parallel port pin 14, but it will stay on (true) until something changes it back to false.
There are probably several ways to make it only a momentary signal. One way would be to use the parport driver's reset feature (often used with software stepping to achieve one step/thread cycle). Another way would be to add a sleep to your M-code script like this.
Code:
M101 #!/bin/sh # file to turn on parport pin 14 to open the collet closer halcmd setp parport.0.pin-14-out True sleep .030 ;# requires a sleep that does <.030 halcmd setp parport.0.pin-14-out False exit 0

Please Log in to join the conversation.

More
10 years 5 months ago #74751 by PCW
I would use M64 and M65 to set the state of the gripper and wire the hal pin thats controlled by M64 and M65
( motion.digital-out-00 for example) to two one shot components (man oneshot) set for 25 ms time with
one one-shot programed to trigger on the rising edge of motion.digital-out-00 and the other programmed to
trigger on the falling edge of motion.digital-out-00

(you could also use a single oneshot and some steering logic but I think the dual one-shot approach is simpler)

I would not use a userland halcmd routine for a 25 ms pulse as its timing is not guaranteed

Please Log in to join the conversation.

More
10 years 5 months ago #74753 by Todd Zuercher
I know that the time isn't guaranteed, but it is going to be at least that long isn't it? And since I thought he only needed something analogous to pressing a momentary button, should be good enough.

Please Log in to join the conversation.

More
10 years 5 months ago #74755 by PCW
Yes, it will stay on for at least the sleep time but the maximum on time is not knowable

I was just concerned that driving an intermittent duty cycle solenoid without
good control of the on time might not be a good idea

Please Log in to join the conversation.

More
10 years 5 months ago #74778 by jstoquica
Hi Everyone,

Thanks a lot, I use a solution with sleep command and is working.
Code:
#!/bin/sh # file to turn on parport pin 01 to open the gripper halcmd setp parport.0.pin-01-out True sleep .50 halcmd setp parport.0.pin-01-out False exit 0

Regards.

Please Log in to join the conversation.

Time to create page: 0.094 seconds
Powered by Kunena Forum