Application of publishing/subscribing HARK std messages
Overview
- Basic sound source localization network is devided into two (pre-processing and post-processing).
- The pre-processing includes from AudioStreamFromWave to LocalizaMUSIC.
- The post-processing includes from SourceTracker to DisplayLocalization.
- The end of pre-processing publishes localization results.
- The beginning of post-processing subscribes the localization results.
- The process is completely independent, so it is also possible to separate network files.
Main Sheet Configuration
- Required Modules
- RosNodeGenerator
- Constant
- InputStream
- MAIN_LOOP (Same as LOOP0 in the previous tutorials. This appears after you create iterator sheet.)
RosNodeGenerator
All description is available at Publishing/Subscribing msg type Topics.
Constant
- Module Description
This module outputs a property parameter with a specific type.
In this example, this specifies input wave file name .
- Module Location
Node list > General > Constant
- Property settings
Name | Type | Value | Explanation |
---|---|---|---|
VALUE | subnet_param | ARG1 | Input wave file name |
If you set ARG1 here, this network file takes one argument from command line.
InputStream
- Module Description
This modules opens the input file which is specified by Constant module.
- Module Location
Node list > IO > InputStream
- Property settings
Name | Type | Value | Explanation |
---|---|---|---|
TYPE | int | ||
RETRY | int |
MAIN_LOOP
- Module Description
This is the same as LOOP0 in Publishing/Subscribing msg type Topics.
However, since the iterator sheet has some subnet_param parameters, this module takes some property values.
- Property settings
Name | Type | Value | Explanation |
---|---|---|---|
LENGTH | int | 512 | Number of samples in one frame |
ADVANCE | int | 160 | Shift length |
- Terminal settiongs
Set “INPUT”, “OUTPUT” and “OUTPUT_1” after setting iterator sheet configuration.
Iterator Sheet Configuration
- Required Modules
- AudioStreamFromWave
- MultiFFT
- LocalizeMUSIC
- RosHarkMsgsPublisher
- RosHarkMsgsSubscriber
- SourceTracker
- DisplayLocalization
AudioStreamFromWave
- Module Description
This modules reads wave file and outputs multi channel audio stream with a certain window length.
For more detail, see HARK Documentation.
- Module Location
Node list > HARK:AudioIO > AudioStreamFromWave
- Property settings
Name | Type | Value | Explanation |
---|---|---|---|
LENGTH | subnet_param | LENGTH | Number of samples in one frame |
ADVANCE | subnet_param | ADVANCE | Shift length |
USE_WAIT | bool | false | Enable sleep wait in order to realize real time operation. |
- Terminal settiongs
Set “INPUT” for this input.
Set “CONDITION” for this output “NOT_EOF”.
MultiFFT
- Module Description
Calculate FFT of input source stream.
For more detail, see HARK Documentation.
- Module Location
Node list > HARK:MISC > MultiFFT
- Property settings
Name | Type | Value | Explanation |
---|---|---|---|
LENGTH | subnet_param | LENGTH | Number of samples in one frame |
WINDOW | string | CONJ | Window type for FFT |
WINDOW_LENGTH | subnet_param | LENGTH | Window length for FFT |
LocalizeMUSIC
- Module Description
Main sound source localization module
For more detail, see HARK Documentation.
- Module Location
Node list > HARK:Localization > LocalizeMUSIC
- Property settings
See HARK Document LocalizeMUSIC, and set the value applicable for your environment.
RosHarkMsgsPublisher
- Module Description
This publishes all kinds of the HARK-related ROS msgs as a topic.
The publishing interval is the same as the interval of HARK network file.
- Module Location
Node list > HARK:ROS:IO > RosHarkMsgsPublisher
- Property settings
Name | Type | Value | Explanation |
---|---|---|---|
ADVANCE | subnet_param | ADVANCE | Shift length |
ENABLE_DEBUG | bool | false | Enable standard output display for debugging |
TOPIC_NAME_*** | string | Leave default value | Published ROS topic name |
BUFFER_NUM | int | 100 | Number of buffers for published messages |
ROS_LOOP_RATE | int | 100000 | Minimum interval for publishing ROS topics |
TIMESTAMP_TYPE | string | ROS_TIME_NOW | Time stamp type |
ROS_FRAME_ID | string | HarkRosFrameID | ROS frame_id of the message header |
“TOPIC_NAME_***” means all the parameters related to ROS topic name.
You can change topic names depending on your environment, but leave all as default for this tutorial.
Set ROS_LOOP_RATE large value so that ROS can publish all frame data without packet loss.
- Terminal settiongs
Set “OUTPUT” for this output.
RosHarkMsgsSubscriber
- Module Description
This subscribes all kinds of the HARK-related ROS msgs as a topic.
The module outputs most recent subscribed topic values.
- Module Location
Node list > HARK:ROS:IO > RosHarkMsgsSubscriber
- Property settings
Name | Type | Value | Explanation |
---|---|---|---|
STREAM_SELECTION | string | HarkSource | Selector of stream |
TOPIC_NAME_HARKSOURCE | string | HarkSource | Subscribed topic names for ROS |
ROS_LOOP_RATE | int | 1000000 | Minimum interval for publishing ROS topics |
MSG_BUFFER_NUM | int | 100 | Number of buffers for ROS published messages |
DATA_BUFFER_NUM | int | 100 | Number of buffers for HARK output (this is used for eliminating packet loss) |
REMAIN_LATEST | bool | false | Enable to keep the latest data as output |
ENABLE_DEBUG | bool | false | Enable standard output display for debugging |
Set ROS_LOOP_RATE large value so that ROS can subscribe all frame data without packet loss.
MSG_BUFFER is the number of buffers specified by ROS subscriber.
SourceTracker
- Module Description
Post processing of sound source localization results such as elimination by thresholds.
For more detail, see HARK Documentation.
- Module Location
Node list > HARK:Localization > SourceTracker
- Property settings
Name | Type | Value | Explanation |
---|---|---|---|
THRESH | float | ?? | Threshold for elimination of localization result |
PAUSE_LENGTH | int | 1000 | Duration frame length of the localization result |
MIN_SRC_INTERVAL | int | 20 | Angle range of the one source |
MIN_ID | int | 0 | Minimum ID of source locations |
DEBUG | bool | false | Enable standard output for debugging |
“??” means the value changes depending on your environment.
DisplayLocalization
- Module Description
Show the graphical localization result
For more detail, see HARK Documentation.
- Module Location
Node list > HARK:Localization > DisplayLocalization
- Property settings
Name | Type | Value | Explanation |
---|---|---|---|
WINDOW_NAME | string | Source Location | Window name of the time-azimuth map |
WINDOW_LENGTH | int | 1000 | Window length to show at the same time |
VERTICAL_RANGE | object | <Vector<int>-180 180> | Plot range of the vertical axis |
PLOT_TIPE | string | AZIMUTH | Coordinate setting for the plotting |
- Terminal settiongs
Set “OUTPUT_1” for this output.
Examining the network file
Save the network file before closing [e.g.) LocalizeMUSIC_with_HarkMsgs_Publisher_and_Subscriber.n ]
Open a new terminal and type
roscore
Prepare one recorded wave file for the evaluation (YOUR_WAV.wav).
Go back to the previous terminal and run the HARK network file
./LocalizeMUSIC_with_HarkMsgs_Publisher_and_Subscriber.n YOUR_WAV.wav
Now, let us check how the ROS system sees the HARK network by rqt_graph.
rosrun rqt_graph rqt_graph
You can see that the HARK_MASTER_NODE node tries to subscribe all the HARK-related ROS messages.
Since the RosHarkMsgsPublisher module publishes only the sound source location, only HarkSource is mutually communicated.
Also
rostopic list
returns
/HarkSource /rosout /rosout_agg