Skip to content

Commit 0128cd9

Browse files
authored
Use moveit_configs_utils for launch files (#365)
1 parent d1fb6ac commit 0128cd9

11 files changed

Lines changed: 95 additions & 398 deletions

.github/workflows/ci.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ jobs:
1515
matrix:
1616
env:
1717
# TODO: We have to use -Wno-redundant-decls since rosidl_generator_c is generating broken headers
18+
- IMAGE: humble-source
19+
CXXFLAGS: >-
20+
-Werror -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wno-redundant-decls
21+
-Wno-unused-parameter -Wno-unused-function -Wno-deprecated-copy -Wno-unused-but-set-parameter
1822
- IMAGE: rolling-source
1923
NAME: ccov
2024
TARGET_CMAKE_ARGS: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="--coverage"
@@ -34,6 +38,7 @@ jobs:
3438
DOCKER_RUN_OPTS: >-
3539
-e PRELOAD=libasan.so.5
3640
-e LSAN_OPTIONS="suppressions=$PWD/.github/workflows/lsan.suppressions,fast_unwind_on_malloc=0"
41+
-e ASAN_OPTIONS="new_delete_type_mismatch=0,alloc_dealloc_mismatch=0"
3742
TARGET_CMAKE_ARGS: -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer -O1"
3843

3944
env:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
leak:class_loader
2+
leak:rviz_default_plugins
3+
leak:static_transform_broadcaster_node

core/package.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
<test_depend>ament_cmake_gmock</test_depend>
2323
<test_depend>ament_cmake_gtest</test_depend>
24+
<test_depend>moveit_configs_utils</test_depend>
2425
<!-- TODO(JafarAbdi): Enable after porting integration tests-->
2526
<!-- test_depend>launch</test_depend -->
2627
<!-- test_depend>launch_testing</test_depend -->

core/test/move_to.launch.py

Lines changed: 13 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,34 @@
11
import unittest
2-
import os
3-
import yaml
42

3+
import launch_testing
4+
import pytest
55
from launch import LaunchDescription
66
from launch.actions import DeclareLaunchArgument
77
from launch.substitutions import LaunchConfiguration
8-
import launch_testing
9-
from launch_testing.asserts import assertExitCodes
10-
from launch_testing.util import KeepAliveProc
11-
from launch_testing.actions import ReadyToTest
12-
from ament_index_python.packages import get_package_share_directory
138
from launch_ros.actions import Node
14-
15-
import pytest
16-
17-
import xacro
18-
19-
20-
def load_file(package_name, file_path):
21-
package_path = get_package_share_directory(package_name)
22-
absolute_file_path = os.path.join(package_path, file_path)
23-
24-
try:
25-
with open(absolute_file_path, "r") as file:
26-
return file.read()
27-
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available
28-
return None
29-
30-
31-
def load_yaml(package_name, file_path):
32-
package_path = get_package_share_directory(package_name)
33-
absolute_file_path = os.path.join(package_path, file_path)
34-
35-
try:
36-
with open(absolute_file_path, "r") as file:
37-
return yaml.safe_load(file)
38-
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available
39-
return None
9+
from launch_testing.actions import ReadyToTest
10+
from launch_testing.util import KeepAliveProc
11+
from moveit_configs_utils import MoveItConfigsBuilder
4012

4113

4214
@pytest.mark.launch_test
4315
def generate_test_description():
44-
# planning_context
45-
robot_description_config = xacro.process_file(
46-
os.path.join(
47-
get_package_share_directory("moveit_resources_panda_moveit_config"),
48-
"config",
49-
"panda.urdf.xacro",
50-
)
16+
moveit_config = (
17+
MoveItConfigsBuilder("moveit_resources_panda")
18+
.robot_description(file_path="config/panda.urdf.xacro")
19+
.to_moveit_configs()
5120
)
52-
robot_description = {"robot_description": robot_description_config.toxml()}
53-
54-
robot_description_semantic_config = load_file(
55-
"moveit_resources_panda_moveit_config", "config/panda.srdf"
56-
)
57-
robot_description_semantic = {
58-
"robot_description_semantic": robot_description_semantic_config
59-
}
60-
61-
kinematics_yaml = load_yaml(
62-
"moveit_resources_panda_moveit_config", "config/kinematics.yaml"
63-
)
64-
robot_description_kinematics = {"robot_description_kinematics": kinematics_yaml}
65-
66-
robot_description_planning = {
67-
"robot_description_planning": load_yaml(
68-
"moveit_resources_panda_moveit_config", "config/joint_limits.yaml"
69-
)
70-
}
7121

7222
test_exec = Node(
7323
executable=[
7424
LaunchConfiguration("test_binary"),
7525
],
7626
output="screen",
7727
parameters=[
78-
robot_description,
79-
robot_description_semantic,
80-
robot_description_kinematics,
81-
robot_description_planning,
28+
moveit_config.robot_description,
29+
moveit_config.robot_description_semantic,
30+
moveit_config.robot_description_kinematics,
31+
moveit_config.joint_limits,
8232
],
8333
)
8434

demo/launch/alternative_path_costs.launch.py

Lines changed: 10 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,25 @@
1-
import os
2-
import yaml
31
from launch import LaunchDescription
42
from launch_ros.actions import Node
5-
from ament_index_python.packages import get_package_share_directory
6-
7-
8-
def load_file(package_name, file_path):
9-
package_path = get_package_share_directory(package_name)
10-
absolute_file_path = os.path.join(package_path, file_path)
11-
12-
try:
13-
with open(absolute_file_path, "r") as file:
14-
return file.read()
15-
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available
16-
return None
17-
18-
19-
def load_yaml(package_name, file_path):
20-
package_path = get_package_share_directory(package_name)
21-
absolute_file_path = os.path.join(package_path, file_path)
22-
23-
try:
24-
with open(absolute_file_path, "r") as file:
25-
return yaml.safe_load(file)
26-
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available
27-
return None
3+
from moveit_configs_utils import MoveItConfigsBuilder
284

295

306
def generate_launch_description():
31-
# Get URDF and SRDF
32-
robot_description_config = load_file(
33-
"moveit_resources_panda_description", "urdf/panda.urdf"
34-
)
35-
robot_description = {"robot_description": robot_description_config}
36-
37-
robot_description_semantic_config = load_file(
38-
"moveit_resources_panda_moveit_config", "config/panda.srdf"
39-
)
40-
robot_description_semantic = {
41-
"robot_description_semantic": robot_description_semantic_config
42-
}
43-
44-
kinematics_yaml = load_yaml(
45-
"moveit_resources_panda_moveit_config", "config/kinematics.yaml"
46-
)
47-
48-
# Planning Functionality
49-
ompl_planning_pipeline_config = {
50-
"move_group": {
51-
"planning_plugin": "ompl_interface/OMPLPlanner",
52-
"request_adapters": """default_planner_request_adapters/AddTimeOptimalParameterization default_planner_request_adapters/FixWorkspaceBounds default_planner_request_adapters/FixStartStateBounds default_planner_request_adapters/FixStartStateCollision default_planner_request_adapters/FixStartStatePathConstraints""",
53-
"start_state_max_bounds_error": 0.1,
54-
}
55-
}
56-
ompl_planning_yaml = load_yaml(
57-
"moveit_resources_panda_moveit_config", "config/ompl_planning.yaml"
7+
moveit_config = (
8+
MoveItConfigsBuilder("moveit_resources_panda")
9+
.robot_description(file_path="config/panda.urdf.xacro")
10+
.planning_pipelines(pipelines=["ompl"])
11+
.to_moveit_configs()
5812
)
59-
ompl_planning_pipeline_config["move_group"].update(ompl_planning_yaml)
6013

6114
cartesian_task = Node(
6215
package="moveit_task_constructor_demo",
6316
executable="alternative_path_costs",
6417
output="screen",
6518
parameters=[
66-
robot_description,
67-
robot_description_semantic,
68-
kinematics_yaml,
69-
ompl_planning_pipeline_config,
19+
moveit_config.robot_description,
20+
moveit_config.robot_description_semantic,
21+
moveit_config.robot_description_kinematics,
22+
moveit_config.planning_pipelines,
7023
],
7124
)
7225

demo/launch/cartesian.launch.py

Lines changed: 10 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,24 @@
1-
import os
2-
import yaml
31
from launch import LaunchDescription
42
from launch_ros.actions import Node
5-
from ament_index_python.packages import get_package_share_directory
6-
7-
8-
def load_file(package_name, file_path):
9-
package_path = get_package_share_directory(package_name)
10-
absolute_file_path = os.path.join(package_path, file_path)
11-
12-
try:
13-
with open(absolute_file_path, "r") as file:
14-
return file.read()
15-
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available
16-
return None
17-
18-
19-
def load_yaml(package_name, file_path):
20-
package_path = get_package_share_directory(package_name)
21-
absolute_file_path = os.path.join(package_path, file_path)
22-
23-
try:
24-
with open(absolute_file_path, "r") as file:
25-
return yaml.safe_load(file)
26-
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available
27-
return None
3+
from moveit_configs_utils import MoveItConfigsBuilder
284

295

306
def generate_launch_description():
31-
# Get URDF and SRDF
32-
robot_description_config = load_file(
33-
"moveit_resources_panda_description", "urdf/panda.urdf"
34-
)
35-
robot_description = {"robot_description": robot_description_config}
36-
37-
robot_description_semantic_config = load_file(
38-
"moveit_resources_panda_moveit_config", "config/panda.srdf"
39-
)
40-
robot_description_semantic = {
41-
"robot_description_semantic": robot_description_semantic_config
42-
}
43-
44-
kinematics_yaml = load_yaml(
45-
"moveit_resources_panda_moveit_config", "config/kinematics.yaml"
7+
moveit_config = (
8+
MoveItConfigsBuilder("moveit_resources_panda")
9+
.robot_description(file_path="config/panda.urdf.xacro")
10+
.to_moveit_configs()
4611
)
4712

4813
cartesian_task = Node(
4914
package="moveit_task_constructor_demo",
5015
executable="cartesian",
5116
output="screen",
52-
parameters=[robot_description, robot_description_semantic, kinematics_yaml],
17+
parameters=[
18+
moveit_config.robot_description,
19+
moveit_config.robot_description_semantic,
20+
moveit_config.robot_description_kinematics,
21+
],
5322
)
5423

5524
return LaunchDescription([cartesian_task])

0 commit comments

Comments
 (0)