Change Stepgen Control Type Online [SOLVED]

More
06 May 2016 14:48 - 06 May 2016 15:34 #74301 by alessandro torre
Hi, in our experimentation we need to switch from a "velocity" control to a "position" control and viceversa, online.
Our setup consist in a 6i25+7i76 mesa card, so we can see both control type after the loading of the hostmot driver.

All seems to work, exept the displayed coordinates in the Display section. Probably we miss to net something.
Downside I attached the M code that we wrote to do the switch.
Someone know this issue?
Are the coordinates displayed the stepgen-position-feedback or stepgen-velocity feedback?

Thank you in advance

M110
#!/bin/sh
#Disconnect the nozzle to the XY velocity
halcmd unlinkp  VelocityExtruder.0.Va 
halcmd unlinkp  hm2_5i25.0.stepgen.03.velocity-cmd
halcmd unlinkp  hm2_5i25.0.stepgen.03.velocity-fb
halcmd setp hm2_5i25.0.stepgen.03.control-type 0
halcmd net emcmot.03.pos-cmd  axis.3.motor-pos-cmd
halcmd net emcmot.03.pos-cmd  hm2_5i25.0.stepgen.03.position-cmd
halcmd net emcmot.03.pos-fb   hm2_5i25.0.stepgen.03.position-fb

exit 0

M111
#!/bin/sh
#Connect the nozzle to the XY velocity
halcmd unlinkp  axis.3.motor-pos-cmd
halcmd unlinkp  hm2_5i25.0.stepgen.03.position-cmd
halcmd unlinkp  hm2_5i25.0.stepgen.03.position-fb
halcmd setp hm2_5i25.0.stepgen.03.control-type 1
halcmd net emcmot.03.pos-cmd  VelocityExtruder.0.Va 
halcmd net emcmot.03.pos-cmd  hm2_5i25.0.stepgen.03.velocity-cmd
halcmd net emcmot.03.pos-fb   hm2_5i25.0.stepgen.03.velocity-fb

exit 0
Last edit: 06 May 2016 15:34 by alessandro torre. Reason: Solved the issue

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

More
06 May 2016 15:00 #74302 by Todd Zuercher

Are the coordinates displayed the stepgen-position-feedback or stepgen-velocity feedback?
exit 0[/code]


They are supposed to be position feedback, but the number is going to be what ever you have connected to "emcmot.03.pos-fb", and it appears that you are switching it between the velocity and position feedbacks of the step gen.

What are you trying to accomplish? Perhaps we could suggest a better option, if we knew more.

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

More
06 May 2016 16:04 #74305 by alessandro torre
Sorry, I solved. I wronged the signal. The right one is:

halcmd net motor.03.pos-fb hm2_5i25.0.stepgen.03.position-fb
instead of:
halcmd net emcmot.03.pos-fb hm2_5i25.0.stepgen.03.position-fb

Now it works!
We are trying to generate the 4th coordinates by a component that reads the velocity of X and Y.
In this way the trajectory planner, seems to work properly and we have a better extrusion in the corner.

The problem was that when the machine did rapid movements, or movements without extrusion we needed to disconnect the 4th axis from the X and Y. If there was a retraction in the gcode, the machine can follow that retraction, without conversions or post processing.
In the picture attached, you can see the difference in the corners. On the left with normally sliced gcode, on the right with the nozzle linked to the X and Y velocity.

Thank you
Attachments:

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

More
08 May 2016 09:46 #74360 by andypugh
I think that re-wiring HAL like this feels somehow wrong. It's like re-wiring a circuit rather than operating a switch.
As it is all software there is probably no practical reason to not do it your way, but you could probably do things with a few HAL "mux" component to switch between the control modes on the basis of motion mode. (motion.motion-type : linuxcnc.org/docs/2.7/html/man/man9/motion.9.html )

The Mesa stepgen control-type pin is a HAL pin, so can be switched by HAL logic, but it might be better to leave it in velocity mode and switch between different PID controllers depending on operating mode.

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

Time to create page: 0.063 seconds
Powered by Kunena Forum