Moving robot joints by only 1 Gcode command?

More
1 year 6 months ago #325527 by heaven
Hi, 
Right now, i'm trying to control a 6-dof robot by linuxcnc, I found kinematic-switch function for moving joints from Gcode.I guess I need to make 3 Gcode commands to just do one task like:
1st-cmd: Use M code command to switch to nontrivial kin
2nd-cmd: use G code command to move joint
3rd-cmd: Use Mcode command to switch back to trivial kin
Yes, it can do my job but it complicated and not friendly. has anyone tried to merge these commands to a single one or any other way to do something similar 

Please Log in to join the conversation.

More
1 year 6 months ago #325530 by Aciera
choose an unassigned gcode number and use a remap to fold those 3 commands into one.

Please Log in to join the conversation.

More
1 year 6 months ago #325572 by heaven
Thanks for your reply.
Can you explain in more detail, as I understand I should:
1. Creating an O-code for a subroutine that contains these 3 commands
2. Remap a new G-code that will call the O-code above
Is this what you mean or is there a more straightforward way?

Please Log in to join the conversation.

More
1 year 6 months ago #325597 by Aciera
Yes, that is the idea.

Here is an example using an ngc remap:

REMAP = G01.1 modalgroup=1 argspec=xyzabc ngc=g011remap
Code:
o<g011remap>sub M66 L0 E0 ;force sync, stop read ahead M428 o100 if [EXISTS [#<X>]] o100 else #<X> = #<_x> o100 endif o101 if [EXISTS [#<Y>]] o101 else #<Y> = #<_y> o101 endif o102 if [EXISTS [#<Z>]] o102 else #<Z> = #<_z> o102 endif o103 if [EXISTS [#<A>]] o103 else #<A> = #<_a> o103 endif o104 if [EXISTS [#<B>]] o104 else #<B> = #<_b> o104 endif o105 if [EXISTS [#<C>]] o105 else #<C> = #<_c> o105 endif G1 X#<X> Y#<Y> Z#<Z> A#<A> B#<B> C#<C> M429 o<g011remap>endsub m2

Please Log in to join the conversation.

More
1 year 6 months ago #325630 by heaven
After trying this idea, i faced another problem: every time I stop the program during movejoint command. The controller doesn't return default kin, I have to use M code to switch back manually, I tried to hack into the controller(the command.c file) to force it to return to default kinematic every time I hit stop or estop. tks, it worked 

Please Log in to join the conversation.

More
1 year 6 months ago #325631 by Aciera

Please Log in to join the conversation.

More
1 year 6 months ago #325689 by heaven
I tried your way but no luck. Every time I put M428 into on_abort Subroutine, i got error:
interp_error: File ended with no percent sign (%) or program end (M2)
File ended with no percent sign (%) or program end (M2)

Please Log in to join the conversation.

More
1 year 6 months ago #325696 by Aciera
Try this in your on_abort subroutine instead of 'M428':
Code:
#<kinstype> = 0 #<SWITCHKINS_PIN> = 3 ; set N as required: motion.analog-out-0N M68 E#<SWITCHKINS_PIN> Q#<kinstype> ; set kinstype value

Please Log in to join the conversation.

More
1 year 6 months ago #325736 by heaven
thanks, It's work perfectly now

Please Log in to join the conversation.

Time to create page: 0.103 seconds
Powered by Kunena Forum