How to Control a PWM Gripper

More
13 Oct 2024 16:37 #311986 by Project_Hopeless
I have my hobby robot gripper working and an Axis GUI slider to manually control/test it.  So now I need a hook to control the gripper from an eventual gcode program.

I'm thinking of having 3 states, Open, Close, Variable.  I'll need to output a float value, so is this best suited for G, M, O, or other code? 

Secondly are "aliases" possible in gcode?  For example "Gripper Open"  or "M65 Open" something relatively simple.
######## rcPWM Gripper Control

setp hm2_[MESA](BOARD).0.rcpwmgen.rate 50
setp hm2_[MESA](BOARD).0.rcpwmgen.00.width 1
setp hm2_[MESA](BOARD).0.rcpwmgen.00.offset 1.39
setp hm2_[MESA](BOARD).0.rcpwmgen.00.scale 180
net PWMcmd  pyvcp.servo-f  hm2_[MESA](BOARD).0.rcpwmgen.00.width        #float

Please Log in or Create an account to join the conversation.

More
13 Oct 2024 16:57 #311991 by Aciera
Replied by Aciera on topic How to Control a PWM Gripper
You could use the 'motion.analog-out' pins (M68):
linuxcnc.org/docs/html/gcode/m-code.html#mcode:m68

If you wanted you could define your own M-code or Subroutine that sets a particular analog output pin so you would not have to enter the E-word all the time.

We cannot pass strings in gcode and the only way to use something like that would be a subroutine (eg o<yoursubroutine>call)

Please Log in or Create an account to join the conversation.

More
13 Oct 2024 18:01 #311997 by Project_Hopeless
I'm thinking about readability, so is this possible with subroutines...

Open CALL
Close CALL
Open 50 CALL (representing 50% full scale)

Please Log in or Create an account to join the conversation.

More
14 Oct 2024 06:57 #312037 by Aciera
Replied by Aciera on topic How to Control a PWM Gripper
No that is not possible, subroutine calls need to use the 'O' Word (O <your_subroutine> CALL)
Note: lowercase lettering is also fine like in my last post. Subroutines can also accept parameter values (O <your_subroutine> CALL [123] [456] ...)
Remapped Mcodes can also pass P and Q words: (M456 P1 Q2)

Please Log in or Create an account to join the conversation.

Time to create page: 0.070 seconds
Powered by Kunena Forum