Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: configurable window for profiler peak focus #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions configs/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ arm_ifcb:
resolution: 0.02 # m
data_topic: "ctd/aml/port4/phycoerythrin"
data_field: "value"
# Profile will only consider peaks that are at least this deep
peak_min_depth: 0.0 # optional, m
# Profile will only consider peaks that are at most this deep
peak_max_depth: 10.0 # optional, m

motor: #optional
address: "192.168.13.3"
Expand Down
11 changes: 11 additions & 0 deletions src/phyto_arm/src/profiler_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ def on_action_stop(pub, action_msg):
S.release()
return

# Get min and max depth params
min_depth = rospy.get_param('~peak_min_depth')
max_depth = rospy.get_param('~peak_max_depth')

# Filter out data points outside the specified depth range
if min_depth is not None and max_depth is not None:
len_before = data.shape[0]
data = data[(data[:,0] >= min_depth) & (data[:,0] <= max_depth)]
rospy.logwarn(f'Profile depths filtered: {min_depth} to {max_depth} m. \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only concern I have is that this is a warning. I'm guessing because line 130 is a warning, but that was more to do with having erroneous depth readings of DEPTH_PRESSURE_NO_DATA. I think loginfo or just remove the log altogether, since I'm not convinced it's useful?

{data.shape[0]}/{len_before} points remain')

# Create a function that linearly interpolates between points
f = scipy.interpolate.interp1d(data[:,0], data[:,1])

Expand Down
Loading