GlobalGet and var Name

Discussions and file drops for Auggie
MaynardC
Site Admin
Posts: 35
Joined: Wed Feb 27, 2013 3:28 pm

GlobalGet and var Name

Post by MaynardC »

Hello All,
Have my 57CNC up and running with Auggie, powering a stepper on Axis 6 on the benchtop. I haven't been able to find an explanation of Control property Var Name in any of the discussions. It seems to bind the value property of an DRO to the assigned name, not sure about other controls. Anybody have a brief explanation of how Var Name works and the modes of operation for each Axis?

A long the same lines, I would like to get the current position of axis 6,as I jog along.Tried GlobalGet("Axis6CurPos") but returns 0 always.

Code: Select all

FreeSetAxisMode(6,1); 
FreeSetSpeed(6,500);
count=0;
while(1) {
  if(count%30==0) {
    print(GlobalGet("Axis6CurPos")); // always 0
  }
  count=count+1;
  yield();
}
Thanks
Maynard

ArtF
Global Moderator
Global Moderator
Posts: 4557
Joined: Sun Sep 05, 2010 5:14 pm
Contact:

Re: GlobalGet and var Name

Post by ArtF »

Hi Maynard:

 

  A DRO, Button or whatever, may be set to a Var name. If its empty, then the DRO is refered to only by getting its interface
in a script as in

  myDro = DRO("MAIN_DRO_1");
 
v = myDro.GetCurrent(); //etc..

    as shown in the first video, BUT, if you place a variable name in the VarName, the control
becomes a new variable, OR attaches to one already existing. For exmaple, to show the system current feedrate, one only needs to
tell the DRO is a var name of "FeedRate".  Most of the controls on the release screen are variable named to internal names, so really
they are attaching to variables declared internally. So if you want to find a value you dont know how to get, simply open the
scripter, turn it on, then right click any control that shows what you want, if you click the FreeAxis A position ( axis 8), youll see
its a var name of "Axis8CurPos", unfortunatley , youd have to open the freeaxis panel to see that as the scripter
and the editor will not show that for a panel control.

  So when you see such a variable, that means it is a global one, so in a script you may use

current8 = GlobalGet("Axis8CurPos");

  If you enter a varname you make up, like "Toyota" in a DRO, then you may send or gets its value with GlobalGet and GlobalSet
as by naming it, you have created a global value all scripts can see.

  Thats the short version of how variables work.

  As to the FreeAxis, they work any of them can be speed or postion based, you canot switch their mode while moving them.
So set them once and dont change them unless they are stopped. Mode 0 is position, mode 1 is speed. When in speed
any speed set is in units/min .  Any not in speed mode, are considered to be in position mode. Any speed axis is ignored
for a FreeFeedTo move. I will be adding a vector3 based call for getting the x,y,z of the free axis in one call.




Art
MaynardC
Site Admin
Posts: 35
Joined: Wed Feb 27, 2013 3:28 pm

Re: GlobalGet and var Name

Post by MaynardC »

Thanks for the explanation, Art

Should a Free axis in Speed mode show it's position via GlobalGet("Axis6CurPos")?
I place a new DRO on the screen with Var Name set to Axis6CurPos ... and it stays at 0 as I jog Axis 6
When Var Name is changed to Axis6Vel ... it shows the correct velocity of axis 6 in the  DRO
Seems Axis6CurPos isn't working

Maynard
ArtF
Global Moderator
Global Moderator
Posts: 4557
Joined: Sun Sep 05, 2010 5:14 pm
Contact:

Re: GlobalGet and var Name

Post by ArtF »

Maynard:

  No, an Axis in free mode will not show a position, this is to reflect the fact it is
capable only of velocity, AND to reflect the fact the other 4 axis are still in
a coordinate system just that any speed axis will always read zero as a potion..

Art
MaynardC
Site Admin
Posts: 35
Joined: Wed Feb 27, 2013 3:28 pm

Re: GlobalGet and var Name

Post by MaynardC »

I'm driving a conveyor of sorts, and need the position as I drive it. I moved it back to one of the first four axis's,and used the Jog*P/Jog*M to move it. Couldn't get the Jog to work on the Free axis.

Thanks for the insight
Maynard

ArtF
Global Moderator
Global Moderator
Posts: 4557
Joined: Sun Sep 05, 2010 5:14 pm
Contact:

Re: GlobalGet and var Name

Post by ArtF »

HI Maynard

Jogging cant be done to a free axis.. BUT, I can see where youd want to know a conveyor location..
so Ill add a global for free speed axis locations..

Art
MaynardC
Site Admin
Posts: 35
Joined: Wed Feb 27, 2013 3:28 pm

Re: GlobalGet and var Name

Post by MaynardC »

Thanks Art

Maynard
Amazon [Bot]
Full Member
Full Member
Posts: 185
Joined: Tue Jan 06, 2026 4:56 pm

Re: GlobalGet and var Name

Post by Amazon [Bot] »

Could you not just compute the number of steps sent, as where it should be at after homing & zeroing? Then update the DRO the computed value? (send it toward home when it sees the limit it sets zero position)

It takes so many pulses per unit and that step value should beable to tell your where your at.
Then just update the DRO as to that value.
MaynardC
Site Admin
Posts: 35
Joined: Wed Feb 27, 2013 3:28 pm

Re: GlobalGet and var Name

Post by MaynardC »

How would I access the settings (Steps/unit) ,and get notified when homing/zeroing occurred. You would also have to allow for accel/decel, which I believe is handled on Pokeys in speed mode.  On the same note, I can see the global functions from the drop down list in the scripting debugger, but is there a way to see there parameters?
ArtF
Global Moderator
Global Moderator
Posts: 4557
Joined: Sun Sep 05, 2010 5:14 pm
Contact:

Re: GlobalGet and var Name

Post by ArtF »

HI Maynard:

  In the next version will be able to use Engine.SetPosition to set any of the 8 axis positions.
I will also allow for a call to get the positions of any "speed" axis.

  TO be notified of homing , limits and Zeroing, you will be able to use a kernal callback function in the library
which will (hopefully) also appear in the next version. The callback library should be modified by you to do
any activity you wish for the events named by the callback. Such as OnEnable() or OnZero(axis).. As users determine they wish to be notified of various internal events, I will add callbacks for that notification.

  Many other things you will use a block to get notification for. For example, there is no sense updating
a DRO constantly from a loop using up system time and resources.. so the new signal named MotionUpdate will allow
a script to only do its work after the axis have moves, and no more than 4 times a second by using a script such as

global MyDROUpdate = function()
{
    GoPara(); //this function will run in parallel in the system
    while(1)
  {
        block("MotionUpdate");
      //update your dro's here, they will update no more than 4 times a second, and only after motion..
  }
};

  You would put such a function in one of your libraries, ( because mine get overwritten on install), and then
in  a mainscreen init script, call

thread( MyDROUpdate); //this will spin this function off into space to work in the background..

  Ill explain more on next release, within a few days..many bugs have been scratched from the ground..

Art
Post Reply