Skip to content
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
21 changes: 21 additions & 0 deletions src/book/02-system/05-modules/03-input.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,24 @@ The resulting filtered data will then be outputted as `message::input::Sensors`
- `message::input::ButtonMiddleDown` when button pressed.
- `message::input::ButtonMiddleUp` when button released.
- `message::eye::DataPoint` if log_level >= DEBUG, indicating if feet are down.

## Whistle Detector

### Description

Reads from a microphone using ALSA, passes it through a Cooley-Tukey FFT, into a band-pass filter to filter out frequencies that aren't whistles.
After a certain number of consecutive detections above a threshold, it is assumed a whistle event has triggered; it emits a `message::input::Whistle` message.
The system also has a cool-down between allowed Whistle events, as well as a timer between module configuration and the first allowed Whistle event - this is because NUsense's beep likes to trigger this module.

### Usage

When installed, it expects a USB microphone connected to the NUgus. Not having this microphone is not fatal, however.
This device is connected to ALSA as `plughw:0,0`. To find ALSA's list of inputs on the system, run `aplay -l` (this depends on having `alsa-utils`)

### Consumes

- Nothing

### Emits

- `messages::input::Whistle` with it's confidence of the whistle event and timestamp.
2 changes: 2 additions & 0 deletions src/book/02-system/05-modules/09-purpose.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ Control flow:
- Middle button (`ButtonMiddleDown`) disables idle mode after `disable_idle_delay`
- On penalisation (`GameEvents::Penalisation` for self), purpose tasks are cancelled and localisation/servo state is reset
- On unpenalisation, purpose and fall-recovery tasks are restarted (unless idling)
- If in `GameState::Phase::SET` state and we hear a `Whistle` event, move to `GameState::Phase::PLAYING`.

### Consumes

Expand All @@ -440,6 +441,7 @@ Control flow:
- `message::input::ButtonLeftUp`
- `message::input::ButtonMiddleDown`
- `message::input::ButtonMiddleUp`
- `message::input::Whistle`

### Emits

Expand Down