Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add localization_launch package #171

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
0637afe
release v0.4.0
mitsudome-r Sep 18, 2020
3cdc313
removed ROS1 package
mitsudome-r Oct 6, 2020
a0dc0d7
Revert "removed ROS1 package"
mitsudome-r Oct 8, 2020
b1ba72d
add COLCON_IGNORE file to all ROS1 packages
mitsudome-r Oct 8, 2020
b0d890d
rename *.launch files to *.launch.xml
mitsudome-r Oct 23, 2020
53dc866
Port localization_launch to ros2
cvasfi Nov 10, 2020
a847219
fix syntax (#33)
TakaHoribe Dec 21, 2020
f6ac5c5
ROS2 Linting: localization_launch (#39)
jilaada Jan 13, 2021
1d8021f
Ros2 v0.8.0 localization launch (#54)
TakaHoribe Feb 16, 2021
230799c
Rename ROS-related .yaml to .param.yaml (#65)
kenji-miyake Feb 24, 2021
6958005
add localization_error_monitor launch (#75)
Mar 2, 2021
98f6ae9
Fix various typos in launch files (#97)
kmiya Mar 24, 2021
271a68f
add use_sim-time option (#99)
tkimura4 Mar 26, 2021
69cebb6
Replace doc by description (#182)
kenji-miyake Apr 5, 2021
7496105
Ros2 lsim test (#186)
wep21 Apr 6, 2021
d1a73d3
Fix invalid attribute in twist estimator launch (#192)
wep21 Apr 10, 2021
f11e8c6
Localization util preprocessor component (#188)
wep21 Apr 12, 2021
56fc36c
Use set_parameter for use_sim_time (#198)
wep21 Apr 26, 2021
f96c619
Fix depends in localization_launch to exec_depend (#223)
kenji-miyake May 20, 2021
350fbe9
Fix typos in launch files (#231)
kenji-miyake May 24, 2021
e7a975e
Format launch files (#228)
kenji-miyake May 24, 2021
8a1d58a
Enable intra process and mt (#204)
wep21 Jul 2, 2021
ae9f164
Load output_measurement_range_sensor_points_topic param (#271)
kosuke55 Jul 19, 2021
6f655ba
use_twist_with_covariance is false (#295)
YamatoAndo Jul 26, 2021
38fcc95
add description for localization_launch (#332)
h-ohta Aug 12, 2021
e844eae
add README.md and svg files (#328)
h-ohta Aug 12, 2021
a30c2dd
Feature/expand footprint launcher (#318)
k0suke-murakami Aug 18, 2021
57d6386
Add autoware api (#376)
isamu-takagi Aug 31, 2021
a5b17c5
added stop filter launch in localization_launch (#270)
kminoda Sep 2, 2021
5a8fe72
Fix pre-commit (#407)
kenji-miyake Sep 15, 2021
141fefb
modify util.launch in localization_launch #396
h-ohta Sep 27, 2021
99bb524
add localization error monitor param (#431)
YamatoAndo Sep 30, 2021
4915c74
add environment_name parameter into localization launch (#175) (#293)
wep21 Oct 27, 2021
8640272
delete environment name (#428)
h-ohta Sep 29, 2021
33a7abd
Change formatter to black (#488)
Nov 2, 2021
3b45373
porting localization (#121)
RyuYamamoto Nov 24, 2021
bd64ec9
Merge branch 'tier4/proposal' into 1-add-localization-launch
1222-takeshi Dec 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions launch/localization_launch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cmake_minimum_required(VERSION 3.5)
project(localization_launch)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wno-unused-parameter)
endif()

find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

ament_auto_package(INSTALL_TO_SHARE
launch
config
)
26 changes: 26 additions & 0 deletions launch/localization_launch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# localization_launch

## Structure

![localization_launch](./localization_launch.drawio.svg)

## Package Dependencies

Please see `<exec_depend>` in `package.xml`.

## Usage

You can include as follows in `*.launch.xml` to use `localization.launch.xml`.

```xml
<include file="$(find-pkg-share localization_launch)/launch/localization.launch.xml">
</include>
```

## Notes

There are some `param.yaml` files in `config` directory.

```bash
ndt_scan_matcher.param.yaml
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**:
ros__parameters:
input_frame: "base_link"
output_frame: "base_link"
min_x: -60.0
max_x: 60.0
min_y: -60.0
max_y: 60.0
min_z: -30.0
max_z: 50.0
negative: False
34 changes: 34 additions & 0 deletions launch/localization_launch/config/ndt_scan_matcher.param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**:
ros__parameters:
# Vehicle reference frame
base_frame: "base_link"

# Subscriber queue size
input_sensor_points_queue_size: 1

# NDT implementation type
# 0=PCL_GENERIC, 1=PCL_MODIFIED, 2=OMP
ndt_implement_type: 2

# The maximum difference between two consecutive
# transformations in order to consider convergence
trans_epsilon: 0.01

# The newton line search maximum step length
step_size: 0.1

# The ND voxel grid resolution
resolution: 2.0

# The number of iterations required to calculate alignment
max_iterations: 30

# Threshold for deciding whether to trust the estimation result
converged_param_transform_probability: 3.0

# neighborhood search method in OMP
# 0=KDTREE, 1=DIRECT26, 2=DIRECT7, 3=DIRECT1
omp_neighborhood_search_method: 0

# Number of threads used for parallel computing
omp_num_threads: 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/**:
ros__parameters:
sample_num: 1500
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**:
ros__parameters:
voxel_size_x: 3.0
voxel_size_y: 3.0
voxel_size_z: 3.0
34 changes: 34 additions & 0 deletions launch/localization_launch/launch/localization.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0"?>
<launch>
<!-- localization module -->
<group>
<push-ros-namespace namespace="localization"/>
<!-- util module -->
<group>
<push-ros-namespace namespace="util"/>
<include file="$(find-pkg-share localization_launch)/launch/util/util.launch.xml">
</include>
</group>
<!-- pose_estimator module -->
<group>
<push-ros-namespace namespace="pose_estimator"/>
<include file="$(find-pkg-share localization_launch)/launch/pose_estimator/pose_estimator.launch.xml">
</include>
</group>
<!-- twist_estimator module -->
<group>
<push-ros-namespace namespace="twist_estimator"/>
<include file="$(find-pkg-share localization_launch)/launch/twist_estimator/twist_estimator.launch.xml">
</include>
</group>
<!-- pose_twist_fusion_filter module -->
<group>
<push-ros-namespace namespace="pose_twist_fusion_filter"/>
<include file="$(find-pkg-share localization_launch)/launch/pose_twist_fusion_filter/pose_twist_fusion_filter.launch.xml">
</include>
</group>
<!-- localization_error_monitor_module -->
<include file="$(find-pkg-share localization_launch)/launch/localization_error_monitor/localization_error_monitor.launch.xml">
</include>
</group>
</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<launch>
<include file="$(find-pkg-share localization_error_monitor)/launch/localization_error_monitor.launch.xml">
<arg name="input/pose_with_cov" value="/localization/pose_with_covariance" />
<arg name="scale" value="3.0" />
<arg name="error_ellipse_size" value="1.0" />
<arg name="warn_ellipse_size" value="0.8" />
<arg name="error_ellipse_size_lateral_direction" value="1.0" />
<arg name="warn_ellipse_size_lateral_direction" value="0.8" />
</include>
</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<launch>

<include file="$(find-pkg-share ndt_scan_matcher)/launch/ndt_scan_matcher.launch.xml">
<arg name="input_map_points_topic" value="/map/pointcloud_map"/>
<arg name="input_sensor_points_topic" value="/localization/util/downsample/pointcloud"/>
<arg name="input_initial_pose_topic" value="/localization/pose_twist_fusion_filter/pose_with_covariance_without_yawbias"/>


<arg name="output_pose_topic" value="/localization/pose_estimator/pose"/>
<arg name="output_pose_with_covariance_topic" value="/localization/pose_estimator/pose_with_covariance"/>
<arg name="output_diagnostics_topic" value="/localization/diagnostics"/>

<arg name="param_file" value="$(find-pkg-share localization_launch)/config/ndt_scan_matcher.param.yaml" />
</include>

</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<launch>
<include file="$(find-pkg-share ekf_localizer)/launch/ekf_localizer.launch.xml">
<arg name="enable_yaw_bias_estimation" value="False"/>
<arg name="tf_rate" value="50.0"/>
<arg name="twist_rate" value="25.0"/>
<arg name="input_initial_pose_name" value="/initialpose3d"/>

<arg name="input_pose_with_cov_name" value="/localization/pose_estimator/pose_with_covariance"/>
<arg name="input_twist_with_cov_name" value="/localization/twist_estimator/twist_with_covariance"/>
<arg name="output_odom_name" value="kinematic_state"/>
<arg name="output_pose_name" value="pose"/>
<arg name="output_pose_with_covariance_name" value="/localization/pose_with_covariance"/>
<arg name="output_pose_without_yawbias_name" value="pose_without_yawbias"/>
<arg name="output_pose_with_covariance_without_yawbias_name" value="pose_with_covariance_without_yawbias"/>
<arg name="output_twist_name" value="twist"/>
<arg name="output_twist_with_covariance_name" value="twist_with_covariance"/>

<arg name="twist_stddev_wz" value="0.003 "/>

<arg name="proc_stddev_vx_c" value="10.0"/>
<arg name="proc_stddev_wz_c" value="5.0"/>
</include>
<include file="$(find-pkg-share stop_filter)/launch/stop_filter.launch.xml">
<arg name="use_twist_with_covariance" value="True"/>
<arg name="input_odom_name" value="/localization/pose_twist_fusion_filter/kinematic_state"/>
<arg name="input_twist_with_covariance_name" value="/localization/pose_twist_fusion_filter/twist_with_covariance"/>
<arg name="output_odom_name" value="/localization/kinematic_state"/>
</include>
</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<launch>
<include file="$(find-pkg-share vehicle_velocity_converter)/launch/vehicle_velocity_converter.launch.xml">
<arg name="input_vehicle_velocity_topic" value="/vehicle/status/velocity_status"/>
<arg name="output_twist_with_covariance" value="/localization/twist_estimator/vehicle_velocity_converter/twist_with_covariance"/>
</include>
<include file="$(find-pkg-share gyro_odometer)/launch/gyro_odometer.launch.xml">
<arg name="input_vehicle_twist_with_covariance_topic" value="/localization/twist_estimator/vehicle_velocity_converter/twist_with_covariance"/>
<arg name="output_twist_with_covariance_topic" value="/localization/twist_estimator/twist_with_covariance" />
</include>
</launch>
135 changes: 135 additions & 0 deletions launch/localization_launch/launch/util/util.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Copyright 2020 Tier IV, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import launch
from launch.actions import DeclareLaunchArgument
from launch.actions import OpaqueFunction
from launch.conditions import LaunchConfigurationNotEquals
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import LoadComposableNodes
from launch_ros.descriptions import ComposableNode
from launch_ros.substitutions import FindPackageShare
import yaml


def launch_setup(context, *args, **kwargs):
# https://github.com/ros2/launch_ros/issues/156
def load_composable_node_param(param_path):
with open(LaunchConfiguration(param_path).perform(context), "r") as f:
return yaml.safe_load(f)["/**"]["ros__parameters"]

crop_box_component = ComposableNode(
package="pointcloud_preprocessor",
plugin="pointcloud_preprocessor::CropBoxFilterComponent",
name="crop_box_filter_measurement_range",
remappings=[
("input", LaunchConfiguration("input_sensor_points_topic")),
("output", LaunchConfiguration("output_measurement_range_sensor_points_topic")),
],
parameters=[
load_composable_node_param("crop_box_filter_measurement_range_param_path"),
],
extra_arguments=[{"use_intra_process_comms": LaunchConfiguration("use_intra_process")}],
)
voxel_grid_downsample_component = ComposableNode(
package="pointcloud_preprocessor",
plugin="pointcloud_preprocessor::VoxelGridDownsampleFilterComponent",
name="voxel_grid_downsample_filter",
remappings=[
("input", LaunchConfiguration("output_measurement_range_sensor_points_topic")),
("output", LaunchConfiguration("output_voxel_grid_downsample_sensor_points_topic")),
],
parameters=[load_composable_node_param("voxel_grid_downsample_filter_param_path")],
extra_arguments=[{"use_intra_process_comms": LaunchConfiguration("use_intra_process")}],
)
random_downsample_component = ComposableNode(
package="pointcloud_preprocessor",
plugin="pointcloud_preprocessor::VoxelGridDownsampleFilterComponent",
name="random_downsample_filter",
remappings=[
("input", LaunchConfiguration("output_voxel_grid_downsample_sensor_points_topic")),
("output", LaunchConfiguration("output_downsample_sensor_points_topic")),
],
parameters=[load_composable_node_param("random_downsample_filter_param_path")],
extra_arguments=[{"use_intra_process_comms": LaunchConfiguration("use_intra_process")}],
)

composable_nodes = [
crop_box_component,
voxel_grid_downsample_component,
random_downsample_component,
]

load_composable_nodes = LoadComposableNodes(
condition=LaunchConfigurationNotEquals("container", ""),
composable_node_descriptions=composable_nodes,
target_container=LaunchConfiguration("container"),
)

return [load_composable_nodes]


def generate_launch_description():
launch_arguments = []

def add_launch_arg(name: str, default_value=None, description=None):
arg = DeclareLaunchArgument(name, default_value=default_value, description=description)
launch_arguments.append(arg)

add_launch_arg(
"crop_box_filter_measurement_range_param_path",
[
FindPackageShare("localization_launch"),
"/config/crop_box_filter_measurement_range.param.yaml",
],
"path to the parameter file of crop_box_filter_measurement_range",
)
add_launch_arg(
"voxel_grid_downsample_filter_param_path",
[FindPackageShare("localization_launch"), "/config/voxel_grid_filter.param.yaml"],
"path to the parameter file of voxel_grid_downsample_filter",
)
add_launch_arg(
"random_downsample_filter_param_path",
[FindPackageShare("localization_launch"), "/config/random_downsample_filter.param.yaml"],
"path to the parameter file of random_downsample_filter",
)
add_launch_arg("use_intra_process", "true", "use ROS2 component container communication")
add_launch_arg(
"container",
"/sensing/lidar/top/pointcloud_preprocessor/velodyne_node_container",
"container name",
)
add_launch_arg(
"input_sensor_points_topic",
"/sensing/lidar/top/rectified/pointcloud",
"input topic name for raw pointcloud",
)
add_launch_arg(
"output_measurement_range_sensor_points_topic",
"measurement_range/pointcloud",
"output topic name for crop box filter",
)
add_launch_arg(
"output_voxel_grid_downsample_sensor_points_topic",
"voxel_grid_downsample/pointcloud",
"output topic name for voxel grid downsample filter",
)
add_launch_arg(
"output_downsample_sensor_points_topic",
"downsample/pointcloud",
"output topic name for downsample filter. this is final output",
)

return launch.LaunchDescription(launch_arguments + [OpaqueFunction(function=launch_setup)])
22 changes: 22 additions & 0 deletions launch/localization_launch/launch/util/util.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<launch>

<!-- Topics -->
<arg name="input_sensor_points_topic" default="/sensing/lidar/top/rectified/pointcloud" description="input topic name for raw pointcloud"/>
<arg name="output_measurement_range_sensor_points_topic" default="measurement_range/pointcloud" description="output topic name for crop box filter"/>
<arg name="output_voxel_grid_downsample_sensor_points_topic" default="voxel_grid_downsample/pointcloud" description="output topic name for voxel grid downsample filter"/>
<arg name="output_downsample_sensor_points_topic" default="downsample/pointcloud" description="output topic name for downsample filter. this is final output"/>

<!-- container -->
<arg name="container" default="/sensing/lidar/top/pointcloud_preprocessor/velodyne_node_container" description="container name"/>

<!-- option -->
<arg name="use_intra_process" default="true" description="use ROS2 component container communication"/>

<!-- pose_initializer -->
<include file="$(find-pkg-share pose_initializer)/launch/pose_initializer.launch.xml" />

<!-- util -->
<include file="$(find-pkg-share localization_launch)/launch/util/util.launch.py" />

</launch>
Loading