• Stars
    star
    309
  • Rank 134,535 (Top 3 %)
  • Language
    C++
  • Created over 4 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple, clean NDT licalization ROS package.

A clean and simple NDT localizer

This repo modified from Autoware lidar_localizer module. Unlike the module in Autoware with haveily dependency on a lot of packages(you need compile all the packages in Autoware project), this repo is clean, simple and with no dependencies. All you need is ROS, and a pcd file(the point cloud map).

Let's start our lidar-based localization learning with this simple repo!

Localization in a pointcloud map(pcd)

A demo video on MulRan dataset:

IMAGE ALT TEXT HERE

How to use

Prepare you pcd map and rosbag

You can reproduce my blog 基于NDT的自动驾驶高精度定位和ROS项目实战 and 使用SC-LEGO-LOAM进行较大规模点云地图构建和闭环优化 to use Mulran dataset to build your pcd map and produce the pointcloud data. Unfortunately, the blog is written with Chinese, if you can not read Chinese blog and want to reproduce the project demo, use the link below(Baidu disk) to download the pcd map and rosbag:

link: https://pan.baidu.com/s/1hZ0VuQCy4KX3lHUTFdVeww passward: r7fl

The KAIST02-small.bag is not the whole KAIST02 dataset, because the rosbag do not compress data, the whole KAIST02 rosbag is too large. So I use the first 81 seconds of the KAIST02 dataset to make this small rosbag.

Put the pcd data to the map folder:

cp kaist02.pcd map/

Build in your ros workspace

clone this repo in your ros workspace/src/, and then catkin_make (or catkin build):

cd catkin_ws/src/
git clone https://github.com/AbangLZU/ndt_localizer.git
cd ..
catkin_make

Setup configuration

Config map loader

Move your map pcd file (.pcd) to the map folder inside this project (ndt_localizer/map), change the pcd_path in map_loader.launch to you pcd path, for example:

<arg name="pcd_path"  default="$(find ndt_localizer)/map/kaist02.pcd"/>

Config point cloud downsample

Config your Lidar point cloud topic in launch/points_downsample.launch:

<arg name="points_topic" default="/os1_points" />

If your Lidar data is sparse (like VLP-16), you need to config smaller leaf_size in launch/points_downsample.launch like 2.0. If your lidar point cloud is dense (VLP-32, Hesai Pander40P, HDL-64 ect.), keep leaf_size as 3.0

Config static tf

There are two static transform in this project: base_link_to_localizer and world_to_map,replace the ouster with your lidar frame id if you are using a different lidar:

<node pkg="tf2_ros" type="static_transform_publisher" name="base_link_to_localizer" args="0 0 0 0 0 0 base_link ouster"/>

Config ndt localizer

You can config NDT params in ndt_localizer.launch. Tha main params of NDT algorithm is:

<arg name="trans_epsilon" default="0.05" doc="The maximum difference between two consecutive transformations in order to consider convergence" />
<arg name="step_size" default="0.1" doc="The newton line search maximum step length" />
<arg name="resolution" default="2.0" doc="The ND voxel grid resolution" />
<arg name="max_iterations" default="30.0" doc="The number of iterations required to calculate alignment" />
<arg name="converged_param_transform_probability" default="3.0" doc="" />

These default params work nice with 64 and 32 lidar.

Run the localizer

Once you get your pcd map and configuration ready, run the localizer with:

# open a roscore
roscore
# in other terminal
cd catkin_ws
source devel/setup.bash
# use rosbag sim time if you are playing a rosbag!!!
rosparam set use_sim_time true
# launch the ndt_localizer node
roslaunch ndt_localizer ndt_localizer.launch

wait a few seconds for loading map, then you can see your pcd map in rviz like this:

give a init pose of current vehicle with 2D Pose Estimate in the rviz:

This operation will send a init pose to topic /initialpose.

play the rosbag:

rosbag play KAIST02-small.bag --clock

Then you will see the localization result:

The final localization msg will send to /ndt_pose topic:

---
header: 
  seq: 1867
  stamp: 
    secs: 1566536121
    nsecs: 251423898
  frame_id: "map"
pose: 
  position: 
    x: -94.8022766113
    y: 544.097351074
    z: 42.5747337341
  orientation: 
    x: 0.0243843578881
    y: 0.0533175268768
    z: -0.702325920272
    w: 0.709437048124
---

The localizer also publish a tf of base_link to map:

---
transforms: 
  - 
    header: 
      seq: 0
      stamp: 
        secs: 1566536121
        nsecs: 251423898
      frame_id: "map"
    child_frame_id: "base_link"
    transform: 
      translation: 
        x: -94.8022766113
        y: 544.097351074
        z: 42.5747337341
      rotation: 
        x: 0.0243843578881
        y: 0.0533175268768
        z: -0.702325920272
        w: 0.709437048124

Want to know more detail?

You can follow my blog series in CSDN (Chinese): https://blog.csdn.net/adamshan

More Repositories

1

LaneNetRos

Ros node to use LaneNet to detect the lane in camera
Python
157
star
2

VoxelNetRos

implement the VoxelNet with ROS, using Kitti data to test
Python
112
star
3

plane_fit_ground_filter

A point cloud ground filter based on ground plane fitting
C++
102
star
4

cnn_seg_lidar

Real time 3D semantic segmentation for Lidar, Ros based project
C++
85
star
5

SqueezeSeg_Ros

This is a ros package that implement the SqueezeSeg
Python
83
star
6

cam_lidar_calibration

camera-lidar calibration ros package
C++
57
star
7

EasyPointPillars

easy and simple way to train, export and deploy pointpillars for 3D detection
Python
54
star
8

ad_with_lanelet2

sample of ad system to use lanelet2 framework
C++
43
star
9

lidar_ground_filter

This is a lidar ground filter ros node
C++
28
star
10

tl_detector

train your traffic light detector with Lisa dataset and tensorflow object detection API in both GPU and Google TPU
Jupyter Notebook
11
star
11

apollo-ros

clone from apollo_ros_bridge, enable to convert the image to ros
C++
5
star
12

mapping_collection

collection of HD mapping open source tools
C++
5
star
13

dslab_ros_tutorial

a very simple ros node for dslab lesson
Makefile
4
star
14

lanenet-lane-detection-py2

Modification of the lanenet-lane-detection project for python2 execution
Python
4
star
15

can_control

A ros node for autonomous car can control
C++
3
star
16

HuskyPractice

This is a ros simple code for learning
CMake
3
star
17

utm_projector

A ros node for longlat to utm xyz projection (based on proj4)
C++
2
star
18

PointPillars-TF

PointPillars implementation using TensorFlow.
Python
2
star
19

LaneDetect

a c++ lane detector
C++
2
star
20

mindvision_usb_node

the ros node for MindVision Camera
C++
2
star
21

Highway-Path-Planner

A highway path planner based on finite state machine and spline
C++
2
star
22

UKF_Test

This is my learning code of unscented kalman filter
C++
2
star
23

NumberTranslate

this is
Python
1
star
24

cananys

C++
1
star
25

control_tool

control tools for exteriments of Kinematic model and MPC
Python
1
star
26

DSLab_Machine_learning

This is the reading materials of DSLab ML group
1
star
27

adams_cuda_learn

my learning notes about cuda programming
Cuda
1
star
28

velodyne-Apollo

velodyne ros package (Apollo supported)
C++
1
star