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

feat(hardware): add acceleration to pick up tip for 96 channel #12944

Merged
merged 28 commits into from
Jul 27, 2023

Conversation

caila-marashaj
Copy link
Contributor

@caila-marashaj caila-marashaj commented Jun 21, 2023

This pr adds acceleration to pick up tip and drop tip moves for the gear motors on the 96 channel pipette. The ot3api signature's for pick_up_tip and drop_tip haven't changed, but the hardware controller's tip_action function will now optionally take in a list of moves. For the purpose of homing the gear motors, the backend tip_action function can also just take in a distance and velocity.

When pick_up_tip or drop_tip is called, the api function will now:

  • check to see if the gear motor's position is known- if not, it will home the gear motors before starting to move
  • perform the downward part of the tip action movement as normal, with acceleration
  • move most of the way back up also with acceleration
  • move the last 5 mm at a constant speed while looking for the limit switch to be pressed

Changelog

  • changed default speed for Q axis to 10
  • created separate homing functions in ot3controller and ot3utils for the gear motors
  • made backoff optional for homing the gear motors
  • added a gear_motor_position property in ot3controller
  • tweaked get_system_constraints so we can grab default acceleration for the Q axis
  • gave Axis.Q its own enum value, rather than having it be part of OTHER
  • added parsing for gear motor positions in move_group_runner

@codecov
Copy link

codecov bot commented Jun 21, 2023

Codecov Report

Merging #12944 (42777ac) into internal-release_0.14.0 (9f29c9d) will decrease coverage by 7.34%.
Report is 1 commits behind head on internal-release_0.14.0.
The diff coverage is 92.30%.

❗ Current head 42777ac differs from pull request most recent head 6eb76e6. Consider uploading reports for the commit 6eb76e6 to get more accurate results

Impacted file tree graph

@@                     Coverage Diff                     @@
##           internal-release_0.14.0   #12944      +/-   ##
===========================================================
- Coverage                    72.53%   65.19%   -7.34%     
===========================================================
  Files                         2394     1599     -795     
  Lines                        66062    37028   -29034     
  Branches                      7342     6590     -752     
===========================================================
- Hits                         47915    24139   -23776     
+ Misses                       16401    11259    -5142     
+ Partials                      1746     1630     -116     
Flag Coverage Δ
api ?
app 71.34% <ø> (ø)
components ?
g-code-testing 96.44% <ø> (ø)
hardware 56.55% <90.90%> (+0.06%) ⬆️
hardware-testing ∅ <ø> (∅)
labware-library ?
notify-server 89.13% <ø> (ø)
ot3-gravimetric-test ?
protocol-designer 47.30% <ø> (ø)
react-api-client 64.25% <ø> (ø)
robot-server ?
shared-data 78.80% <100.00%> (ø)
step-generation 87.18% <ø> (ø)
system-server ?
update-server ?
usb-bridge ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...p/src/organisms/LabwarePositionCheck/CheckItem.tsx 65.62% <ø> (ø)
...p/src/organisms/LabwarePositionCheck/PickUpTip.tsx 62.06% <ø> (ø)
...hardware/hardware_control/motion_planning/types.py 89.74% <ø> (-1.71%) ⬇️
...ns_hardware/scripts/high_throughput_diagnostics.py 0.00% <ø> (ø)
...s_hardware/scripts/high_throughput_tip_handling.py 0.00% <ø> (ø)
...ware/opentrons_hardware/hardware_control/motion.py 84.21% <66.66%> (+0.21%) ⬆️
...ns_hardware/firmware_bindings/messages/payloads.py 95.47% <100.00%> (+0.01%) ⬆️
...ons_hardware/hardware_control/move_group_runner.py 93.18% <100.00%> (+0.07%) ⬆️
...data/python/opentrons_shared_data/pipette/types.py 96.11% <100.00%> (ø)

... and 797 files with indirect coverage changes

Copy link
Contributor

@Laura-Danielle Laura-Danielle left a comment

Choose a reason for hiding this comment

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

We talked on slack about it, but you need to make sure you're essentially mimicking what ot3_utils::create_move_group does for the tip action steps. Otherwise you won't be moving the motors correctly.

moves = self._build_moves(gear_origin_dict, gear_target_dict)
blocks = moves[0][0].blocks

for block in blocks:
Copy link
Contributor

Choose a reason for hiding this comment

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

we should pass moves into the backend tip action

@sfoster1 sfoster1 changed the title feat(harwdare): add acceleration to pick up tip for 96 channel feat(hardware): add acceleration to pick up tip for 96 channel Jun 30, 2023
Copy link
Contributor

@Laura-Danielle Laura-Danielle left a comment

Choose a reason for hiding this comment

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

Initial comments.

class GearMotorPositionResponse(EmptyPayload):
"""Read Gear Motor Position Estimation."""

current_position: utils.UInt32Field
Copy link
Contributor

Choose a reason for hiding this comment

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

We can still have position flags here imo, it would just be related to boot-up only.

if len(self._expected_tip_action_motors) == 0:
seq_id = message.payload.seq_id.value
self._expected_tip_action_motors[seq_id].remove(gear_id)
print(f"expected tip motors = {self._expected_tip_action_motors}")
Copy link
Contributor

Choose a reason for hiding this comment

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

print statement here.

@@ -563,14 +581,6 @@ async def home(
if runner
]
positions = await asyncio.gather(*coros)
if OT3Axis.Q in checked_axes:
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be updating the position here and also why did we remove the tip action from the home command? We need to handle the use-case where a home command is called without any parameters.

Copy link
Contributor

@Laura-Danielle Laura-Danielle left a comment

Choose a reason for hiding this comment

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

Some more comments.

Mainly, it looks like you aren't handling the multiple types of responses you can now get from the 96 channel and there is some general code structure cleanup requests.

You should also make this PR not a draft and add a PR description please once you've finished those requests.

@@ -770,10 +771,10 @@ async def test_home_timeout(
await subject.run(can_messenger=mock_can_messenger)


async def test_tip_action_move_runner_receives_two_responses(
async def test_tip_action_move_runner_receives_response(
Copy link
Contributor

Choose a reason for hiding this comment

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

We are still receiving multiple responses from the tip action request. We should have a test that captures that.

In fact, we should expand on this test to mimic all the varying responses you can get from a tip action (i.e. if it's an acceleration move, then 3 responses for each motor) or if it's a regular home then just two responses.


data = []

with WaitableCallback(can_messenger, _listener_filter) as reader:
Copy link
Contributor

Choose a reason for hiding this comment

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

Bump on this comment.

assert data[0] == data[1]
if not data[0][1] or not data[1][1]:
# If the stepper_ok flag isn't set, that means the node didn't update position.
raise RuntimeError(
Copy link
Contributor

Choose a reason for hiding this comment

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

Bump on this comment.

api/tests/opentrons/hardware_control/test_ot3_api.py Outdated Show resolved Hide resolved
api/src/opentrons/hardware_control/ot3api.py Outdated Show resolved Hide resolved
api/src/opentrons/hardware_control/ot3api.py Outdated Show resolved Hide resolved
api/src/opentrons/hardware_control/ot3api.py Outdated Show resolved Hide resolved
@caila-marashaj caila-marashaj requested review from ahiuchingau and a team July 26, 2023 18:10
Copy link
Contributor

@fsinapi fsinapi left a comment

Choose a reason for hiding this comment

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

We should definitely rename the UpdateGearMotorPositionEstimation command and make sure the implementation of it just pulls the current position.

@caila-marashaj caila-marashaj changed the base branch from edge to internal-release_0.14.0 July 26, 2023 20:23
@caila-marashaj caila-marashaj requested review from a team as code owners July 26, 2023 20:23
@caila-marashaj caila-marashaj requested review from brenthagen and removed request for a team July 26, 2023 20:23
@ahiuchingau ahiuchingau changed the base branch from internal-release_0.14.0 to edge July 26, 2023 20:45
@caila-marashaj caila-marashaj changed the base branch from edge to internal-release_0.14.0 July 26, 2023 21:16
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

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

A couple nitpicks but really solid!

@caila-marashaj caila-marashaj merged commit 6c38267 into internal-release_0.14.0 Jul 27, 2023
25 checks passed
@caila-marashaj caila-marashaj deleted the accelerate-tip-action branch July 27, 2023 16:54
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.

None yet

5 participants