Skip to content

Commit a0494cc

Browse files
committed
Clean up
1 parent 170ab9f commit a0494cc

File tree

7 files changed

+84
-272
lines changed

7 files changed

+84
-272
lines changed

turtlebot4_vision_tutorials/launch/pose_detection.launch.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#
1717
# @author Hilary Luo (hluo@clearpathrobotics.com)
1818

19-
# from ament_index_python.packages import get_package_share_directory
2019
from launch import LaunchDescription
2120
from launch.actions.declare_launch_argument import DeclareLaunchArgument
2221
from launch.substitutions import LaunchConfiguration
@@ -25,38 +24,20 @@
2524

2625
def generate_launch_description():
2726
namespace = LaunchConfiguration('namespace')
28-
# ffmpeg_param_file = LaunchConfiguration('ffmpeg_param_file')
29-
30-
# turtlebot4_vision_tutorials = get_package_share_directory('turtlebot4_vision_tutorials')
31-
32-
# arg_parameters = DeclareLaunchArgument(
33-
# 'ffmpeg_param_file',
34-
# default_value=PathJoinSubstitution(
35-
# [turtlebot4_vision_tutorials, 'config', 'ffmpeg.yaml']),
36-
# description='Turtlebot4 ffmpeg compression param file'
37-
# )
3827

3928
arg_namespace = DeclareLaunchArgument(
4029
'namespace',
4130
default_value='')
4231

43-
# parameters = RewrittenYaml(
44-
# source_file=ffmpeg_param_file,
45-
# root_key=namespace,
46-
# param_rewrites={},
47-
# convert_types=True)
48-
49-
ffmpeg_node = Node(
32+
pose_node = Node(
5033
package='turtlebot4_vision_tutorials',
5134
executable='pose_detection',
5235
namespace=namespace,
5336
name='pose_detection',
54-
# parameters=[parameters],
5537
)
5638

5739
ld = LaunchDescription()
58-
# ld.add_action(arg_parameters)
5940
ld.add_action(arg_namespace)
60-
ld.add_action(ffmpeg_node)
41+
ld.add_action(pose_node)
6142

6243
return ld

turtlebot4_vision_tutorials/launch/video_decode.launch.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,6 @@ def generate_launch_description():
2929
'namespace',
3030
default_value='')
3131

32-
parameters = {
33-
"/cpr_donatello/ffmpeg_decoder": {
34-
"ros__parameters": {
35-
"qos_overrides": {
36-
"/cpr_donatello/oakd/rgb/preview/encoded/ffmpeg": {
37-
"subscriber": {
38-
"reliability": "best_effort",
39-
"depth": 10,
40-
"history": "keep_last"
41-
}
42-
}
43-
}
44-
}
45-
}
46-
}
47-
4832
ffmpeg_node = Node(
4933
package='image_transport',
5034
executable='republish',
@@ -55,7 +39,6 @@ def generate_launch_description():
5539
('out', "oakd/rgb/preview/ffmpeg_decoded"),
5640
],
5741
arguments=['ffmpeg', 'raw'],
58-
parameters=[parameters],
5942
)
6043

6144
ld = LaunchDescription()

turtlebot4_vision_tutorials/templates/template_processing_script.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
# Source: https://github.com/geaxgx/depthai_movenet/
2+
# Adapted by: Hilary Luo (hluo@clearpathrobotics.com)
3+
4+
# Original source license:
5+
6+
# MIT License
7+
8+
# Copyright (c) [2021] [geax]
9+
10+
# Permission is hereby granted, free of charge, to any person obtaining a copy
11+
# of this software and associated documentation files (the "Software"), to deal
12+
# in the Software without restriction, including without limitation the rights
13+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
# copies of the Software, and to permit persons to whom the Software is
15+
# furnished to do so, subject to the following conditions:
16+
17+
# The above copyright notice and this permission notice shall be included in all
18+
# copies or substantial portions of the Software.
19+
20+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26+
# SOFTWARE.
27+
128
"""
229
This file is the template of the scripting node source code in edge mode
330
Substitution is made in MovenetDepthaiEdge.py

turtlebot4_vision_tutorials/turtlebot4_vision_tutorials/FPS.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

turtlebot4_vision_tutorials/turtlebot4_vision_tutorials/MovenetDepthaiEdge.py

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
# Source: https://github.com/geaxgx/depthai_movenet/
2+
# Adapted by: Hilary Luo (hluo@clearpathrobotics.com)
3+
4+
# Original source license:
5+
6+
# MIT License
7+
8+
# Copyright (c) [2021] [geax]
9+
10+
# Permission is hereby granted, free of charge, to any person obtaining a copy
11+
# of this software and associated documentation files (the "Software"), to deal
12+
# in the Software without restriction, including without limitation the rights
13+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
# copies of the Software, and to permit persons to whom the Software is
15+
# furnished to do so, subject to the following conditions:
16+
17+
# The above copyright notice and this permission notice shall be included in all
18+
# copies or substantial portions of the Software.
19+
20+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26+
# SOFTWARE.
27+
128
from collections import namedtuple
229
from math import gcd
330
import numpy as np
@@ -8,8 +35,6 @@
835
import depthai as dai
936
import marshal
1037

11-
from turtlebot4_vision_tutorials.FPS import FPS
12-
1338
from ament_index_python.packages import get_package_share_directory
1439

1540
SHARE_DIR = get_package_share_directory('turtlebot4_vision_tutorials')
@@ -138,7 +163,6 @@ class MovenetDepthai:
138163
- internal_frame_height : when using the internal color camera, set the frame height
139164
(calling setIspScale()). The width is calculated accordingly to
140165
height and depends on value of 'crop'
141-
- stats : True or False, when True, display the global FPS when exiting.
142166
"""
143167
def __init__(self,
144168
input_src="rgb",
@@ -147,8 +171,7 @@ def __init__(self,
147171
crop=False,
148172
smart_crop=True,
149173
internal_fps=None,
150-
internal_frame_height=640,
151-
stats=True):
174+
internal_frame_height=640):
152175

153176
self.model = model
154177

@@ -166,14 +189,12 @@ def __init__(self,
166189
self.pd_input_length = 256
167190
print(f"Using blob file : {self.model}")
168191

169-
print(f"MoveNet imput size : {self.pd_input_length}x{self.pd_input_length}x3")
192+
print(f"MoveNet input size : {self.pd_input_length}x{self.pd_input_length}x3")
170193

171194
self.score_thresh = score_thresh
172-
173195
self.crop = crop
174196
self.smart_crop = smart_crop
175197
self.internal_fps = internal_fps
176-
self.stats = stats
177198

178199
if input_src is None or input_src == "rgb" or input_src == "rgb_laconic":
179200
self.input_type = "rgb" # OAK* internal color camera
@@ -223,15 +244,8 @@ def __init__(self,
223244
if not self.laconic:
224245
self.q_video = self.device.getOutputQueue(name="cam_out", maxSize=1, blocking=False)
225246
self.q_processing_out = self.device.getOutputQueue(name="processing_out",
226-
maxSize=4,
247+
maxSize=1,
227248
blocking=False)
228-
# For debugging
229-
# self.q_manip_out=self.device.getOutputQueue(name="manip_out", maxSize=1, blocking=False)
230-
231-
self.fps = FPS()
232-
233-
self.nb_frames = 0
234-
self.nb_pd_inferences = 0
235249

236250
def create_pipeline(self):
237251
print("Creating pipeline...")
@@ -349,14 +363,11 @@ def pd_postprocess(self, inference):
349363
return body
350364

351365
def next_frame(self):
352-
self.fps.update()
353-
354366
# Get the device camera frame if wanted
355367
if self.laconic:
356368
frame = np.zeros((self.frame_size, self.frame_size, 3), dtype=np.uint8)
357369
else:
358-
in_video = self.q_video.get()
359-
frame = in_video.getCvFrame()
370+
frame = self.q_video.get().getCvFrame()
360371

361372
# For debugging
362373
# manip = self.q_manip_out.get().getCvFrame()
@@ -367,16 +378,4 @@ def next_frame(self):
367378
body = self.pd_postprocess(inference)
368379
self.crop_region = body.next_crop_region
369380

370-
size = (in_video.getWidth(), in_video.getHeight())
371-
372-
# Statistics
373-
if self.stats:
374-
self.nb_frames += 1
375-
self.nb_pd_inferences += 1
376-
377-
return frame, body, size
378-
379-
def exit(self):
380-
# Print some stats
381-
if self.stats:
382-
print(f"FPS: {self.fps.global_duration():.1f} f/s (# frames = {self.fps.nb_frames()})")
381+
return frame, body

turtlebot4_vision_tutorials/turtlebot4_vision_tutorials/MovenetRenderer.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

0 commit comments

Comments
 (0)