Is there a Halpin for the current feedrate

More
02 Jun 2020 17:08 - 02 Jun 2020 17:09 #169823 by rodw
Thats very exciting you got that far.
motion.motion−type will let you know if it is a traverse (G0), Linear feed (G1) or an arc (G2,G3) so you should be able to filter it from here.

The problem with motion.requested-vel is that it reports the feedrate that the motion controller has set for a given segment which can be reduced if it is too short a segment to allow the trapezoidal acceleration profile get to the feedrate. These graphs hopefully demonstrate what I mean. The one on the right is constrained to 6000 mm/min instead of 10240 mm/min as on the left


If you use halscope to monitor motion.current-vel, you will get exactly this shape. It would be interesting to monitor your pin with motion.current-vel and motion.requested-vel in halsope on short profiles to confirm it is correct.

So now it would be great if somebody could give a clue about how to access the same data from a realtime component created with halcompile. Something I've wanted to do for a long time.
Attachments:
Last edit: 02 Jun 2020 17:09 by rodw.

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

More
02 Jun 2020 17:33 #169834 by rodw
Actually, rereading your last post, I did not address the feed override. You need to calculate the true feedrate yourself with some simple maths. You can do this in your screen handler. Its ages since I played with that stuff but cmorely is the expert. So hopefully he will help if you get stuck.

And of course in that handler you can set the value to zero when motion.motion-type = 0 (idle)

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

More
03 Jun 2020 05:38 #169912 by Aciera
I did a quick check with the hal scope to compare motion.requested-vel, motion.current-vel and feedrate.current.
Given the slow update rate of the feedrate.current pin it seems to follow motion.current-vel.


Attachments:

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

More
03 Jun 2020 09:11 #169927 by rodw
I thought that was too easy!

Refer github.com/LinuxCNC/linuxcnc/blob/master/lib/python/hal_glib.py

looks you are getting a copy of motion.current-vel if you search for the message you used.

Statetags are defined in github.com/LinuxCNC/linuxcnc/blob/master...c/motion/state_tag.h

and that structure is included in the structure emcmot_command_t which is defined in motion.h
github.com/LinuxCNC/linuxcnc/blob/master.../emc/motion/motion.h
So it says that a copy of this is included in shared memory so it should be reachable from a python program.
the physical structure is here
github.com/LinuxCNC/linuxcnc/blob/master.../emc/motion/motion.c

So how to use state tags is is not documented anywhere. I wish it was.

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

More
03 Jun 2020 12:20 #169935 by Aciera
Hm, I'm somewhat out of my depth here but I wonder if this wasn't to be expected considering we're using a python script instead of a precompiled component written in C.

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

More
03 Jun 2020 12:42 #169936 by rodw

Hm, I'm somewhat out of my depth here but I wonder if this wasn't to be expected considering we're using a python script instead of a precompiled component written in C.


You are not the only one out of your depth! It says its available in shared memory so it should be visible from Python too.

I Wonder what comes back when you run this?
linuxcnc.org/docs/devel/html/config/pyth...ding_linuxcnc_status

Writing components in C is super easy. Grab an example from git hub github.com/LinuxCNC/linuxcnc/tree/master/src/hal/components

and modify it then type: halcompile --install mycomp.comp (if not using run in place you may need sudo)
The following user(s) said Thank You: Aciera

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

More
03 Jun 2020 13:33 - 03 Jun 2020 13:35 #169939 by Aciera

I Wonder what comes back when you run this?
linuxcnc.org/docs/devel/html/config/pyth...ding_linuxcnc_status


This:

Warning: Spoiler!


I'd say that is a pretty comprehensive overview of the system.
Last edit: 03 Jun 2020 13:35 by Aciera.

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

More
03 Jun 2020 14:08 #169941 by rodw
Well, I've been digging through the code and came up with these variables in the state tags as being the ones we want.
emcmotStatus->tag->fields-float[GM_FIELD_FLOAT_LINE_NUMBER]
emcmotStatus->tag->fields-float[GM_FIELD_FLOAT_FEED]
emcmotStatus->tag->fields-float[GM_FIELD_FLOAT_SPEED]

When I am near my machine again, I Was going to try creating an external variable inside a component. But its midnight here...
The following user(s) said Thank You: Aciera

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

More
03 Jun 2020 14:11 #169942 by rodw
I was hoping you might see a structure similar to the state tags, but it does not seem so. I'd say the python structure needs updating.

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

More
07 Jun 2020 01:47 - 07 Jun 2020 01:48 #170433 by rodw
Well I made some progress pulling out state tags data using the debug pins This is using the default axis metric sim.



Note these are parameters, not pins, so open the correct section in halshow. The first entry is the feed rate, second entry is spindle speed

In /src/emc/motion..c around line 1937 make these changes (The first two lines need to be added, then the last two need to be modified
    struct  state_tag_t *tag;
    tag   = &emcmotStatus->tag;
    emcmot_hal_data->debug_float_0 = tag->fields_float[GM_FIELD_FLOAT_FEED];
    emcmot_hal_data->debug_float_1 = tag->fields_float[GM_FIELD_FLOAT_SPEED];

I think I know now how to add dedicated pins for the state tags now so I''ll keep playing with this.
Attachments:
Last edit: 07 Jun 2020 01:48 by rodw.
The following user(s) said Thank You: Aciera

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

Time to create page: 1.725 seconds
Powered by Kunena Forum