Skip to content

Commit

Permalink
Made test case creation flexible and removed unnecessary imports from…
Browse files Browse the repository at this point in the history
… launch file
  • Loading branch information
CihatAltiparmak committed Jun 17, 2024
1 parent 1d3f0ff commit 6ab2aad
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 75 deletions.
15 changes: 12 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,21 @@ find_package(ament_cmake REQUIRED)
find_package(moveit_ros_planning_interface REQUIRED)
find_package(rclcpp REQUIRED)
find_package(benchmark REQUIRED)
find_package(dynmsg REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(ament_index_cpp REQUIRED)

add_executable(test_scenario_perception_pipeline
test/test_scenario_perception_pipeline.cpp)

ament_target_dependencies(test_scenario_perception_pipeline PUBLIC
"moveit_ros_planning_interface" "rclcpp" "benchmark")
ament_target_dependencies(
test_scenario_perception_pipeline
PUBLIC
"moveit_ros_planning_interface"
"rclcpp"
"benchmark"
"dynmsg"
"nav_msgs")

target_include_directories(
test_scenario_perception_pipeline
Expand All @@ -28,6 +37,6 @@ target_link_libraries(test_scenario_perception_pipeline
install(TARGETS test_scenario_perception_pipeline
DESTINATION lib/${PROJECT_NAME})

install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
install(DIRECTORY launch config DESTINATION share/${PROJECT_NAME})

ament_package()
21 changes: 21 additions & 0 deletions config/sensors_3d.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
sensors:
- camera_1_pointcloud
- camera_2_pointcloud
camera_1_pointcloud:
sensor_plugin: occupancy_map_monitor/PointCloudOctomapUpdater
point_cloud_topic: /camera_1/points
max_range: 5.0
point_subsample: 1
padding_offset: 0.1
padding_scale: 1.0
max_update_rate: 1.0
filtered_cloud_topic: /camera_1/filtered_points
camera_2_pointcloud:
sensor_plugin: occupancy_map_monitor/PointCloudOctomapUpdater
point_cloud_topic: /camera_2/points
max_range: 5.0
point_subsample: 1
padding_offset: 0.1
padding_scale: 1.0
max_update_rate: 1.0
filtered_cloud_topic: /camera_2/filtered_points
73 changes: 73 additions & 0 deletions config/test_scenario_perception_pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
test_cases:
- poses:
- pose:
position:
x: 0.5
y: 0.5
z: 0.5
orientation:
w : 1.0
- pose:
position:
x: 0.5
y: -0.5
z: 0.7
orientation:
w: 1.0
- poses:
- pose:
position:
x: 0.5
y: 0.5
z: 0.5
orientation:
w : 1.0
- pose:
position:
x: 0.5
y: -0.5
z: 0.7
orientation:
w: 1.0
- pose:
position:
x: 0.5
y: 0.5
z: 0.5
orientation:
w : 1.0
- pose:
position:
x: 0.5
y: -0.5
z: 0.7
orientation:
w: 1.0
- pose:
position:
x: 0.5
y: 0.5
z: 0.5
orientation:
w : 1.0
- pose:
position:
x: 0.5
y: -0.5
z: 0.7
orientation:
w: 1.0
- pose:
position:
x: 0.5
y: 0.5
z: 0.5
orientation:
w : 1.0
- pose:
position:
x: 0.5
y: -0.5
z: 0.7
orientation:
w: 1.0
51 changes: 10 additions & 41 deletions launch/test_scenario_perception_pipeline.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,16 @@
from launch_ros.substitutions import FindPackageShare
from ament_index_python.packages import get_package_share_directory
from moveit_configs_utils import MoveItConfigsBuilder
from launch_param_builder import ParameterBuilder
from launch.actions import (
DeclareLaunchArgument,
EmitEvent,
ExecuteProcess,
LogInfo,
RegisterEventHandler,
TimerAction,
)
from launch.event_handlers import (
OnExecutionComplete,
OnProcessExit,
OnProcessIO,
OnProcessStart,
OnShutdown,
)
from launch.event_handlers import OnProcessExit


def generate_launch_description():
# Command-line arguments
rviz_config_arg = DeclareLaunchArgument(
"rviz_config",
default_value="moveit.rviz",
description="RViz configuration file",
)

db_arg = DeclareLaunchArgument(
"db", default_value="False", description="Database flag"
)
Expand Down Expand Up @@ -64,7 +48,7 @@ def generate_launch_description():
)
.sensors_3d(
file_path=os.path.join(
get_package_share_directory("moveit2_tutorials"),
get_package_share_directory("moveit_middleware_benchmark"),
"config/sensors_3d.yaml",
)
)
Expand All @@ -80,26 +64,6 @@ def generate_launch_description():
arguments=["--ros-args", "--log-level", "info"],
)

# RViz
rviz_base = LaunchConfiguration("rviz_config")
rviz_config = PathJoinSubstitution(
[FindPackageShare("moveit_resources_panda_moveit_config"), "launch", rviz_base]
)
rviz_node = Node(
package="rviz2",
executable="rviz2",
name="rviz2",
output="log",
arguments=["-d", rviz_config],
parameters=[
moveit_config.robot_description,
moveit_config.robot_description_semantic,
moveit_config.planning_pipelines,
moveit_config.robot_description_kinematics,
moveit_config.joint_limits,
],
)

# Static TF
static_tf_node = Node(
package="tf2_ros",
Expand Down Expand Up @@ -175,20 +139,23 @@ def generate_launch_description():
package="moveit_middleware_benchmark",
executable="test_scenario_perception_pipeline",
output="both",
arguments=[
"--benchmark_out=benchmark_scenario_perception_pipeline.json",
"--benchmark_out_format=json",
],
parameters=[
moveit_config.robot_description,
moveit_config.robot_description_semantic,
moveit_config.robot_description_kinematics,
{"use_sim_time": True},
{"selected_test_case_index": 0},
],
)

return LaunchDescription(
[
# rviz_config_arg,
db_arg,
ros2_control_hardware_type,
# rviz_node,
static_tf_node,
robot_state_publisher,
move_group_node,
Expand All @@ -202,7 +169,9 @@ def generate_launch_description():
OnProcessExit(
target_action=panda_arm_controller_spawner,
on_exit=[
LogInfo(msg="panda_arm_controller_spawner is finished. Now test_scenario_perception_pipeline will start"),
LogInfo(
msg="panda_arm_controller_spawner is finished. Now test_scenario_perception_pipeline will start"
),
test_scenario_perception_pipeline_node,
],
)
Expand Down
4 changes: 4 additions & 0 deletions moveit_middleware_benchmark.repos
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ repositories:
type: git
url: https://github.com/ros2/rmw_zenoh.git
version: main
dynamic_message_introspection:
type: git
url: [email protected]:osrf/dynamic_message_introspection.git
version: main
3 changes: 3 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
<depend>moveit_ros_planning_interface</depend>
<depend>rclcpp</depend>
<depend>benchmark</depend>
<depend>dynmsg</depend>
<depend>nav_msgs</depend>
<depend>ament_index_cpp</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
Loading

0 comments on commit 6ab2aad

Please sign in to comment.