Skip to content

Commit 165a7a6

Browse files
james-wardLucienMorey
authored andcommitted
Add tunable for measure iterations
1 parent 3bb7627 commit 165a7a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

controllers/algae_measurement.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class AlgaeMeasurement(StateMachine):
1010
injector_component: InjectorComponent
1111

1212
retraction_voltage = tunable(-4.0)
13+
number_of_iterations = tunable(2)
1314

1415
def __init__(self) -> None:
1516
self.injector_starting_positions = (0.0, 0.0)
@@ -35,8 +36,8 @@ def pre_measure(self, initial_call, state_tm) -> None:
3536

3637
@state(must_finish=True)
3738
def calculating(self) -> None:
38-
if len(self.measured_sizes) == 3:
39-
# Throw away the first one and average the last two
39+
if len(self.measured_sizes) == self.number_of_iterations:
40+
# Throw away the first one and average the rest
4041
self.shooter_component.algae_size = sum(self.measured_sizes[1:]) / (
4142
len(self.measured_sizes) - 1
4243
)

0 commit comments

Comments
 (0)