From 8e37484dd7dcb8bd0f3d52d746ec9512f75120a5 Mon Sep 17 00:00:00 2001
From: Hongyu Li
Date: Tue, 29 Mar 2022 15:48:40 -0400
Subject: [PATCH] updated audio node name and removed prints
---
vz_acoustic_scene_analysis/launch/wav_audio.launch | 2 +-
.../scripts/{stretch_audio.py => ros_interface.py} | 6 ++----
vz_ros_wrappers/launch/D435i_and_Lepton.launch | 4 +++-
vz_ros_wrappers/scripts/grab_D435i.py | 5 ++++-
vz_ros_wrappers/scripts/grab_thermal.py | 5 ++++-
5 files changed, 14 insertions(+), 8 deletions(-)
rename vz_acoustic_scene_analysis/scripts/{stretch_audio.py => ros_interface.py} (98%)
diff --git a/vz_acoustic_scene_analysis/launch/wav_audio.launch b/vz_acoustic_scene_analysis/launch/wav_audio.launch
index ce95e91..53ee760 100644
--- a/vz_acoustic_scene_analysis/launch/wav_audio.launch
+++ b/vz_acoustic_scene_analysis/launch/wav_audio.launch
@@ -1,4 +1,4 @@
-
+
\ No newline at end of file
diff --git a/vz_acoustic_scene_analysis/scripts/stretch_audio.py b/vz_acoustic_scene_analysis/scripts/ros_interface.py
similarity index 98%
rename from vz_acoustic_scene_analysis/scripts/stretch_audio.py
rename to vz_acoustic_scene_analysis/scripts/ros_interface.py
index 6987892..2617362 100755
--- a/vz_acoustic_scene_analysis/scripts/stretch_audio.py
+++ b/vz_acoustic_scene_analysis/scripts/ros_interface.py
@@ -222,6 +222,7 @@ class ROSInterface:
self.sequence_size = 3 # self.secs/self.chunk_size
if (self.record_count % self.sequence_size == 0):
return_list = self.wav_list
+ print("Collected %d seconds of audio" %(self.secs))
# Remove fist two objects in array to remove 0.2 seconds of audio data from array
self.wav_list.pop(0)
self.wav_list.pop(0)
@@ -245,8 +246,6 @@ class ROSInterface:
for i in range(0, arr_length):
data = stream.read(CHUNK)
a = np.frombuffer(data,dtype=np.int16)[0::6] # extracts fused channel 0
- print("a type: ", type(a[0]))
- print("a length: ", len(a))
self.audio_data_pub.publish(a)
frames.append(a.tobytes())
@@ -275,10 +274,9 @@ class ROSInterface:
if(isinstance(wav_data, list)):
# flatten list
flat_list = [item for sublist in wav_data for item in sublist]
- print(type(flat_list[0]))
# Call of Utku's function
self.cough_prob = dsp.classify_cough(flat_list,RESPEAKER_RATE,self.loaded_model,self.loaded_scaler)
- print(self.cough_prob)
+ print("%d %% probability of cough" %(self.cough_prob))
# do something with probability (publish?)
except usb.core.USBError:
print('Respeaker not on USB bus')
diff --git a/vz_ros_wrappers/launch/D435i_and_Lepton.launch b/vz_ros_wrappers/launch/D435i_and_Lepton.launch
index 3bc7305..44b114d 100644
--- a/vz_ros_wrappers/launch/D435i_and_Lepton.launch
+++ b/vz_ros_wrappers/launch/D435i_and_Lepton.launch
@@ -4,5 +4,7 @@
-
+
+
+
\ No newline at end of file
diff --git a/vz_ros_wrappers/scripts/grab_D435i.py b/vz_ros_wrappers/scripts/grab_D435i.py
index 39ede80..45480a1 100755
--- a/vz_ros_wrappers/scripts/grab_D435i.py
+++ b/vz_ros_wrappers/scripts/grab_D435i.py
@@ -44,10 +44,13 @@ class D435i:
self.D435i_cap = cv2.VideoCapture('/dev/video4')
# self.D435i_cap = cv2.VideoCapture('/home/ananya/Downloads/2022-02-09-16-20-58(2).mp4')
+ # Get topic parameter
+ self.rgbd_topic = rospy.get_param("rgbd_topic")
+
if not self.D435i_cap.isOpened():
raise(Exception,'Unable to open video stream')
self.bridge = CvBridge()
- self.D435i_pub = rospy.Publisher('/D435i/image_raw', Image, queue_size=100)
+ self.D435i_pub = rospy.Publisher(self.rgbd_topic, Image, queue_size=100)
self.timer = rospy.Timer(rospy.Duration(0, UPDATE_RATE), self.publish_image)
self.timer_display = rospy.Timer(rospy.Duration(0, UPDATE_RATE), self.display_images)
diff --git a/vz_ros_wrappers/scripts/grab_thermal.py b/vz_ros_wrappers/scripts/grab_thermal.py
index 9279e3b..0520e56 100755
--- a/vz_ros_wrappers/scripts/grab_thermal.py
+++ b/vz_ros_wrappers/scripts/grab_thermal.py
@@ -49,11 +49,14 @@ class FLIR_LEPTON:
self.thermal_cap = cv2.VideoCapture('/dev/video6')
# self.thermal_cap = cv2.VideoCapture('/home/ananya/Downloads/Thermal-3(2).mp4')
+
+ # Get topic parameter
+ self.thermal_topic = rospy.get_param("thermal_topic")
if not self.thermal_cap.isOpened():
raise(Exception,'Unable to open video stream')
self.bridge = CvBridge()
- self.thermal_pub = rospy.Publisher('/flir_3_5_near_realsense_raw', Image, queue_size=100)
+ self.thermal_pub = rospy.Publisher(self.thermal_topic, Image, queue_size=100)
self.timer = rospy.Timer(rospy.Duration(0, UPDATE_RATE), self.publish_image)
self.timer_display = rospy.Timer(rospy.Duration(0, UPDATE_RATE), self.display_images)