-
Notifications
You must be signed in to change notification settings - Fork 212
/
Copy pathrun_benchmarks.launch.py
102 lines (90 loc) · 3.45 KB
/
run_benchmarks.launch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import os
import yaml
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
from moveit_configs_utils import MoveItConfigsBuilder
from launch_param_builder import ParameterBuilder
def load_yaml(package_name, file_path):
package_path = get_package_share_directory(package_name)
absolute_file_path = os.path.join(package_path, file_path)
try:
with open(absolute_file_path, "r") as file:
return yaml.safe_load(file)
except EnvironmentError: # parent of IOError, OSError *and* WindowsError where available
return None
def generate_launch_description():
moveit_ros_benchmarks_config = (
ParameterBuilder("moveit2_tutorials")
.yaml(
parameter_namespace="benchmark_config",
file_path="config/benchmarks.yaml",
)
.to_dict()
)
moveit_configs = (
MoveItConfigsBuilder("moveit_resources_panda")
.robot_description(file_path="config/panda.urdf.xacro")
.planning_pipelines("ompl", ["ompl", "stomp", "pilz_industrial_motion_planner"])
.moveit_cpp(
os.path.join(
get_package_share_directory("moveit2_tutorials"),
"config",
"benchmarking_moveit_cpp.yaml",
)
)
.to_moveit_configs()
)
# Load additional OMPL pipeline
ompl_planning_pipeline_config = {
"ompl_rrtc": {
"planning_plugins": [
"ompl_interface/OMPLPlanner",
],
"request_adapters": [
"default_planning_request_adapters/ResolveConstraintFrames",
"default_planning_request_adapters/ValidateWorkspaceBounds",
"default_planning_request_adapters/CheckStartStateBounds",
"default_planning_request_adapters/CheckStartStateCollision",
],
"response_adapters": [
"default_planning_response_adapters/AddTimeOptimalParameterization",
"default_planning_response_adapters/ValidateSolution",
"default_planning_response_adapters/DisplayMotionPath",
],
}
}
ompl_planning_yaml = load_yaml(
"moveit_resources_panda_moveit_config", "config/ompl_planning.yaml"
)
ompl_planning_pipeline_config["ompl_rrtc"].update(ompl_planning_yaml)
sqlite_database = (
get_package_share_directory("moveit_benchmark_resources")
+ "/databases/panda_kitchen_test_db.sqlite"
)
warehouse_ros_config = {
"warehouse_plugin": "warehouse_ros_sqlite::DatabaseConnection",
"benchmark_config": {
"warehouse": {
"warehouse_plugin": "warehouse_ros_sqlite::DatabaseConnection",
"host": sqlite_database,
"port": 33828,
"scene_name": "", # If scene name is empty, all scenes will be used
"queries_regex": ".*",
},
},
}
# moveit_ros_benchmark demo executable
moveit_ros_benchmarks_node = Node(
name="moveit_run_benchmark",
package="moveit_ros_benchmarks",
executable="moveit_run_benchmark",
output="screen",
parameters=[
moveit_ros_benchmarks_config,
moveit_configs.to_dict(),
warehouse_ros_config,
ompl_planning_pipeline_config,
],
)
return LaunchDescription([moveit_ros_benchmarks_node])