-
Notifications
You must be signed in to change notification settings - Fork 22
Whistle detection #775
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
Merged
Merged
Whistle detection #775
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
b77d8be
add prototype dataflow of whistle detection
val-ba d349153
add whistle detector package
val-ba 25cabdb
put project whistle detection code into whistle detector node
val-ba 8b3c0ee
add model to share in setup py
val-ba b476e5a
fix wrong package structure
val-ba eff33a9
fix package naming
val-ba ec74f94
add whistle detection based on frequency bands
val-ba 51acc88
add launch files
val-ba b8ef1be
add plugin dir for pipewire
val-ba ac237f2
update dsd for whistle detection and decision
val-ba a2bddc8
fix wrong anming of capsule in whistle decision
val-ba c3ec16f
fix wrong placement of launch file
val-ba 1142976
git subrepo clone git@github.com:mgonzs13/audio_common.git src/lib/au…
texhnolyze d5ef600
update the audio launch
val-ba b1b292e
fix audio launch script
val-ba 5fcdb01
simplify audio.launch
val-ba d8a19a4
add dependencies
val-ba edb0fb1
remove unnecessary launch of whistle detection in head mover test
val-ba 9bb6b8a
remove command in setup.py
val-ba 1416fab
move whistle detector to misc and add extra launch param
val-ba 57077d7
be more conservative with whistle threshold
val-ba 101fcf8
remove comments
val-ba faf8cca
chore(bitbots_whistle_detector): add `resource` marker
texhnolyze 84ebddd
fix(whistle_detection): correctly localize during `STATE_SET` + whistle
cleWu03 689da17
Adjust rosbag record to new audio topic
jaagut 32cab42
refactor(whistle_detection): publish `Time` when detected
texhnolyze 69488fa
fix(audio): disable audio capture in sim by default
texhnolyze d2800f8
style(pixi): reorder dependencies
texhnolyze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
24 changes: 24 additions & 0 deletions
24
...or/bitbots_body_behavior/bitbots_body_behavior/behavior_dsd/decisions/whistle_detected.py
This file contains hidden or 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,24 @@ | ||
| from bitbots_blackboard.body_blackboard import BodyBlackboard | ||
| from dynamic_stack_decider.abstract_decision_element import AbstractDecisionElement | ||
|
|
||
|
|
||
| class WhistleDetected(AbstractDecisionElement): | ||
| blackboard: BodyBlackboard | ||
|
|
||
| def __init__(self, blackboard, dsd, parameters): | ||
| super().__init__(blackboard, dsd, parameters) | ||
| self.previous_timestep_whistle_detected = self.blackboard.gamestate.last_timestep_whistle_detected | ||
|
|
||
| def perform(self, reevaluate=False): | ||
| """ | ||
| Returns "DETECTED" if a whistle was detected while the decision element was active, as part of the | ||
| DSD stack. If we have detected a whistle previously, but not during this decision element being on | ||
| the decision stack it counts as "NOT_DETECTED". | ||
| """ | ||
| if self.previous_timestep_whistle_detected == self.blackboard.gamestate.last_timestep_whistle_detected: | ||
| return "NOT_DETECTED" | ||
|
|
||
| return "DETECTED" | ||
|
|
||
| def get_reevaluate(self): | ||
| return True |
This file contains hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 |
|---|---|---|
| @@ -1,29 +1,14 @@ | ||
| <?xml version="1.0"?> | ||
| <launch> | ||
| <arg name="sim" default="false" description="If true, we don't capture audio" /> | ||
| <arg name="dst" default="appsink"/> | ||
| <arg name="device" default=""/> | ||
| <arg name="format" default="wave"/> | ||
| <arg name="bitrate" default="128"/> | ||
| <arg name="channels" default="1"/> | ||
| <arg name="depth" default="16"/> | ||
| <arg name="sample_rate" default="10000"/> | ||
| <arg name="sample_format" default="S16LE"/> | ||
| <arg name="ns" default="audio"/> | ||
| <arg name="audio_topic" default="audio" /> | ||
| <!-- Our code currently is not sample_rate agnostic, but this must be overwritable to start the audio_capturer_node | ||
| on some audio drivers/devices if they do not support the default sample_rate of 16000. --> | ||
| <arg name="sample_rate" default="16000" description="The sample_rate with which the audio should be captured"/> | ||
|
|
||
| <group unless="$(var sim)"> | ||
| <include file="$(find-pkg-share audio_capture)/launch/capture.launch.xml"> | ||
| <arg name="dst" value="$(var dst)"/> | ||
| <arg name="device" value="$(var device)"/> | ||
| <arg name="format" value="$(var format)"/> | ||
| <arg name="bitrate" value="$(var bitrate)"/> | ||
| <arg name="channels" value="$(var channels)"/> | ||
| <arg name="depth" value="$(var depth)"/> | ||
| <arg name="sample_rate" value="$(var sample_rate)"/> | ||
| <arg name="sample_format" value="$(var sample_format)"/> | ||
| <arg name="ns" value="$(var ns)"/> | ||
| <arg name="audio_topic" value="$(var audio_topic)"/> | ||
| </include> | ||
| </group> | ||
| <node | ||
| pkg="audio_common" | ||
| exec="audio_capturer_node" | ||
| name="audio_capturer_node" | ||
| output="screen"> | ||
| <param name="rate" value="$(var sample_rate)"/> | ||
| </node> | ||
| </launch> |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
4 changes: 4 additions & 0 deletions
4
src/bitbots_misc/bitbots_whistle_detector/bitbots_whistle_detector/__init__.py
This file contains hidden or 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,4 @@ | ||
| # Setting up runtime type checking for this package | ||
| from beartype.claw import beartype_this_package | ||
|
|
||
| beartype_this_package() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.