How to Control a PWM Gripper

  • Project_Hopeless
  • Project_Hopeless's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
13 Oct 2024 16:37 #311986 by Project_Hopeless
How to Control a PWM Gripper was created 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.

  • Project_Hopeless
  • Project_Hopeless's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
13 Oct 2024 18:01 #311997 by Project_Hopeless
Replied by Project_Hopeless on topic How to Control a PWM Gripper
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.

More
19 Dec 2024 17:08 #316995 by robocidalmaniac
Replied by robocidalmaniac on topic How to Control a PWM Gripper
Has anyone been able to use M codes to operate a Robotic Arm gripper yet? I have a post for a Scorbot-ER-3 and Linuxcnc 2.9.1 which uses a gui and mouse to open and close the gripper, but need to make a M code for this function. Please help

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

More
08 Mar 2025 19:17 #323536 by robocidalmaniac
Replied by robocidalmaniac on topic How to Control a PWM Gripper
Please a few questions.
I have a Scorbot-ER-3 (with original control box) working using LinuxCNC, But cannot activate the gripper using G-Code commands or the Logitech dual action F310 controller pendant. When Andy designed this for LinuxCNC in 2020 the only way to open or close the grippers is through a GUI pop-up box and the mouse.
Thank you for your time.

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

More
08 Mar 2025 19:45 #323538 by meister
Replied by meister on topic How to Control a PWM Gripper
i use M68 to control my rc-servo gripper's
so i can control it by gcode and for the gui i use mdi commands and a vcp gui with buttons to set some fixed positions

[HALUI]
MDI_COMMAND = M68 E0 Q-100
MDI_COMMAND = M68 E0 Q-75
MDI_COMMAND = M68 E0 Q0
MDI_COMMAND = M68 E0 Q75
MDI_COMMAND = M68 E0 Q100

www.youtube.com/shorts/Tp3savo-MGs

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

More
22 May 2025 20:26 #328935 by robocidalmaniac
Replied by robocidalmaniac on topic How to Control a PWM Gripper
Please do you have any more details on this?
How do you use the M68 to open?
How do you use the M68 to close?
Do you have M68 (number value)?

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

More
22 May 2025 21:08 #328940 by PCW
Replied by PCW on topic How to Control a PWM Gripper
www.linuxcnc.org/docs/html/gcode/m-code.html#mcode:m68

See the note about the hal pin.

Looks like meister was using different numbers for different positions
some likely being fully open and some fully closed
The following user(s) said Thank You: meister

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

More
23 May 2025 04:50 #328958 by meister
Replied by meister on topic How to Control a PWM Gripper
exactly, the servo is configured as an analog output and can be controlled with values from -100 (open) to +100(closed).
net sig_motion_analog-out-00 <= motion.analog-out-00
net sig_motion_analog-out-00 => rio.gripper.position

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

Time to create page: 0.089 seconds
Powered by Kunena Forum