Skip to content

Commit

Permalink
Merge pull request #213 from bit-bots/feature/audio_launch_file
Browse files Browse the repository at this point in the history
Add audio launch file
  • Loading branch information
jaagut authored Apr 28, 2023
2 parents 646aa6e + 7758165 commit 87ad882
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 4 deletions.
8 changes: 8 additions & 0 deletions bitbots_bringup/launch/highlevel.launch
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<arg name="teamcom" default="false" description="Whether the team communication system should be started" />
<arg name="vision" default="true" description="Whether the vision system should be started" />
<arg name="world_model" default="true" description="Whether the world model should be started"/>
<arg name="audio" default="true" description="Whether the audio system should be started"/>


<!-- launch game controller -->
Expand Down Expand Up @@ -75,4 +76,11 @@
<arg name="sim" value="$(var sim)" />
</include>
</group>

<!-- launch audio processing -->
<group if="$(var audio)">
<include file="(find-pkg-share bitbots_utils)/launch/audio.launch">
<arg name="sim" value="$(var sim)" />
</include>
</group>
</launch>
17 changes: 17 additions & 0 deletions bitbots_utils/launch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### How to record audio to ROS Bag

Launch these commands in parallel:

```bash
ros2 launch bitbots_utils audio.launch
ros2 bag record /audio/audio /audio/audio_info
```

### How to play audio from ROS Bag

Launch these commands in parallel:

```bash
ros2 bag play <bagfile> --loop
ros2 launch audio_play play.launch.xml format:=wave sample_rate:=10000
```
29 changes: 29 additions & 0 deletions bitbots_utils/launch/audio.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?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" />

<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>
</launch>
12 changes: 8 additions & 4 deletions bitbots_utils/launch/tools.launch
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?xml version="1.0"?>
<launch>
<include file="$(find-pkg-share system_monitor)/launch/system_monitor.launch">
<arg name="required" value="false" />
</include>
<arg name="monitoring" default="true" description="true: start system monitor and udp bridge" />

<include file="$(find-pkg-share udp_bridge)/launch/send.launch" />
<group if="$(var monitoring)">
<include file="$(find-pkg-share system_monitor)/launch/system_monitor.launch">
<arg name="required" value="false" />
</include>

<include file="$(find-pkg-share udp_bridge)/launch/send.launch" />
</group>
</launch>
1 change: 1 addition & 0 deletions bitbots_utils/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<exec_depend>wolfgang_description</exec_depend>
<exec_depend>wolfgang_moveit_config</exec_depend>
<exec_depend>xacro</exec_depend>
<exec_depend>audio_common</exec_depend>
<depend>python3-yaml</depend>
<depend>python3-transforms3d</depend>
<depend>python3-numpy</depend>
Expand Down

0 comments on commit 87ad882

Please sign in to comment.