-
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.
feat(api, app): Check Robot Deck Transform (#5845)
- Loading branch information
1 parent
78c3ebb
commit ed67383
Showing
17 changed files
with
384 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from opentrons.hardware_control.util import DeckTransformState | ||
|
||
|
||
async def test_validating_calibration(hardware): | ||
|
||
singular_matrix = [ | ||
[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 0]] | ||
|
||
await hardware.update_config(gantry_calibration=singular_matrix) | ||
|
||
assert hardware.validate_calibration() == DeckTransformState.SINGULARITY | ||
|
||
identity_matrix = [ | ||
[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]] | ||
await hardware.update_config(gantry_calibration=identity_matrix) | ||
|
||
assert hardware.validate_calibration() == DeckTransformState.IDENTITY | ||
|
||
outofrange_matrix = [ | ||
[1, 0, 0, 5], [0, 1, 0, 4], [0, 0, 1, 0], [0, 0, 0, 1]] | ||
await hardware.update_config(gantry_calibration=outofrange_matrix) | ||
|
||
assert hardware.validate_calibration() ==\ | ||
DeckTransformState.BAD_CALIBRATION | ||
|
||
inrange_matrix = [ | ||
[1, 0, 0, 1], [0, 1, 0, 2], [0, 0, 1, -25], [0, 0, 0, 1]] | ||
await hardware.update_config(gantry_calibration=inrange_matrix) | ||
hardware.validate_calibration() | ||
|
||
assert hardware.validate_calibration() == DeckTransformState.OK |
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
54 changes: 54 additions & 0 deletions
54
app/src/components/RobotSettings/DeckCalibrationWarning.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// @flow | ||
import * as React from 'react' | ||
import { | ||
Icon, | ||
Box, | ||
Flex, | ||
Text, | ||
FONT_SIZE_BODY_1, | ||
COLOR_WARNING, | ||
COLOR_ERROR, | ||
SPACING_AUTO, | ||
SPACING_1, | ||
ALIGN_CENTER, | ||
} from '@opentrons/components' | ||
|
||
import styles from './styles.css' | ||
|
||
export type DeckCalibrationWarningProps = {| | ||
calibrationStatus: string, | ||
|} | ||
|
||
const ROBOT_CAL_WARNING = "This robot's deck has not yet been calibrated." | ||
const ROBOT_CAL_RESOLUTION = | ||
'Please perform a deck calibration prior to uploading a protocol.' | ||
const ROBOT_CAL_ERROR = | ||
'Bad deck calibration detected! This robot is likely to experience a crash.' | ||
|
||
export function DeckCalibrationWarning({ | ||
calibrationStatus, | ||
}: DeckCalibrationWarningProps): React.Node { | ||
const isVisible = calibrationStatus !== 'OK' | ||
const isNoCalibration = calibrationStatus === 'IDENTITY' | ||
const message = isNoCalibration ? ROBOT_CAL_WARNING : ROBOT_CAL_ERROR | ||
const colorType = isNoCalibration ? COLOR_WARNING : COLOR_ERROR | ||
const styleType = isNoCalibration | ||
? styles.cal_check_warning_icon | ||
: styles.cal_check_error_icon | ||
|
||
if (!isVisible) return null | ||
|
||
return ( | ||
<Flex alignItems={ALIGN_CENTER}> | ||
<Icon name={'alert-circle'} className={styleType} /> | ||
<Box fontSize={FONT_SIZE_BODY_1} paddingRight={SPACING_1}> | ||
<Text color={colorType} marginRight={SPACING_AUTO}> | ||
{message} | ||
</Text> | ||
<Text color={colorType} marginRight={SPACING_AUTO}> | ||
{ROBOT_CAL_RESOLUTION} | ||
</Text> | ||
</Box> | ||
</Flex> | ||
) | ||
} |
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.