Skip to content

Commit 170ab9f

Browse files
committed
Switched to a cpp package for a better pose display node
1 parent 3a1a7eb commit 170ab9f

File tree

5 files changed

+250
-249
lines changed

5 files changed

+250
-249
lines changed

turtlebot4_vision_tutorials/turtlebot4_vision_tutorials/pose_display.py

Lines changed: 0 additions & 222 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
cmake_minimum_required(VERSION 3.8)
2+
project(turtlebot4_vision_tutorials_cpp)
3+
4+
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
5+
add_compile_options(-Wall -Wextra -Wpedantic)
6+
endif()
7+
8+
# find dependencies
9+
find_package(ament_cmake REQUIRED)
10+
find_package(cv_bridge REQUIRED)
11+
find_package(geometry_msgs REQUIRED)
12+
find_package(image_transport REQUIRED)
13+
find_package(OpenCV REQUIRED COMPONENTS highgui imgcodecs imgproc videoio)
14+
find_package(rclcpp REQUIRED)
15+
find_package(sensor_msgs REQUIRED)
16+
17+
add_executable(pose_display src/pose_display.cpp)
18+
target_include_directories(pose_display PUBLIC
19+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
20+
$<INSTALL_INTERFACE:include>)
21+
target_compile_features(pose_display PUBLIC c_std_99 cxx_std_17) # Require C99 and C++17
22+
23+
ament_target_dependencies(pose_display rclcpp cv_bridge OpenCV image_transport)
24+
25+
install(DIRECTORY launch
26+
DESTINATION share/${PROJECT_NAME})
27+
28+
install(TARGETS pose_display
29+
DESTINATION lib/${PROJECT_NAME})
30+
31+
if(BUILD_TESTING)
32+
find_package(ament_lint_auto REQUIRED)
33+
# the following line skips the linter which checks for copyrights
34+
# comment the line when a copyright and license is added to all source files
35+
set(ament_cmake_copyright_FOUND TRUE)
36+
# the following line skips cpplint (only works in a git repo)
37+
# comment the line when this package is in a git repo and when
38+
# a copyright and license is added to all source files
39+
set(ament_cmake_cpplint_FOUND TRUE)
40+
ament_lint_auto_find_test_dependencies()
41+
endif()
42+
43+
ament_package()

turtlebot4_vision_tutorials/launch/pose_display.launch.py renamed to turtlebot4_vision_tutorials_cpp/launch/pose_display.launch.py

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,17 @@
2121
from launch.substitutions import LaunchConfiguration
2222
from launch_ros.actions import Node
2323

24-
2524
def generate_launch_description():
26-
namespaces = ['tb21', 'tb10']
27-
# namespaces = LaunchConfiguration('namespaces')
28-
29-
# arg_namespaces = DeclareLaunchArgument(
30-
# 'namespaces',
31-
# default_value='[tb10, tb11]')
32-
33-
ffmpeg_nodes = []
34-
35-
for i, ns in enumerate(namespaces):
36-
ffmpeg_nodes.append(
37-
Node(
38-
package='image_transport',
39-
executable='republish',
40-
name=f'ffmpeg_decoder{i}',
41-
remappings=[
42-
('in/ffmpeg', f'/{ns}/oakd/rgb/preview/encoded/ffmpeg'),
43-
('out', f'/{ns}/oakd/rgb/preview/ffmpeg_decoded')],
44-
arguments=['ffmpeg', 'raw'],
45-
)
46-
)
25+
namespaces = ['tb11', 'tb12', 'tb13', 'tb14', 'tb15',]
4726

4827
display_node = Node(
49-
package='turtlebot4_vision_tutorials',
28+
package='turtlebot4_vision_tutorials_cpp',
5029
executable='pose_display',
5130
name='pose_display',
5231
parameters=[{'namespaces': namespaces}],
53-
5432
)
5533

5634
ld = LaunchDescription()
57-
# ld.add_action(arg_namespaces)
58-
for n in ffmpeg_nodes:
59-
ld.add_action(n)
6035
ld.add_action(display_node)
6136

6237
return ld
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0"?>
2+
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
3+
<package format="3">
4+
<name>turtlebot4_vision_tutorials_cpp</name>
5+
<version>0.0.0</version>
6+
<description>TODO: Package description</description>
7+
<maintainer email="hluo@clearpathrobotics.com">hluo</maintainer>
8+
<license>TODO: License declaration</license>
9+
10+
<buildtool_depend>ament_cmake</buildtool_depend>
11+
12+
<depend>cv_bridge</depend>
13+
<depend>geometry_msgs</depend>
14+
<depend>ffmpeg_image_transport</depend>
15+
<depend>image_transport</depend>
16+
<depend>libopencv-dev</depend>
17+
<depend>sensor_msgs</depend>
18+
19+
<test_depend>ament_lint_auto</test_depend>
20+
<test_depend>ament_lint_common</test_depend>
21+
22+
<export>
23+
<build_type>ament_cmake</build_type>
24+
</export>
25+
</package>

0 commit comments

Comments
 (0)