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

Potential race condition when SVEAManager gets state from LocalizationInterface #32

Open
rcywongaa opened this issue Nov 15, 2023 · 2 comments

Comments

@rcywongaa
Copy link

In https://github.com/KTH-SML/svea/blob/main/src/svea_core/src/svea/svea_managers/svea_archetypes.py#L68

SVEAManager directly gets the current state from the LocalizationInterface.

However, as per https://github.com/KTH-SML/svea/blob/main/src/svea_core/src/svea/interfaces/localization.py#L90
state is updated in a separate thread.

This could lead to a race condition

@kaarmu
Copy link
Collaborator

kaarmu commented Nov 15, 2023

You are correct and this is something we are aware of. However, I'm surprised if you actually encountered a problem. Usually, the manager's state is only used for reading, meaning that race conditions would only cause partial updates to the state. Generally this hasn't been a big problem. Perhaps you encountered something in simulation? I know that there can arise funny effects (that are hard to debug!) between the simulator and localization interface.

@rcywongaa
Copy link
Author

I was implementing a safety controller that limits the controls when a collision is imminent. This collision prediction depends on both the current state and control inputs.

Since I wanted this to work in all cases (not just in teleop), I implemented this in SVEAManager. That's when I encountered the issue where I would detect the state jumping around which I suspect is due to incomplete update of the state by the localization.

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

2 participants