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

RSDK-8878: gantry shouldn't look for the second limit switch until it has cleared the first limit switch #4400

Merged
merged 6 commits into from
Oct 1, 2024

Conversation

martha-johnston
Copy link
Contributor

@martha-johnston martha-johnston commented Sep 27, 2024

use move away to make sure limit switch it cleared before homing to the next limit switch

more info from ticket description:
Currently during the gantry homing process, the gantry will move to limit switch 0, and then limit switch 1. During this process, it is constantly checking if it has hit the limit switch it is looking for, but it is also constantly checking if it has hit the wrong limit switch, meaning if it was expecting to hit limit switch 0 next and it hits limit switch 1, or if it expects to hit limit switch 1 next and hits limit switch 0. If this happens, the homing sequence errors and stops.

This causes a problem with slower gantries because there’s a case in which the first limit switch could be hit, and then the gantry starts moving in the opposite direction trying to find the second limit switch, but it has not moved out of the range of the first limit switch yet. In this scenario, the homing sequence is interrupted because the gantry is looking for limit switch 1, but it is still hitting limit switch 0, so it returns an error.

This can be fixed by moving in the opposite direction to set the limit switch back to false before continuing to home in the opposite direction.

@viambot viambot added the safe to test This pull request is marked safe to test from a trusted zone label Sep 27, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Sep 27, 2024
@martha-johnston martha-johnston requested review from a team and oliviamiller and removed request for a team September 27, 2024 20:08
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Sep 30, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Sep 30, 2024
@martha-johnston
Copy link
Contributor Author

fixing the test was more involved than anticipated, could you take another look @oliviamiller? maybe just react to this if you still approve?

pinValues = []int{1, 1, 0}
count = 0
defaultPinValues = []int{1, 1, 0}
limitPinValues = []int{1, 0, 1, 0, 1, 1, 0}
Copy link
Member

Choose a reason for hiding this comment

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

I don't really understand what the difference between these two are / why these test changes are needed for this code change, could you give me some more context/add comments to this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I can add comments, but basically we added the moveAway function to homing, so in order for the tests to pass the pin needs to go positive (hit the limit switch) and then negative (moved away from the limit switch). I didn't think about it before but we might just be able to use that limit pin values list for everything. let me try it quickly

Copy link
Member

Choose a reason for hiding this comment

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

thank you! maybe rename back to pinValues since theres now only one. Also comment is still unclear since they are not all alternating?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

they can be fully alternating, it doesn't super matter it's just that the first couple need to be alternating for the homing tests. basically the issue before was they were never getting set low. at some point it needs to be set low. changed it to fully alternating tho because that is clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thinking to leave it as default because if they need to be changed for some reason in adding future tests, more versions could be added

Copy link
Member

Choose a reason for hiding this comment

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

maybe just add "during homing" to the comment for future clarity? otherwise everything lgtm!

@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Oct 1, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Oct 1, 2024
@viambot viambot added safe to test This pull request is marked safe to test from a trusted zone and removed safe to test This pull request is marked safe to test from a trusted zone labels Oct 1, 2024
@martha-johnston martha-johnston merged commit 38f055d into viamrobotics:main Oct 1, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
safe to test This pull request is marked safe to test from a trusted zone
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants