Skip to content

Commit

Permalink
feat(shared-data): bump gripper model version (#15413) (#15775)
Browse files Browse the repository at this point in the history
## git cherry-pick 4f90e28


- #15413 was the edge PR
- This is the only commit needed in the 7.5.0 release to allow for the
new gripper model.
- There are no changes to buildroot, oe-core, or ot3-firmware

Co-authored-by: Alise Au <20424172+ahiuchingau@users.noreply.github.com>
  • Loading branch information
y3rsh and ahiuchingau authored Jul 24, 2024
1 parent c06a003 commit c3a1bad
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 3 deletions.
7 changes: 6 additions & 1 deletion api/src/opentrons/config/gripper_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ def info_num_to_model(num: str) -> GripperModel:
# PVT will now be 1.2
model_map = {
"0": {"0": GripperModel.v1, "1": GripperModel.v1},
"1": {"0": GripperModel.v1, "1": GripperModel.v1_1, "2": GripperModel.v1_2},
"1": {
"0": GripperModel.v1,
"1": GripperModel.v1_1,
"2": GripperModel.v1_2,
"3": GripperModel.v1_3,
},
}
return model_map[major_model][minor_model]

Expand Down
29 changes: 29 additions & 0 deletions shared-data/gripper/definitions/1/gripperV1.3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$otSharedSchema": "gripper/schemas/1",
"model": "gripperV1.3",
"schemaVersion": 1,
"displayName": "Flex Gripper",
"gripForceProfile": {
"polynomial": [
[0, 3.759869],
[1, 0.81005],
[2, 0.04597701]
],
"defaultGripForce": 15.0,
"defaultIdleForce": 10.0,
"defaultHomeForce": 12.0,
"min": 2.0,
"max": 30.0
},
"geometry": {
"baseOffsetFromMount": [19.5, -74.325, -94.825],
"jawCenterOffsetFromBase": [0.0, 0.0, -86.475],
"pinOneOffsetFromBase": [6.0, -54.0, -98.475],
"pinTwoOffsetFromBase": [6.0, 54.0, -98.475],
"jawWidth": {
"min": 60.0,
"max": 92.0
},
"maxAllowedGripError": 3.0
}
}
8 changes: 7 additions & 1 deletion shared-data/js/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@ export const MAGNETIC_BLOCK_V1: 'magneticBlockV1' = 'magneticBlockV1'
export const GRIPPER_V1: 'gripperV1' = 'gripperV1'
export const GRIPPER_V1_1: 'gripperV1.1' = 'gripperV1.1'
export const GRIPPER_V1_2: 'gripperV1.2' = 'gripperV1.2'
export const GRIPPER_MODELS = [GRIPPER_V1, GRIPPER_V1_1, GRIPPER_V1_2]
export const GRIPPER_V1_3: 'gripperV1.3' = 'gripperV1.3'
export const GRIPPER_MODELS = [
GRIPPER_V1,
GRIPPER_V1_1,
GRIPPER_V1_2,
GRIPPER_V1_3,
]

// robot display name
export const OT2_DISPLAY_NAME: 'Opentrons OT-2' = 'Opentrons OT-2'
Expand Down
10 changes: 9 additions & 1 deletion shared-data/js/gripper.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import gripperV1 from '../gripper/definitions/1/gripperV1.json'
import gripperV1_1 from '../gripper/definitions/1/gripperV1.1.json'
import gripperV1_2 from '../gripper/definitions/1/gripperV1.2.json'
import gripperV1_3 from '../gripper/definitions/1/gripperV1.3.json'

import { GRIPPER_V1, GRIPPER_V1_1, GRIPPER_V1_2 } from './constants'
import {
GRIPPER_V1,
GRIPPER_V1_1,
GRIPPER_V1_2,
GRIPPER_V1_3,
} from './constants'

import type { GripperModel, GripperDefinition } from './types'

Expand All @@ -16,6 +22,8 @@ export const getGripperDef = (
return gripperV1_1 as GripperDefinition
case GRIPPER_V1_2:
return gripperV1_2 as GripperDefinition
case GRIPPER_V1_3:
return gripperV1_3 as GripperDefinition
default:
console.warn(
`Could not find a gripper with model ${gripperModel}, falling back to most recent definition: ${GRIPPER_V1_2}`
Expand Down
2 changes: 2 additions & 0 deletions shared-data/js/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
GRIPPER_V1,
GRIPPER_V1_1,
GRIPPER_V1_2,
GRIPPER_V1_3,
EXTENSION,
MAGNETIC_BLOCK_V1,
} from './constants'
Expand Down Expand Up @@ -230,6 +231,7 @@ export type GripperModel =
| typeof GRIPPER_V1
| typeof GRIPPER_V1_1
| typeof GRIPPER_V1_2
| typeof GRIPPER_V1_3

export type ModuleModelWithLegacy =
| ModuleModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ class GripperModel(str, Enum):
v1 = "gripperV1"
v1_1 = "gripperV1.1"
v1_2 = "gripperV1.2"
v1_3 = "gripperV1.3"

def __str__(self) -> str:
"""Model name."""
enum_to_str = {
self.__class__.v1: "gripperV1",
self.__class__.v1_1: "gripperV1.1",
self.__class__.v1_2: "gripperV1.2",
self.__class__.v1_3: "gripperV1.3",
}
return enum_to_str[self]

Expand Down

0 comments on commit c3a1bad

Please sign in to comment.