Skip to content

Commit

Permalink
feat: Decrease default profile check frequency to 10s
Browse files Browse the repository at this point in the history
Revert multi-routine IFCB finish detection
  • Loading branch information
figuernd committed Dec 23, 2024
1 parent 93b5976 commit 8aed35a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/phyto_arm/src/arm_esp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_next_task(self, last_task):
return Task("profiler_peak", wait_seconds(esp_update_freq), peak_depth)

# By default hold and wait a second
return Task('default_position_wait', wait_seconds(5), rospy.get_param('tasks/default_depth'))
return Task('default_position_wait', wait_seconds(10), rospy.get_param('tasks/default_depth'))

# Global reference to arm state
arm = None
Expand Down
26 changes: 10 additions & 16 deletions src/phyto_arm/src/ifcb_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,6 @@ class IFCBState:

state = IFCBState()

# For detecting a finished sample on Acquire < 3.0
def is_finished_pre_3_0(marker):
if marker is None:
return False
return marker['routine'] == 'runsample' and \
marker['kind'] == 'before' and \
marker['value'].get('StepType') == 'ChangeSpeed' and \
marker['value'].get('Arguments', []) == ['{#SamplingSpeed}']

# For detecting a finished sample on Acquire >= 3.0
def is_finished_post_3_0(msg):
return msg == ['reportevent', 'Finished: Run sample.\n']


def on_ifcb_msg(msg):
# Parse the message and see if it is a marker
Expand All @@ -76,9 +63,16 @@ def on_ifcb_msg(msg):
state.ifcb_is_idle.set()
return

# Detect when we can release our position hold.
# API changes with Acquire 3.0 so we check for either finish message type.
if is_finished_pre_3_0(marker) or is_finished_post_3_0(parsed):
# Remaining behaviors depend on having a parsed marker
if marker is None:
return

# Detect when we can release our position hold
if marker['routine'] == 'runsample' and \
marker['kind'] == 'before' and \
marker['value'].get('StepType') == 'ChangeSpeed' and \
marker['value'].get('Arguments', []) == ['{#SamplingSpeed}']:

rospy.loginfo('Should release position hold now')

with state.position_hold_condition:
Expand Down

0 comments on commit 8aed35a

Please sign in to comment.