Help understanding fundamentals of linuxcnc

More
16 Jul 2024 17:06 #305376 by Caffink
Hello,
I'm currently trying to retrofit a mill and a lathe. I want to avoid being dependant on copying&pasting others' configurations, but rather understand the fundamentals myself so I can tailor the retrofit to my needs. I've read the documentation, several forum posts and watched Youtube tutorials these last few days, but I don't get how everything ties together. 

I am not sure if I've understood it correctly, but here is how I think Linuxcnc works conceptually. Let's use a 7i95T mesa board connected to a closed loop stepper motor, and how a position/velocity command from GUI makes the stepper motor move as an example.(I've also attached the full HAL file I'm using as a reference). 
Step1) Gmoccapy GUI sends a position/velocity command ->
Step2) The joint.0.motor-pos-cmd sends the command as output, to pid.0.command which takes the command as an input ->
Step3) At pid.0.command the command input gets correction through feedback internally(by PID-component and the correlated feedback pins), and the pid.0.output sends the command as output.
Step4) hm2_[MESA](BOARD).0.stepgen.00.velocity.cmd receive the command as input, which then makes the physical pin/terminal of 7i95T(Terminal block 3, Step 0, pin 1 to pin 6) output the command as step/dir pulses to stepper driver.

Question 1) Is my thought process above correct?

Question 2) How does the GUI like Gmoccapy send position/velocity commands through G-code to a joint/axis when there is no HAL-pins connecting them. Is this done internally? Shouldn't there be a Gmoccapy-pin connected to a Joint-pin from the motion component?

Question 3) How can a jog button make a joint/axis move, when the gmoccapy-jog is a bit input, and joint-pos-cmd is a float output? I.e connecting through net command: gmoccapy.jog.axis.jog-x-plus (bit IN)     to      joint.N.motor-pos-cmd (OUT FLOAT)? Is Linuxcnc internally just registering True/false from Jog button, and then sending the joint/axis the position/velocity command based on INI settings? 

Question 4) How does hm2_[MESA](BOARD).0.stepgen.00.velocity.cmd know which physical pin on the Mesa Board is will send step pulses to? Is this done by the Mesa Firmware when doing the MesaCT config?

Question 5) How does hm2_[MESA](BOARD).0.stepgen.00.velocity.cmd know which "physical pin/terminal" on the Mesa board it should send step pulses to, when it doesn't know if I have wired the 7i95T to the stepper driver with differential signal, or single ended with either common anode or common cathode?

Question 6) I have a difficulty knowing which HAL-pin need what input/output, without looking at other peoples config and decipher/copying them. I feel like this is the biggest part I'm missing from understanding Linuxcnc. I am not sure if I'm using the documentation the right way, because I don't find it intuitive at all. For instance, How should I know that Joint.0.motor-pos-cmd is the HAL-pin that makes a stepper motor move, and that it sends a specific output which hm2_[MESA](BOARD).0.stepgen.00.pos.cmd needs? And that pid.0.output could also be used instead of Joint.0.motor-pos-cmd to control the stepper motor? Maybe I'm just too stupid to connect everything just by reading the description provided by the component documentation. 

Any tips or explanations that could help my understanding of Linuxcnc are appreciated.

Disclaimer: I have no background in Linuxcnc, electronics, programming or anything CNC related. Apologies if I'm asking the obvious.
 

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

More
16 Jul 2024 17:37 - 16 Jul 2024 17:40 #305379 by PCW
1. The GUI does not send motion commands, though through the GUI, the user
may ask LinuxCNC motion component to jog, or pass to MDI commands to the Gcode
interpreter.  The GUI does display the motion that the motion component generates.

2. LinuxCNCs Gcode interpreter communicates with the motion component. The GUI
is just a command and display interface it does no direct motion control.

3. The GUI communicates the jog request to LinuxCNC motion component via hal pins

4. Which physical pins connect to Stepgen 00 is determined by the firmware (Normally
this mapping matches the hardware for example Stepgen 00 connects to the 7I95s
STEP 0 and DIR 0 pins)

5. Not sure about this question but All step/dir pins are always driven and there is no sensing of pins
(DIR- and STEP- are just inverted copies of DIR_ and STEP+)

6. Its not obvious so there are tools to generate the hal/ini files like MesaCT

To understand the inner workings a good approach would be to study a working
hal file in addition to the manual pages of the various components used:

man motion
man hostmot2
man pid
Last edit: 16 Jul 2024 17:40 by PCW.

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

More
16 Jul 2024 18:41 #305384 by Caffink
Question 1+2) It was not obvious to me that the G-code interpreter communicates with the motion component, without connecting them via hal pins. But I think I now understand how the joint-pin from motion component get it's position or velocity command/output from;)


Question 3) How do you connect Gmoccapy jog button to linuxcnc motion component, to make a stepper motor move then?

What I don't understand is how a "gmoccapy.jog.axis.jog-x-plus (bit IN)", is an input pin. Shouldn't it be an output pin? Because you "press" a button, which then sends an output?

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

More
16 Jul 2024 18:53 #305385 by Aciera
gmoccapy provides this button so the user can connect a signal (eg from an external button) for jogging.

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

More
16 Jul 2024 19:16 #305386 by Caffink
I added an attachment and a ring around the jog button I am talking about. So what you are saying is that I don't have to make a Hal pin connection from that jog button with a red ring, with a pin from the motion component, to make the jog button move a stepper motor?

In my mind I'm thinking something like 
  • net x.axis.jog gmoccapy.jog.axis.jog-x-plus => hm2_[MESA](BOARD).0.stepgen.00.velocity-cmd
  • net x.axis.jog gmoccapy.jog.axis.jog-x-plus => joint.0.motor-pos-cmd
I know this statement makes no sense, but it describes what I'm thinking. Shouldn't the jog button give an position or velocity command/output that describes where the axis should go, or cause the Mesa board to produce step pulses?
Attachments:

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

More
16 Jul 2024 19:24 - 16 Jul 2024 19:33 #305388 by PCW
The jog information goes from the GUI or hardware (MPG, Buttons etc)
to motion. Motion takes care of things like bounding acceleration and velocity,
and obeying soft limits. All low level hardware joint motion passes through
LinuxCNCs motion component. At some point the jogging information from the GUI,
switches/MPG gets connected to motions joint and/or axis jog pins:


man motion

(search for "jog" = /jog)
Last edit: 16 Jul 2024 19:33 by PCW.

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

More
16 Jul 2024 19:52 - 16 Jul 2024 19:53 #305392 by Caffink
So when I pass MDI commands to the G-code interpreter, the position/velocity command "signal/value" gets sent to joint.0.motor-pos-cmd for instance

Where or which pin does the position/velocity command "signal/value" get sent to when I press the jog +x button on Gmocappy GUI? Shouldn't a motion component pin receive this signal/value? If so, which one?

I'm also using linuxcnc.org/docs/stable/html/man/man9/motion.9.html , instead of "man motion"currently. Is the "man motion" more descriptive?
Last edit: 16 Jul 2024 19:53 by Caffink.

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

More
16 Jul 2024 20:08 #305395 by rodw
An MPG or on screen jog button usually  alters a count variable or pin up or down (plus or minus) and the count is scaled to steps per mm (or inch). That way the system knows how far the axis should move for every click of the MPG
This also explains why the count is not a float type
The jog velocity to use is set in an ini variable

That man pages eg man motion are also published to the Linuxcnc documents web site. I always use the web site. Just make sure you read the docs for your version of Linuxcnc.
The documentation for a component is actually coded into the component itself and extracted to a man page (and the web page) using halcompile when Linuxcnc is built

Keep it up. One day it will eventually click
The following user(s) said Thank You: Caffink

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

More
16 Jul 2024 20:09 #305396 by PCW
Yes, typically all motion commands to lower level hardware come
from motions joint.n.motor-pos-cmd pins.

The basic jog information to motion uses motions jog pins like
axis.x.jog-counts and axis.x.jog-enable

The manual page and the HTML should be identical as they come
from the same source.
The following user(s) said Thank You: Caffink

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

More
16 Jul 2024 20:27 #305400 by Aciera
Most GUIs are written in python and use the Linuxcnc python API instead of connecting signals through hal pins:
linuxcnc.org/docs/devel/html/config/python-interface.html

Over time you will find that there usually are several possible ways to get something done in LinuxCNC.
The following user(s) said Thank You: Caffink

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

Time to create page: 0.146 seconds
Powered by Kunena Forum