forked from DukeRobotics/robosub-ros
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* acoustic branch * major refactoring * update matplotlib to use agg backend * move action to custom_msgs and finalize scripts * integrated guess * list comp and refactor * Acoustic wrapper (DukeRobotics#226) Adds basic implementation for the main wrapper. * data generator (DukeRobotics#253) Co-authored-by: Reed Chen <reedchen19@gmail.com> * Saleae integration (DukeRobotics#254) * made guess_processing wrapper * updated variable names * got rid of duplicate scripts * did changes according to comments * saleae rough draft * updated saleae.py to have one line command * spelling changes * fix saeleae code and name Co-authored-by: Brandon K Bae <brandon.bae@duke.edu> Co-authored-by: Spammy0607 <71797727+Spammy0607@users.noreply.github.com> * Refactor and redesign various interfaces Refactors the data sim script and the wrapper script for better design. Updates interfaces to include messages on feedback, and return better indicators of success. * allow multiple files for guess * add readme and launch file, update dockerfiles * linting * lint again * final lint * use tuple over list for key in dictionary Co-authored-by: Estelle He <wh103@duke.edu> Co-authored-by: Reed Chen <reed.chen@duke.edu> Co-authored-by: Reed Chen <reedchen19@gmail.com> Co-authored-by: Spammy0607 <71797727+Spammy0607@users.noreply.github.com> Co-authored-by: Brandon K Bae <brandon.bae@duke.edu>
- Loading branch information
1 parent
fe9b12f
commit f78cb02
Showing
26 changed files
with
921 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -15,6 +15,9 @@ | |
# ROS_Serial | ||
catkin_ws/src/offboard_comms/ros_lib | ||
|
||
# Acoustics | ||
*.csv | ||
|
||
# Video and Bags | ||
*.avi | ||
*.bag | ||
|
This file contains 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 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
31 changes: 31 additions & 0 deletions
31
core/catkin_ws/src/custom_msgs/action/AcousticsData.action
This file contains 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,31 @@ | ||
# Goal | ||
|
||
# Sampling frequency | ||
uint32 samp_f | ||
|
||
# Target frequency | ||
uint32 tar_f | ||
|
||
# Hydrophone array used | ||
string hydrophone | ||
|
||
# Location of the pinger | ||
geometry_msgs/Point location | ||
|
||
--- | ||
# Result | ||
|
||
# Result files where data has been saved. Should be a package URL. | ||
string[] file_paths | ||
|
||
--- | ||
# Feedback | ||
|
||
# Current stage the program is on | ||
uint32 curr_stage | ||
|
||
# Total number of stages in program | ||
uint32 total_stages | ||
|
||
# Message | ||
string message |
28 changes: 28 additions & 0 deletions
28
core/catkin_ws/src/custom_msgs/action/AcousticsGuess.action
This file contains 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,28 @@ | ||
# Goal | ||
|
||
# The base filename of the data without the version | ||
string[] file_paths | ||
|
||
# Sampling frequency | ||
uint32 samp_f | ||
|
||
# Target frequency | ||
uint32 tar_f | ||
|
||
--- | ||
# Result | ||
|
||
# Guess of the location of the pinger | ||
geometry_msgs/Point guess | ||
|
||
--- | ||
# Feedback | ||
|
||
# Current stage the program is on | ||
uint32 curr_stage | ||
|
||
# Total number of stages in program | ||
uint32 total_stages | ||
|
||
# Message | ||
string message |
41 changes: 41 additions & 0 deletions
41
core/catkin_ws/src/custom_msgs/action/AcousticsProcessing.action
This file contains 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,41 @@ | ||
# Goal | ||
|
||
# The base filename of the data without the version | ||
string[] file_paths | ||
|
||
# Whether the data in the file needs to be split in half | ||
bool if_double | ||
|
||
# Sampling frequency | ||
uint32 samp_f | ||
|
||
# Target frequency | ||
uint32 tar_f | ||
|
||
# Guess of the location of the pinger | ||
geometry_msgs/Point guess | ||
--- | ||
# Result | ||
|
||
# Horizontal angle to the location of the pinger in radians | ||
float64 hz_angle | ||
|
||
# Total number of datasets processed | ||
uint32 total_count | ||
|
||
# Total number of datasets that were successfully parsed | ||
uint32 success_count | ||
|
||
# Total number of datasets that contained numerically valid data | ||
uint32 valid_count | ||
--- | ||
# Feedback | ||
|
||
# Total number of datasets that will be processed | ||
uint32 total_count | ||
|
||
# Number of datasets that have been processed | ||
uint32 process_count | ||
|
||
# Number of datasets that have been processed that were successfully parsed | ||
uint32 success_count |
22 changes: 22 additions & 0 deletions
22
core/catkin_ws/src/custom_msgs/action/AcousticsWrapper.action
This file contains 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,22 @@ | ||
# Goal | ||
|
||
# Target frequency | ||
uint32 tar_f | ||
|
||
--- | ||
# Result | ||
|
||
# Horizontal angle to the location of the pinger in radians | ||
float64 hz_angle | ||
|
||
--- | ||
# Feedback | ||
|
||
# Current stage the program is on | ||
uint32 curr_stage | ||
|
||
# Total number of stages in program | ||
uint32 total_stages | ||
|
||
# Message to display | ||
string message |
This file contains 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,31 @@ | ||
# Goal | ||
|
||
# Name of base filename to save to | ||
string save_name | ||
|
||
# Which Hydrophone Set | ||
uint32 hydrophone_set | ||
|
||
# Number of captures to take | ||
uint32 capture_count | ||
|
||
# Duration to perform capture for | ||
uint32 capture_duration | ||
|
||
--- | ||
# Result | ||
|
||
# Result files where data has been saved. Should be a package URL. | ||
string[] file_paths | ||
|
||
--- | ||
# Feedback | ||
|
||
# Current stage the program is on | ||
uint32 curr_stage | ||
|
||
# Total number of stages in program | ||
uint32 total_stages | ||
|
||
# Message | ||
string message |
This file contains 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 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 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 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 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,16 @@ | ||
cmake_minimum_required(VERSION 2.8.3) | ||
project(acoustics) | ||
|
||
|
||
## Find catkin macros and libraries | ||
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) | ||
find_package(catkin REQUIRED COMPONENTS | ||
actionlib | ||
rospy | ||
custom_msgs | ||
) | ||
|
||
|
||
catkin_package( | ||
CATKIN_DEPENDS rospy custom_msgs actionlib | ||
) |
This file contains 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,45 @@ | ||
# Acoustics | ||
|
||
This package handles the calculations for locating an underwater acoustics pinger that is pinging at a certain frequency. | ||
|
||
## Execution | ||
|
||
To launch the main sampling and processing nodes, you can use the launch file provided. Note that this expects the Logic software to already be running and the saleae device connected via USB. | ||
``` | ||
roslaunch acoustics acoustics.launch | ||
``` | ||
|
||
Refer to the section on the acoustics wrapper structure below for the specific information to send to start processing. To start an action via a GUI (without an action client) refer to this [tutorial](http://wiki.ros.org/actionlib_tutorials/Tutorials/Calling%20Action%20Server%20without%20Action%20Client). | ||
|
||
To run the data_sim server that will generate test data, you can use the command: | ||
``` | ||
rosrun acoustics data_server.py | ||
``` | ||
|
||
Refer to the section on structure below for the specific information to send to start the data generation. | ||
|
||
## Structure | ||
|
||
This package contains 5 nodes to handle various acoustics tasks: the acoustics wrapper, the saleae node, the guess server, the processing server, and the data server. | ||
|
||
### Acoustics Wrapper | ||
The acoustics wrapper node provides an external interface (an action server) to allow client code to easily call all of the steps involved in acoustics processing without providing lower level information such as the sampling frequency or file paths for saved data. | ||
|
||
The node itself provides an action server of type `custom_msgs/AcousticsWrapper.action`, which client code will use to call the action. Client code is required to provide the target frequency of the pinger (Robosub provides this depending on what course we are using), and the wrapper server will return the horizontal angle to which the pinger is located at. It will also update the client as to which step is being done via its feedback messages. | ||
|
||
### Saleae Node | ||
|
||
The saleae node interfaces with the saleae and tells it to sample data for a given duration and sample for a given amount. It saves the data to a file located in the data folder. It contains an action server using type `custom_msgs/Saleae.action`. | ||
|
||
### Guessing Node | ||
|
||
The guessing node contains code to make a guess for which octant the pinger is located in, which provides the processing node the necessary information to do its computations. The code is separated into `guess_server.py` and `cheap_cross_cor.py` to separate the ROS interface from the underlying acoustics code, to allow for the guessing code to execute without ROS. The ROS node contains an action server using type `custom_msgs/AcousticsGuess.action`. | ||
|
||
### Processing Node | ||
|
||
The processing node contains code to actually compute the horizontal angle using cross correlation. The code is separated into `processing_server.py` and `cross_corr_fft.py` to separate the ROS interface from the underlying acoustics code, to allow for the processing code to execute without ROS. The ROS node contains an action server using type `custom_msgs/AcousticsProcessing.action`. | ||
|
||
### Data Simulation Node | ||
|
||
The data simulation node contains code to simulate the saleae and generate data that represents the hydrophones at a specific point. This is used for testing the guessing and processing algorithms. The code is separated into `data_server.py` and `data_sim.py` to separate the ROS interface from the underlying acoustics code, to allow for the processing code to execute without ROS. The ROS node contains an action server using type `custom_msgs/AcousticsData.action`. | ||
|
This file contains 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,3 @@ | ||
# Data Folder | ||
|
||
Please place data that you want to process in this folder. |
This file contains 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,8 @@ | ||
<launch> | ||
|
||
<node pkg="acoustics" name="acoustics_wrapper" type="acoustics_wrapper.py" output="screen"/> | ||
<node pkg="acoustics" name="saleae" type="saleae.py" output="screen"/> | ||
<node pkg="acoustics" name="acoustics_guesser" type="guess_server.py" output="screen"/> | ||
<node pkg="acoustics" name="acoustics_processor" type="processing_server.py" output="screen"/> | ||
|
||
</launch> |
This file contains 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,18 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<name>acoustics</name> | ||
<version>0.0.0</version> | ||
<description> | ||
This package performs the processing on acoustics signals. | ||
</description> | ||
|
||
<maintainer email="hello@duke-robotics.com">Duke Robotics Club</maintainer> | ||
|
||
<license>MIT</license> | ||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
<depend>rospy</depend> | ||
<depend>custom_msgs</depend> | ||
<depend>actionlib</depend> | ||
|
||
</package> |
Oops, something went wrong.