control.c coord_cubic_active && eoffsets: no Drain

plasmac use case:
  Closing program (m2) after initiating clearing of external offsets
  exposes transient reset of joint->vel_cmd (2 servo periods)
  because of cubicDrain() on transition from coord mode to
  teleop mode.

  This commit: conditionally disable cubicDrain() if external offsets active
  at transition

Thanks to Phillc,snowgoer540 for isolating problem in a sim config
This commit is contained in:
Dewey Garrett 2021-02-27 05:55:08 -07:00
parent 3ff7a32638
commit 9fc45963f6

View file

@ -32,6 +32,7 @@
static int ext_offset_teleop_limit = 0; static int ext_offset_teleop_limit = 0;
static int ext_offset_coord_limit = 0; static int ext_offset_coord_limit = 0;
static double ext_offset_epsilon; static double ext_offset_epsilon;
static bool coord_cubic_active = 0;
/* kinematics flags */ /* kinematics flags */
KINEMATICS_FORWARD_FLAGS fflags = 0; KINEMATICS_FORWARD_FLAGS fflags = 0;
KINEMATICS_INVERSE_FLAGS iflags = 0; KINEMATICS_INVERSE_FLAGS iflags = 0;
@ -835,14 +836,20 @@ static void set_operating_mode(void)
if (joint_num < NO_OF_KINS_JOINTS) { if (joint_num < NO_OF_KINS_JOINTS) {
/* point to joint data */ /* point to joint data */
joint = &joints[joint_num]; joint = &joints[joint_num];
if (coord_cubic_active && *(emcmot_hal_data->eoffset_active)) {
//skip
} else {
cubicDrain(&(joint->cubic)); cubicDrain(&(joint->cubic));
}
positions[joint_num] = joint->coarse_pos; positions[joint_num] = joint->coarse_pos;
} else { } else {
positions[joint_num] = 0; positions[joint_num] = 0;
} }
} }
coord_cubic_active = 0;
/* Initialize things to do when starting teleop mode. */ /* Initialize things to do when starting teleop mode. */
SET_MOTION_TELEOP_FLAG(1); SET_MOTION_TELEOP_FLAG(1);
SET_MOTION_COORD_FLAG(0);
SET_MOTION_ERROR_FLAG(0); SET_MOTION_ERROR_FLAG(0);
kinematicsForward(positions, &emcmotStatus->carte_pos_cmd, &fflags, &iflags); kinematicsForward(positions, &emcmotStatus->carte_pos_cmd, &fflags, &iflags);
@ -1308,6 +1315,7 @@ static void get_pos_cmds(long period)
} // for(axis_num) } // for(axis_num)
/* check joint 0 to see if the interpolators are empty */ /* check joint 0 to see if the interpolators are empty */
coord_cubic_active = 1;
while (cubicNeedNextPoint(&(joints[0].cubic))) { while (cubicNeedNextPoint(&(joints[0].cubic))) {
/* they're empty, pull next point(s) off Cartesian planner */ /* they're empty, pull next point(s) off Cartesian planner */
/* run coordinated trajectory planning cycle */ /* run coordinated trajectory planning cycle */