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

Restructuring error reporting in start_traj_mode and start_point_queue_mode #297

Merged
merged 4 commits into from
Oct 14, 2024

Conversation

jimmy-mcelwain
Copy link
Collaborator

Changes start_traj_mode and start_point_queue_mode services so that they properly report the reasons for failure in case motion cannot be started. This addresses many of the concerns brought up in the discussion of PR #265. I closed that PR and opened this to simplify bringing it up to date with main and to make the history less confusing.

@jimmy-mcelwain
Copy link
Collaborator Author

Also in reference to #37 and #192

src/ControllerStatusIO.h Outdated Show resolved Hide resolved
src/MotionControl.h Outdated Show resolved Hide resolved
src/MotionControl.c Show resolved Hide resolved
src/MotionControl.c Outdated Show resolved Hide resolved
src/MotionControl.c Show resolved Hide resolved
@gavanderhoorn
Copy link
Collaborator

@jimmy-mcelwain: could you perhaps describe your approach at a high-level?

You write:

Changes start_traj_mode and start_point_queue_mode services so that they properly report the reasons for failure in case motion cannot be started.

what did they not do correctly before these changes, and which changes (to control flow perhaps) address that specifically?

@jimmy-mcelwain
Copy link
Collaborator Author

jimmy-mcelwain commented Sep 6, 2024

What I wrote there doesn't describe what I changed since the last PR that I closed. I rebased on main and that comment sums up the purpose of this PR as a whole, not just the differences from the last PR.

This approach changes Ros_Controller_GetNotReadySubcode() to work better with start_traj_mode and start_point_queue_mode such that much less code is duplicated. Within Ros_Controller_GetNotReadySubcode() I check for intractable problems that require the user to take some action, e.g. like switching to remote mode or calling /reset_error. If I am attempting to start some motion mode, I will ignore tractable errors from Ros_Controller_GetNotReadySubcode() that are potentially addressed by starting the motion, e.g. turning on servos, starting the job.

I also significantly simplified the control flow of the program. Previously, there were several calls to goto updatestatus which are no longer needed. The jumps to updatestatus always followed some intractable issue. These goto calls didn't make sense to me, since they are checking if motion is ready almost immediately after they already determined that motion was not ready. I should have gotten rid of them in the previous PR. To me it makes a lot more sense to simply return with a MotionNotReadyCode if it is determined that the motion cannot start and nothing can be done about it.

Copy link
Collaborator

@ted-miller ted-miller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing worked well. Conflicts resolved using web editor

…e accurate. This commit is essentially a squash + rebase of StartTrajMode_error_message_fix onto main
… order that motion not ready codes are checked, requested changes made. Simplified flow.
@ted-miller ted-miller merged commit 6821419 into main Oct 14, 2024
14 checks passed
@ted-miller ted-miller deleted the MotionControl_error_codes branch October 14, 2024 13:10
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

Successfully merging this pull request may close these issues.

Incorrect error message for StartTrajMode start_traj_mode fails if home position is not configured
3 participants