Skip to content

Commit cca2262

Browse files
committed
update launch.py
1 parent 1ca9482 commit cca2262

7 files changed

+61
-7
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
| Base | ROS2 C++ | ROS2 Python |
1212
| --------------- | -------- | ----------- |
13-
| CPU | ||
14-
| CUDA | ||
15-
| CUDA (FP16) | ||
13+
| PyTorch | ||
14+
| PyTorch(CUDA) | ||
15+
| PyTorch(CUDA-FP16) | ||
1616
| TensorRT (CUDA) || |
1717
| OpenVINO |||
1818
| ONNX Runtime | ||
File renamed without changes.
File renamed without changes.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
from matplotlib import image
2+
import launch
3+
import launch_ros.actions
4+
from launch.actions import DeclareLaunchArgument
5+
from ament_index_python.packages import get_package_share_directory
6+
from launch.launch_description_sources import PythonLaunchDescriptionSource
7+
from launch.substitutions import LaunchConfiguration
8+
9+
from urllib.request import urlretrieve
10+
import os
11+
12+
def generate_launch_description():
13+
yolox_ros_share_dir = get_package_share_directory('yolox_ros_py')
14+
15+
dog_path = os.path.join(yolox_ros_share_dir, "./", "dog.jpg")
16+
url = "https://raw.githubusercontent.com/pjreddie/darknet/master/data/dog.jpg"
17+
if not os.path.exists(dog_path):
18+
os.system("wget {} -O {}".format(url, dog_path))
19+
20+
21+
image_path = LaunchConfiguration('image_path', default=dog_path)
22+
image_path_arg = DeclareLaunchArgument(
23+
'image_path',
24+
default_value=dog_path,
25+
description='Image path'
26+
)
27+
28+
image_pub = launch_ros.actions.Node(
29+
package='image_publisher',
30+
executable='image_publisher_node',
31+
name='image_publisher',
32+
arguments=[image_path],
33+
)
34+
yolox_onnx = launch_ros.actions.Node(
35+
package="yolox_ros_py", executable="yolox_onnx",output="screen",
36+
parameters=[
37+
{"image_size/width": 640},
38+
{"image_size/height": 480},
39+
40+
{"input_shape/width": 416},
41+
{"input_shape/height": 416},
42+
43+
{"with_p6" : False},
44+
{"model_path" : yolox_ros_share_dir+"/yolox_nano.onnx"},
45+
{"conf" : 0.3},
46+
],
47+
)
48+
49+
rqt_graph = launch_ros.actions.Node(
50+
package="rqt_graph", executable="rqt_graph",
51+
)
52+
53+
return launch.LaunchDescription([
54+
image_path_arg,
55+
image_pub,
56+
yolox_onnx,
57+
# rqt_graph
58+
])

yolox_ros_py/launch/yolox_nano_onnx_youtube.launch.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from launch.launch_description_sources import PythonLaunchDescriptionSource
88
import launch_ros
99

10-
1110
def generate_launch_description():
1211
yolox_ros_share_dir = get_package_share_directory('yolox_ros_py')
1312
youtube_publisher_share_dir = get_package_share_directory('youtube_publisher')
File renamed without changes.

yolox_ros_py/launch/yolox_nano.launch.py renamed to yolox_ros_py/launch/yolox_nano_torch_gpu_camera.launch.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
from launch.launch_description_sources import PythonLaunchDescriptionSource
66
from launch.substitutions import LaunchConfiguration
77

8-
from urllib.request import urlretrieve
9-
import os
10-
118
def generate_launch_description():
129
yolox_ros_share_dir = get_package_share_directory('yolox_ros_py')
1310

0 commit comments

Comments
 (0)