Conceptual question about stepgen axis control

More
23 May 2011 20:45 #10013 by thebuc
Hey guys,

I've been trying to look deeper into how all of this stuff works and I have a question.
Here is the HAL code that controls one of my axes: (i excluded all the things like loadrt and threads)

setp stepgen.0.position-scale [AXIS_0]SCALE

setp stepgen.0.steplen 1

setp stepgen.0.stepspace 0

setp stepgen.0.dirhold 45000

setp stepgen.0.dirsetup 26000

setp stepgen.0.maxaccel [AXIS_0]STEPGEN_MAXACCEL

net xpos-cmd axis.0.motor-pos-cmd => stepgen.0.position-cmd

net xpos-fb stepgen.0.position-fb => axis.0.motor-pos-fb

net xstep <= stepgen.0.step

net xdir <= stepgen.0.dir

net xenable axis.0.amp-enable-out => stepgen.0.enable


I think i understand how it takes an input position command from the user and then creates a stepgen signal with the right number of steps to get exactly to that position while staying below the max accel and velocity.
But im wonding how does it take the feedrate input from the user?
Say if i did the MDI command:
x1 F5

I think i understand how stepgen can make the machine go to x=1, since each pulse is 1 microstep, but how does it do it at a feedrate of 5? I don't see any input pins for feedrate/velocity.

I know it could adjust velocity by adjusting the frequency of the pulses but where is my input feedrate used?

Thanks
-Greg

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

More
23 May 2011 20:51 #10014 by andypugh
EMC2 sends a new position command every millisecond (typically, whatever the servo thread rate is). It is the rate of change of that value which controls the feed rate.

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

More
23 May 2011 21:07 #10015 by BigJohnT
This is just the tip of the iceberg... the trajectory planner does the magic from what the interpreter sends it "I think"

From the user end this is a good read.

www.linuxcnc.org/docview/html/common_User_Concepts.html

This is the Developers Manual

www.linuxcnc.org/docs/EMC2_Developer_Manual.pdf

John

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

More
23 May 2011 21:13 #10016 by thebuc
Hmm okay.
So maybe it goes like this: ? (continuing with previous example)
if i say
x1 F5

EMC will automatically divide 1inch by 5in/min to get some total travel time so 0.2min
and then it will do 0.2min/1milisec = 12000 position commands

and then you could do 1inch/12000 commands and get some really small distance per command? and i guess this would be at the feedrate.

so on every new command it would say go that much further and keep the feedrate constant. And this would be coming in from "axis.0.motor-pos-cmd"

i guess the first few commands and the last few are a bit odd though because of max acceleration. And i guess a millisecond is a small enough time frame that it can never accelerate past the feedrate? Hmm.

Is that sort of how it is calculated?

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

More
23 May 2011 21:42 #10017 by BigJohnT
If you don't have the naive cam detector enabled (in the link) then EMC calculates the acceleration to the feed rate and also slows down in time to stop at the end point, so it is a very complex calculation.

This is a good link to Anders Wallin's page that explains the trajectory planner.

www.anderswallin.net/tag/emc2/

John

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

Time to create page: 0.063 seconds
Powered by Kunena Forum