Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ros_MotionControl_ValidateMotionModeIsOk() should only check, not act #216

Open
gavanderhoorn opened this issue Feb 26, 2024 · 1 comment

Comments

@gavanderhoorn
Copy link
Collaborator

gavanderhoorn commented Feb 26, 2024

Context: #213.

Current implementation:

motoros2/src/MotionControl.c

Lines 1591 to 1608 in 10d8f00

void Ros_MotionControl_ValidateMotionModeIsOk()
{
if (!g_messages_RobotStatus.msgRobotStatus->motion_possible.val)
{
if (Ros_MotionControl_IsMotionMode_PointQueue())
{
//If we are in a point-queue-mode and the motion_possible flag drops,
//then we need to abort the motion mode and force them to initialize the
//mode again. This allows the system to detect if the robot is not starting back up
//from the expected location. (System could have been estopped during the trajectory,
//or the user could have switched to TEACH and moved the arm around.)
Ros_Debug_BroadcastMsg("Stopping point-queue motion mode. Please call '%s' to start a new queue.", SERVICE_NAME_START_POINT_QUEUE_MODE);
Ros_MotionControl_StopTrajMode();
}
//TODO: Determine if this should be done for Trajecotry-Mode too
}
}

Either the name of the function should be changed to reflect the fact it actually changes system state (as in: exits the current motion mode if something is wrong), or it should only implement the actual check and leave acting based on the results to the caller.

@gavanderhoorn
Copy link
Collaborator Author

gavanderhoorn commented Feb 26, 2024

Known call sites as of this comment:

Ros_MotionControl_ValidateMotionModeIsOk();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant