Skip to content

Commit 2c62de0

Browse files
committed
Start create the ros2 package and address some comments
Signed-off-by: Maria Teresa Ortega <teresa.ortega0903@gmail.com>
1 parent fd2879b commit 2c62de0

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

lambkin_ros2/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
find_package(ament_cmake REQUIRED)
2+
find_package(ament_cmake_python REQUIRED)
3+
4+
5+
6+
install(
7+
DIRECTORY
8+
launch
9+
DESTINATION share/${PROJECT_NAME})
10+
DESTINATION share/${PROJECT_NAME})
11+
12+
ament_package()

lambkin_ros2/package.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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>lambkin_ros2</name>
5+
<version>1.0.0</version>
6+
<description>Benchmarking tool for Beluga Localization (LAMBKIN)</description>
7+
8+
<exec_depend>python3-numpy</exec_depend>
9+
<exec_depend>python3-pandas</exec_depend>
10+
<exec_depend>python3-tk</exec_depend>
11+
12+
13+
<exec_depend>ros2bag</exec_depend>
14+
<exec_depend>rosbag2_transport</exec_depend>
15+
<exec_depend>rosbag2_storage_default_plugins</exec_depend>
16+
<export>
17+
<build_type>ament_cmake</build_type>
18+
</export>
19+
</package>

src/lambkin/lambkin.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
RECORD_TOPICS_INTERESTED = ["/pose", "/tf", "/tf_static"]
2323
RESULTS_PATH = "/ws/lambkin/benchmarking_results"
2424
DRY_MODE = True
25+
PROCESS_TERMINATION_TIMEOUT = 5.0
2526

2627

2728
def execute_background_process(
@@ -204,16 +205,19 @@ def wait_for_processes(
204205
waitlist (list[subprocess.Popen]): Processes that must complete naturally.
205206
termination_list (list[subprocess.Popen]): Processes that should be terminated.
206207
"""
208+
# Wait waitlist processes to finish naturally
207209
for p in waitlist:
208210
if p is not None:
209211
p.wait()
212+
# Broadcast SIGTERM to all termination_list processes
210213
for p in termination_list:
211214
if p is not None:
212215
p.terminate()
216+
# Wait up to timeout for them to close; force-kill if they hang
213217
for p in termination_list:
214218
if p is not None:
215219
try:
216-
p.wait(timeout=5.0)
220+
p.wait(timeout=PROCESS_TERMINATION_TIMEOUT)
217221
except subprocess.TimeoutExpired:
218222
print("Forcing process termination...")
219223
p.kill()

0 commit comments

Comments
 (0)