-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): Synchronize access to the smoothie and rpc (#3528)
In smoothie: Only allow one thing at a time to send a command. This is tricky because there's no clean interfaces anywhere in apiv1; it's hard to determine where the right place for a lock is. This commit puts the lock around the lowest level primitive, _send_command. That means that two threads racing to execute e.g. pipette.home() and pipette.move() (from rpc calibration.move_to_front()) will interleave the subcommands around setting speeds, setting currents, and actually moving. However, they will no longer put the smoothie driver or serial link into a bad state. Is this an improvement? Maybe, but it's not everything - we should probably have similar locks around rpc actions (aside from cancel of course) and http. In RPC: Synchronize access to motion in rpc In addition to the low-level of synchronization in the smoothie driver to prevent reentrant access to the serial port, we also need to synchronize higher-level compound actions. For instance, if someone starts a tip probe via rpc and then commands a home via http, one action should complete before the next one starts. This still may lead to bad behavior, but there's a limited amount we can do about interrupting flows high level enough that the api doesn't even consider them - that's on a client. This synchronization is applied to both certain endpoints in the control endpoints via http and any motion-related rpc endpoints (as well as simulate(), unfortunately, since at least on apiv1 that would conflict with other motions since it shares the same robot singleton. We can remove this when we switch to apiv2). Closes #3527
- Loading branch information
Showing
9 changed files
with
166 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.