Skip to content

Commit

Permalink
refactor(hardware): give options for sensor data output during probe (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
caila-marashaj authored and Carlos-fernandez committed Jun 3, 2024
1 parent 044e7e0 commit 1c6a2eb
Show file tree
Hide file tree
Showing 12 changed files with 219 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/src/opentrons/config/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ class LiquidProbeSettings:
aspirate_while_sensing: bool
auto_zero_sensor: bool
num_baseline_reads: int
<<<<<<< HEAD
data_files: Optional[Dict[InstrumentProbeType, str]]
=======
data_file: Optional[str]
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))


@dataclass(frozen=True)
Expand Down
4 changes: 4 additions & 0 deletions api/src/opentrons/hardware_control/backends/flex_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ async def liquid_probe(
plunger_speed: float,
threshold_pascals: float,
output_format: OutputOptions = OutputOptions.can_bus_only,
<<<<<<< HEAD
data_files: Optional[Dict[InstrumentProbeType, str]] = None,
=======
data_file: Optional[str] = None,
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
auto_zero_sensor: bool = True,
num_baseline_reads: int = 10,
probe: InstrumentProbeType = InstrumentProbeType.PRIMARY,
Expand Down
11 changes: 11 additions & 0 deletions api/src/opentrons/hardware_control/backends/ot3controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,11 @@ async def liquid_probe(
plunger_speed: float,
threshold_pascals: float,
output_option: OutputOptions = OutputOptions.can_bus_only,
<<<<<<< HEAD
data_files: Optional[Dict[InstrumentProbeType, str]] = None,
=======
data_file: Optional[str] = None,
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
auto_zero_sensor: bool = True,
num_baseline_reads: int = 10,
probe: InstrumentProbeType = InstrumentProbeType.PRIMARY,
Expand All @@ -1378,6 +1382,7 @@ async def liquid_probe(
can_bus_only_output = bool(
output_option.value & OutputOptions.can_bus_only.value
)
<<<<<<< HEAD
data_files_transposed = (
None
if data_files is None
Expand All @@ -1386,6 +1391,8 @@ async def liquid_probe(
for probe in data_files.keys()
}
)
=======
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
positions = await liquid_probe(
messenger=self._messenger,
tool=tool,
Expand All @@ -1397,7 +1404,11 @@ async def liquid_probe(
csv_output=csv_output,
sync_buffer_output=sync_buffer_output,
can_bus_only_output=can_bus_only_output,
<<<<<<< HEAD
data_files=data_files_transposed,
=======
data_file=data_file,
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
auto_zero_sensor=auto_zero_sensor,
num_baseline_reads=num_baseline_reads,
sensor_id=sensor_id_for_instrument(probe),
Expand Down
4 changes: 4 additions & 0 deletions api/src/opentrons/hardware_control/backends/ot3simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ async def liquid_probe(
plunger_speed: float,
threshold_pascals: float,
output_format: OutputOptions = OutputOptions.can_bus_only,
<<<<<<< HEAD
data_files: Optional[Dict[InstrumentProbeType, str]] = None,
=======
data_file: Optional[str] = None,
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
auto_zero_sensor: bool = True,
num_baseline_reads: int = 10,
probe: InstrumentProbeType = InstrumentProbeType.PRIMARY,
Expand Down
4 changes: 4 additions & 0 deletions api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2623,7 +2623,11 @@ async def liquid_probe(
(probe_settings.plunger_speed * plunger_direction),
probe_settings.sensor_threshold_pascals,
probe_settings.output_option,
<<<<<<< HEAD
probe_settings.data_files,
=======
probe_settings.data_file,
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
probe_settings.auto_zero_sensor,
probe_settings.num_baseline_reads,
probe=probe if probe else InstrumentProbeType.PRIMARY,
Expand Down
4 changes: 4 additions & 0 deletions api/tests/opentrons/hardware_control/test_ot3_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,11 @@ async def test_liquid_probe(
(fake_settings_aspirate.plunger_speed * -1),
fake_settings_aspirate.sensor_threshold_pascals,
fake_settings_aspirate.output_option,
<<<<<<< HEAD
fake_settings_aspirate.data_files,
=======
fake_settings_aspirate.data_file,
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
fake_settings_aspirate.auto_zero_sensor,
fake_settings_aspirate.num_baseline_reads,
probe=InstrumentProbeType.PRIMARY,
Expand Down
4 changes: 4 additions & 0 deletions hardware-testing/hardware_testing/gravimetric/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ def _get_liquid_probe_settings(
plunger_speed=lqid_cfg["plunger_speed"],
sensor_threshold_pascals=lqid_cfg["sensor_threshold_pascals"],
expected_liquid_height=110,
<<<<<<< HEAD
output_option=OutputOptions.sync_only,
=======
output_option=OutputOptions.stream_to_csv,
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
aspirate_while_sensing=False,
auto_zero_sensor=True,
num_baseline_reads=10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@
defs.GetHepaUVStateResponse,
defs.SendAccumulatedPressureDataRequest,
defs.AddSensorLinearMoveRequest,
<<<<<<< HEAD
defs.SendAccumulatedPressureDataRequest,
=======
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,10 @@ class GetHepaUVStatePayloadResponse(EmptyPayload):
uv_duration_s: utils.UInt32Field
uv_light_on: utils.UInt8Field
remaining_time_s: utils.UInt32Field
<<<<<<< HEAD
uv_current_ma: utils.UInt16Field
=======
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))


@dataclass(eq=False)
Expand Down
14 changes: 14 additions & 0 deletions hardware/opentrons_hardware/hardware_control/move_group_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
ErrorSeverity,
GearMotorId,
MoveAckId,
<<<<<<< HEAD
MotorDriverErrorCode,
=======
SensorId,
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
)
from opentrons_hardware.drivers.can_bus.can_messenger import CanMessenger
from opentrons_hardware.firmware_bindings.messages import MessageDefinition
Expand All @@ -40,7 +44,10 @@
TipActionResponse,
ErrorMessage,
StopRequest,
<<<<<<< HEAD
ReadMotorDriverErrorStatusResponse,
=======
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
AddSensorLinearMoveRequest,
)
from opentrons_hardware.firmware_bindings.messages.payloads import (
Expand Down Expand Up @@ -307,7 +314,10 @@ def _get_stepper_motor_message(
return HomeRequest(payload=home_payload)
elif step.move_type == MoveType.sensor:
# stop_condition = step.stop_condition.value
<<<<<<< HEAD
assert step.sensor_id is not None
=======
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
stop_condition = MoveStopCondition.sync_line
sensor_move_payload = AddSensorLinearMoveBasePayload(
request_stop_condition=MoveStopConditionField(stop_condition),
Expand All @@ -328,7 +338,11 @@ def _get_stepper_motor_message(
velocity_mm=Int32Field(
int((step.velocity_mm_sec / interrupts_per_sec) * (2**31))
),
<<<<<<< HEAD
sensor_id=SensorIdField(step.sensor_id),
=======
sensor_id=SensorIdField(SensorId.S0),
>>>>>>> 7995d78c39 (refactor(hardware): give options for sensor data output during probe (#14673))
)
return AddSensorLinearMoveRequest(payload=sensor_move_payload)
else:
Expand Down
Loading

0 comments on commit 1c6a2eb

Please sign in to comment.