Jogging with hal commands only

More
21 Sep 2019 00:16 #145724 by oddwick
Ok, the title sums it up. I am working on a proof of concept project, and have ran up against a wall. I know this can be done, but i can't seem to find a way. So after going through 46 pages of search results with no answer i have to post. There has to be a simple solution, but i cant seem to find it.

What i have is a comp that reads serial input. what i need is a command, or sequence of hal commands that when a certain code is received, that an axis will be selected, the display in Axis will show the selected axis, and then it will move a designated amount. sounds simple, right?

but there are certain conditions...
1. it has to be done through serial (which by the way works fine and l-cnc sees the input and i can change values ok) - no second parallel ports, no mesa, no gecko, no ethernet, etc. for the purpose of my project, it HAS to be serial.
2. it has to be an axis that is jogged, not a joint (my machine is a gantry, jogging a joint would be a DISASTER! How do i know?...)
3. preferably, i would like whichever axis i have selected to be reflected in Axis in manual mode. whenever you jog using keys, the selected axis changes and i can read it, but for the life of me i can't set it...

as it sits, i have set every possible flag in hal and the only result is that i got the axis to move, but continuously. does it make a difference that i am only using linuxcnc in sim mode? it is easier to use the same computer for design and testing rather than going back and forth to the shop and definitely safer than testing it out on a real machine!

Im using master 2.9, updated about a week ago in virtualbox on a mac pro

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

More
21 Sep 2019 05:52 #145733 by cmorley
The first problem is that linuxcnc has no internal concept of selected joint/axes.
Each screen keeps track of it's own selected axes. (aside from the new QtVCP screens- they keep track of selected axes in a way that can be reported easily )

The second problem is AXIS. AXIS does not lend it's self for easy modifications.
luckily you are using 2.9 which has more documentation/access to AXIS's insides.

look here:
linuxcnc.org/docs/devel/html/gui/axis.ht..._customization_hints
My guess is you'll need to make HAL pins to select axes. Unfortunately the docs don't mention what function selects axes. You'll have to look in AXIS's source code to find it and figure out how to trick it. (maybe someone else knows and can help you - Phill of PlasmaC fame is probably the best expert in modifying AXIS.

The problem I see right away is that what do you want to happen if your interface selects X axis then someone on the screen selects Y?

QtVCP has a AXIS look alike that would be _much_ easier to modify but it is not as feature complete nor well tested as AXIS but I would help as much as I can to get it up to speed. You can check it out in linuxcnc 2.9 under sim/qtvcp_screens/qtaxis

Chris

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

More
21 Sep 2019 15:46 #145757 by oddwick
Thanks Chris for the reply!

thats KIND OF what i am looking for, but not quite...

i guess i should give a few more details first. what i am working on is a pendant/handwheel based off of arceyes arduino based pendant over here: Arduino Based usb pendant

I have a spare clickwheel on hand and decided to put it to good use, so using that post as a starting point, ive been going at it. While the idea is brilliant, there is a huge flaw in the logic of it (as well as the fact that it doesnt work in 2.8/9) which is that the arduino is tasked with keeping track of the commands being sent. for example, if you press the estop button, the arduno shows that the estop is pressed, but the machine might not register the keypress, and not you have a discrepancy between what is being displayed and the actual. this could lead to some serious problems.

so i have re-written the code the computer tells the arduino what is going on and it is displayed accordingly. this way your pendant and machine are in synch. plus there is alot more going on, and i will post all of it later on a new thread, but ive never been one for posting projects until they get completed and actually work. so like i said this is a proof of concept. if i cant make the machine move, then its a dud!

the problem i am running into, is that:
1) i can't get the machine to jog from sending commands to linuxcnc. everything else works great, estop, flood, spindle, etc, but i cant budge the position to save my life!

and 2) i can read the currently selected axis at
axisui.jog.x
but as far as i can tell its downstream only.
I was hoping that if i could read it, i could set it, or another flag that would trip it. I am only using Axis because that is what i started using back first used linuxcnc, but it wasn't until recently that it was only the frontend and i started making changes to it. I was rather hoping to keep this frontend agnostic if i could, but now i have my doubts

The first problem is that linuxcnc has no internal concept of selected joint/axes.

so there is no universal halpin that says "Axis N which consists of n joints is currently selected"? is it possible to create one? well, thats not like an overt hack anyway? my problem is that i am just now beginning to play around behind the scenes in linuxcnc and am only now getting a tenuous grasp of how hal works. i am a coder with years of experience, but only a passing knowledge of lower level languages and Cx languages (my specialty is PHP with ruby and python). So i get the concepts, its the implementation i struggle with as well as the fact the im used the there being a fx that just does what you want (spitting an array in C :angry: its a wonder i have any hair left!!!)

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

More
21 Sep 2019 20:00 #145786 by cmorley

so there is no universal halpin that says "Axis N which consists of n joints is currently selected"? is it possible to create one?

There is no pin nope. to create a meaningful pin linuxcnc would need to track selected axis (and joint) and as I said it doesn't have that concept.
There is a fairly good reason - linuxcnc was designer way back in NIST days to be run from multiple GUIs.
To have that work properly the setting controls must be momentary.
eg. coolant
momentarily push coolant button - set_on()
momentarily push coolant button -set_off()
check coolant status - is_coolant_on(); returns true or false
(you might recognize this pattern from HALUI)

That doesn't lend it's self to some controls like axis selection - where you select it (often with selector switch) and can't have it changed by some other program.

So they made it the screens problem to keep track of the selected axis.
You need to ask the screen what the selected axis is an AXIS was not designed to do that.

In 2.8+ I have added a somewhat experimental axis selection memory using python's hal_glib module.
linuxcnc.org/docs/devel/html/gui/GStat.html
The docs are out of date - so don't mention axis selection messages
That scheme is used in qtvcp to keep track of qtvcp's current selected axis/joint
This scheme has it's own limitations. - ultimately the functions I added to hal_glib really need to be in linuxcnc's status messages so they can be queried by anyone - and then we would need everyone to agree to use this process for axis selection and live/deal with the problem of multiple screen selecting different axes.

So hopefully you see it's actually a difficult problem to solve satisfactorily.

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

More
22 Sep 2019 00:54 #145805 by oddwick

So hopefully you see it's actually a difficult problem to solve satisfactorily.

That actually that makes alot of sense, and is ironically similiar to the problem i am dealing with where the pendant was responsible for keeping track of what it was sending to the machine and getting lost in translation...

There is no pin nope. to create a meaningful pin linuxcnc would need to track selected axis (and joint) and as I said it doesn't have that concept.

So does that mean in essence that linuxcnc is stateless? would it be possible to create a pin that remembers the last axis that moved in jog mode?

if not, i have an alternate idea of how to logically approach this, but it is not my first choice, but after your responses it might be the better choices.

but with that being said, is it possible to jog an axis using just hal commands regardless of the frontend? theoretically, if im correct, that if a command is sent to the right pin and the machine moves, then the dro should match the current position even though it was moved outside of the front end?

thanks
dexter

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

More
22 Sep 2019 01:34 #145807 by cmorley
linuxcnc has no internal memory of selected axes. it jogs what ever axis the GUI tells it to jog.
jog commands are (roughly) jog(this axis, this fast, this far)

The only selected axes/joints linuxcnc knows about are MPG jogging - MPG jogging interacts directly in linuxcnc's motion component. - it's actually different from normal jogging.
MPG jogging was put in motion so it would respond better IIRC.
MPG jogging uses HAL pins to select what axis/joint to move.


It would be possible to make a last-axis-jogged pin but the linxucnc project would not accept that in a released version, so you would be on your own to have it.

It seems to me you have about three options:

1) using the .rcaxis technique, tap into AXIS and create away for your pendant to communicate with AXIS.
or make AXIS not display it's axis selection/jog buttons

2) use HALUI/HAL pins or make a python program for jogging linuxcnc and ignore the problem of AXIS/pendant not showing the same selected axis.

3) use Gscreen/Qtvcp or even GMoccapy screens to do the same as 1 - they are much more suited to modifications

Chris

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

More
22 Sep 2019 02:26 #145814 by oddwick

MPG jogging was put in motion so it would respond better IIRC.
MPG jogging uses HAL pins to select what axis/joint to move.

So which pins or sequence of pins exactly jog an axis? is mpg jogging a separate component or is it already in motion? i have poured over all the hal pins trying to get any on just to move an axis and sometimes the documentation is either obtuse, outdated, or non-existant and i have scoured over the internet trying to find out. im starting to think what i am asking is either so simple or obvious to those who know its rather like asking what "color is blue"...

basically, i want to go -> hey you axis, move x units, do it now, tell me where you are.

i know it can be done without any changes to the program because every gui can do it!

It would be possible to make a last-axis-jogged pin but the linxucnc project would not accept that in a released version, so you would be on your own to have it.

oh i understand completely. thats not quite what i meant, more like a user created pin in hal or postgui.hal. i have a vision of what i want it to do and i'm trying to find a solution that is both elegant and logical. ideally i would like this to work with as little configuration as possible. plug it in and go.

right now i am exploring options and its difficult as i am removed from my native environment. i actually feel alot like a diesel mechanic working on an airplane. its all wrenching, but its a whole different animal im working on.

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

More
22 Sep 2019 02:48 #145818 by cmorley

basically, i want to go -> hey you axis, move x units, do it now, tell me where you are.
i know it can be done without any changes to the program because every gui can do it!


Well you said you wanted the screen (AXIS) to notice the change in your pendant's axis selection.
That is the problem. - No screen can do that easily.

You need to decide how you want to work around that problem.
Chris

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

More
22 Sep 2019 04:36 #145821 by oddwick

You need to decide how you want to work around that problem.


actually your post was super helpful and i realized i was barking up the wrong tree. i was so concerned that the data on screen match the data on the pendant and one of the parameters was the selected axis, but i was pulling the value from axisui. but after what you said, i actually sat down and put a long think on it and realized that what the gui shows is ONLY relevant to the gui. if the pendant says the axis N is selected, and axis N is what moves when the jog wheel is turned or button pressed, thats all that matters right? so instead i believe i will set/read halui.axis.N.select provided of course that halui is universal and not gui specific. this should satisfy my desire for
gui agnostic hal pins.

so going from there, that really actually makes it MUCH easier. thank you alot!

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

More
23 Sep 2019 12:09 #145948 by andypugh
Typically your pendant would send its own opinion of which axis to jog, and also the current MPG jog counts.

Then it is just simple HAL connections.

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

Time to create page: 0.080 seconds
Powered by Kunena Forum