From b657c7be2079b441952177550b24562a7fc5e05f Mon Sep 17 00:00:00 2001 From: Taiga Takano <53041471+TakanoTaiga@users.noreply.github.com> Date: Mon, 11 Sep 2023 17:50:18 +0900 Subject: [PATCH] Add rviz param dir and fix readme (#77) Signed-off-by: Taiga Takano --- README.md | 10 ++-------- lidarslam/CMakeLists.txt | 2 +- lidarslam/launch/lidarslam.launch.py | 14 ++++++++++++++ lidarslam/launch/lidarslam_tukuba.launch.py | 14 ++++++++++++++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3441646..7d3d5b9 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ rosdep install --from-paths src --ignore-src -r -y ``` build ``` -colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release +colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release ``` ## io @@ -126,9 +126,7 @@ ros2 service call /map_save std_srvs/Empty demo data(ROS1) is `hdl_400.bag` in [hdl_graph_slam](https://github.com/koide3/hdl_graph_slam) The Velodyne VLP-32 was used in this data. To use rosbag in ROS1, use [rosbag2_bag_v2](https://github.com/ros2/rosbag2_bag_v2) -``` -rviz2 -d src/lidarslam_ros2/lidarslam/rviz/mapping.rviz -``` + ``` ros2 launch lidarslam lidarslam.launch.py @@ -151,10 +149,6 @@ https://data.tier4.jp/rosbag_details/?id=212 The Velodyne VLP-16 was used in this data. -``` -rviz2 -d src/lidarslam_ros2/lidarslam/rviz/mapping_tukuba.rviz -``` - ``` ros2 launch lidarslam lidarslam_tukuba.launch.py ``` diff --git a/lidarslam/CMakeLists.txt b/lidarslam/CMakeLists.txt index 4930b5c..50ba49d 100644 --- a/lidarslam/CMakeLists.txt +++ b/lidarslam/CMakeLists.txt @@ -88,7 +88,7 @@ ament_target_dependencies(lidarslam ) install( - DIRECTORY launch param + DIRECTORY launch param rviz DESTINATION share/${PROJECT_NAME} ) diff --git a/lidarslam/launch/lidarslam.launch.py b/lidarslam/launch/lidarslam.launch.py index d225b4f..1ab3d79 100644 --- a/lidarslam/launch/lidarslam.launch.py +++ b/lidarslam/launch/lidarslam.launch.py @@ -13,6 +13,13 @@ def generate_launch_description(): get_package_share_directory('lidarslam'), 'param', 'lidarslam.yaml')) + + rviz_param_dir = launch.substitutions.LaunchConfiguration( + 'rviz_param_dir', + default=os.path.join( + get_package_share_directory('lidarslam'), + 'rviz', + 'mapping.rviz')) mapping = launch_ros.actions.Node( package='scanmatcher', @@ -35,6 +42,12 @@ def generate_launch_description(): parameters=[main_param_dir], output='screen' ) + + rviz = launch_ros.actions.Node( + package='rviz2', + executable='rviz2', + arguments=['-d', rviz_param_dir] + ) return launch.LaunchDescription([ @@ -45,4 +58,5 @@ def generate_launch_description(): mapping, tf, graphbasedslam, + rviz, ]) \ No newline at end of file diff --git a/lidarslam/launch/lidarslam_tukuba.launch.py b/lidarslam/launch/lidarslam_tukuba.launch.py index fb53620..b5e3869 100644 --- a/lidarslam/launch/lidarslam_tukuba.launch.py +++ b/lidarslam/launch/lidarslam_tukuba.launch.py @@ -13,6 +13,13 @@ def generate_launch_description(): get_package_share_directory('lidarslam'), 'param', 'lidarslam_tukuba.yaml')) + + rviz_param_dir = launch.substitutions.LaunchConfiguration( + 'rviz_param_dir', + default=os.path.join( + get_package_share_directory('lidarslam'), + 'rviz', + 'mapping_tukuba.rviz')) mapping = launch_ros.actions.Node( package='scanmatcher', @@ -36,6 +43,12 @@ def generate_launch_description(): ) + rviz = launch_ros.actions.Node( + package='rviz2', + executable='rviz2', + arguments=['-d', rviz_param_dir] + ) + return launch.LaunchDescription([ launch.actions.DeclareLaunchArgument( 'main_param_dir', @@ -44,4 +57,5 @@ def generate_launch_description(): mapping, graphbasedslam, tf, + rviz, ])