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

base auto stop bug fix #152

Merged
merged 2 commits into from
Dec 4, 2023
Merged

Conversation

clintpurser
Copy link
Member

@clintpurser clintpurser commented Nov 29, 2023

I added a perhaps too lengthy comment describing some of the thoughts on this issue in the code, I will explain here as well.

Essentially things tend to work well in normal network conditions, but as soon as the client is in spotty conditions, not enough to end the session but enough to garble the order of some calls or have some not make it through, the joystick widget tends to not auto stop not upon touch release and the base will continue to move in whatever the last command was.

My first thought was to shorten the sessions heartbeat interval, but that is configured per robot and not per client.

So I ended up tracking the touch locally in the widgets state and sending a stop command if the base is still moving but touch has been released, I check 100 milliseconds after each call.

If network conditions allow this will stop the base sooner than the ending session would, though if network conditions do not allow the stop call to make it through the ending session will eventually stop base.

Another option would be to continually check if the bass is moving and if the touch is active every 100ms during the widgets life cycle. I didn't opt for that to limit extraneous calls.

@clintpurser clintpurser requested a review from njooma November 29, 2023 21:19
@clintpurser clintpurser requested a review from a team as a code owner November 29, 2023 21:19
@clintpurser
Copy link
Member Author

@micheal-parks - if you want to see my attempt at this. still doesn't work with multiple clients on the same machine, but im tracking the touch 'session' locally and cancelling if the base is moving but touch has ended.

@clintpurser clintpurser changed the title base auto stop bug fix APP-3318 - base auto stop bug fix Nov 29, 2023
@clintpurser clintpurser marked this pull request as draft November 29, 2023 22:46
@clintpurser clintpurser changed the title APP-3318 - base auto stop bug fix base auto stop bug fix Nov 30, 2023
@clintpurser clintpurser marked this pull request as ready for review November 30, 2023 15:44
@clintpurser
Copy link
Member Author

This ended up not being the specific bug Eliot was seeing, but it is similar.

)
],
);
}

void callSetPower(StickDragDetails details) {
touchActive = (details.x != 0 && details.y != 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 think this should be || for the use case of when I'm fully horizontal (e.g. only fully right). Then X would be non-zero, but Y would be zero

Copy link
Member Author

Choose a reason for hiding this comment

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

oh yeah you're totally right, great catch, thank you!

@clintpurser clintpurser requested a review from njooma November 30, 2023 22:26
@clintpurser clintpurser merged commit fb5c3e7 into viamrobotics:main Dec 4, 2023
1 check passed
@clintpurser clintpurser deleted the rc-autostop-fix branch December 4, 2023 22:00
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.

2 participants