Andy,
Thanks so much!
I had a dig through some of the motion planner, and it seems when an incremental jog is commanded by the GUI using NML, then this is the associated case in
:
github.com/LinuxCNC/linuxcnc/blob/master...otion/command.c#L841
If the incremental jog is accepted, if it is a joint jog (free mode), it seems to handle all of the logic there, with the target position assigned as follows:
/* set target position for jog */
if (emcmotCommand->vel > 0.0) {
tmp1 = joint->free_tp.pos_cmd + emcmotCommand->offset;
} else {
tmp1 = joint->free_tp.pos_cmd - emcmotCommand->offset;
}
Whereas, if it is an axis jog (teleop mode), it will call the function
void axis_jog_incr(int axis_num, double offset, double vel, long servo_period) {}in
:
github.com/LinuxCNC/linuxcnc/blob/master...c/motion/axis.c#L279 if (vel > 0.0) {
tmp1 = axis->teleop_tp.pos_cmd + offset;
} else {
tmp1 = axis->teleop_tp.pos_cmd - offset;
}
So, for both joint and axis, the way the position is assigned is essentially the same, it modifies either the value of
or
by the value of the jog incremental offset.
These would be the hal pins... which actually already exist as
and
!
I thought I'd tried the axis ones already but I must've forgotten to home the sim and since I had the joint jogging pins connected as well I didn't realise I wasn't using teleop
But yeah, the 'backlog' of incremental jog-counts is just converted into a teleop or free mode motion planner position (which explains why a backlog acts just like a continuous jog).
And, yes, I did sort of avoid saying why I was looking into this (sorry!), wanted to see if this way would work first!
I was looking at
meister
's camjog widget
github.com/multigcs/riocore/blob/main/ri...ons/camjog/camjog.py
It jogs via jog-counts (which is definitely the best way to do this), but the only drawback is that it can move in a dogleg if one joint or axis takes longer than the other to reach the destination.
But, if you compare the 'jog DTG' (my test assumes both have the same max velocity) for x/y (or the joint equivalent), you can scale down the velocity of the joint/axis which has the smaller DTG according to its proportion against the joint/axis which has the larger DTG, and then use that to scale the milltask joints/axis max_vel pins.
And the other required logic is that if at least one of the joints/axes is within positional tolerance of the target position, the velocities of both the joints/axes need to be set back to 100%.
Anyway, this is sort of trying to force free or teleop mode to act like coordinated mode. It's quite similar to anglejog, actually,
but it acts later by calculating the 'Jogging DTG' from existing counts with the same scale (from camjog) and modifying the velocities to follow the resultant instead of calculating the counts itself.
I'll try and flesh out the component a bit more now I know it works.
Also, I still can't figure out why joint jogging is still doglegging
It's not a big deal for me as long as axis jogging works but I want to know why it's not working