Skip to content

Commit

Permalink
init lidar-lidar calibration
Browse files Browse the repository at this point in the history
Signed-off-by: ismetatabay <[email protected]>
  • Loading branch information
ismetatabay committed Sep 7, 2023
1 parent 3e7a5c1 commit 85228ce
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 115 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
nav:
- calibrating-sensors.md
- generic-calibration.md
- lidar-lidar-calibration.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ camera-lidar, ground-lidar etc. In order to calibrate our sensors,
we will modify `extrinsic_calibration_package` for our sensor kit.

- [Generic Calibration](./generic-calibration.md)
- Lidar-Lidar Calibration
- [Lidar-Lidar Calibration](./lidar-lidar-calibration.md)
- [Map-Based Lidar-Lidar Calibration](https://github.com/tier4/CalibrationTools/blob/tier4/universe/sensor/docs/how_to_extrinsic_map_based.md)
- [Mapping-Based Lidar-Lidar Calibration](https://github.com/tier4/CalibrationTools/blob/tier4/universe/sensor/docs/how_to_extrinsic_mapping_based.md)
- [Ground Plane-Lidar Calibration](https://github.com/tier4/CalibrationTools/blob/tier4/universe/sensor/docs/how_to_extrinsic_ground_plane.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,22 @@ We need a sample bag file for the calibration process
which includes raw lidar topics and camera topics.
So our tutorial_vehicle's recorded topics should like this:

<details><summary>ROS 2 Bag example for our calibration process</summary>
<p>

```sh

Files: rosbag2_2023_09_06-13_43_54_0.db3
Bag size: 18.3 GiB
Storage id: sqlite3
Duration: 169.12s
Start: Sep 6 2023 13:43:54.902 (1693997034.902)
End: Sep 6 2023 13:46:43.914 (1693997203.914)
Messages: 8504
Topic information: Topic: /sensing/lidar/top/pointcloud_raw | Type: sensor_msgs/msg/PointCloud2 | Count: 1691 | Serialization Format: cdr
Topic: /sensing/lidar/front/pointcloud_raw | Type: sensor_msgs/msg/PointCloud2 | Count: 1691 | Serialization Format: cdr
Topic: /sensing/camera/camera0/image_rect | Type: sensor_msgs/msg/Image | Count: 2561 | Serialization Format: cdr
Topic: /sensing/camera/camera0/camera_info | Type: sensor_msgs/msg/CameraInfo | Count: 2561 | Serialization Format: cdr
```

</p>
</details>
??? note "ROS 2 Bag example of our calibration process"

```sh

Files: rosbag2_2023_09_06-13_43_54_0.db3
Bag size: 18.3 GiB
Storage id: sqlite3
Duration: 169.12s
Start: Sep 6 2023 13:43:54.902 (1693997034.902)
End: Sep 6 2023 13:46:43.914 (1693997203.914)
Messages: 8504
Topic information: Topic: /sensing/lidar/top/pointcloud_raw | Type: sensor_msgs/msg/PointCloud2 | Count: 1691 | Serialization Format: cdr
Topic: /sensing/lidar/front/pointcloud_raw | Type: sensor_msgs/msg/PointCloud2 | Count: 1691 | Serialization Format: cdr
Topic: /sensing/camera/camera0/image_rect | Type: sensor_msgs/msg/Image | Count: 2561 | Serialization Format: cdr
Topic: /sensing/camera/camera0/camera_info | Type: sensor_msgs/msg/CameraInfo | Count: 2561 | Serialization Format: cdr
```

First of all, we will start with creating and modifying `extrinsic_calibration_manager` launch files:

Expand All @@ -50,17 +46,17 @@ So, we can start modifying `manual.launch.xml`,
please open this file on a text editor which will you prefer (code, gedit etc.).
Example for out tutorial vehicle should be like these steps:

- Let's start with adding vehicle_id and sensor model names. (Optionally, values are not important. These parameters Overrode from launch argument)
Let's start with adding vehicle_id and sensor model names. (Optionally, values are not important. These parameters Overrode from launch argument)

```diff
+ <?xml version="1.0" encoding="UTF-8"?>
+ <launch>
+ <arg name="vehicle_id" default="tutorial_vehicle"/>
+
+ <arg name="vehicle_id" default="tutorial_vehicle"/>
+
+ <let name="sensor_model" value="tutorial_vehicle_sensor_kit"/>
```

- After that, we will launch our sensor_kit for manual sensor calibration,
After that, we will launch our sensor_kit for manual sensor calibration,
so we must add these lines on manual.launch.xml:

```diff
Expand All @@ -70,76 +66,73 @@ so we must add these lines on manual.launch.xml:
+ <arg name="vehicle_id" value="$(var vehicle_id)"/>
+ </include>
+ </group>
+
+
+ </launch>
```

The final version of the file (manual.launch.xml) for tutorial_vehicle should be like this:
<details><summary>Sample manual.launch.xml file for tutorial vehicle</summary>
<p>

```xml
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<arg name="vehicle_id" default="tutorial_vehicle"/>
??? note "Sample manual.launch.xml file for tutorial vehicle"

<let name="sensor_model" value="tutorial_vehicle_sensor_kit"/>
```xml
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<arg name="vehicle_id" default="tutorial_vehicle"/>

<group>
<push-ros-namespace namespace="sensor_kit"/>
<include file="$(find-pkg-share extrinsic_calibration_manager)/launch/$(var sensor_model)/manual_sensor_kit.launch.xml">
<arg name="vehicle_id" value="$(var vehicle_id)"/>
</include>
</group>
<let name="sensor_model" value="tutorial_vehicle_sensor_kit"/>

</launch>
<group>
<push-ros-namespace namespace="sensor_kit"/>
<include file="$(find-pkg-share extrinsic_calibration_manager)/launch/$(var sensor_model)/manual_sensor_kit.launch.xml">
<arg name="vehicle_id" value="$(var vehicle_id)"/>
</include>
</group>

```
</launch>

</p>
</details>
```

After the completing of manual.launch.xml file,
we will be ready to implement manual_sensor_kit.launch.xml for the own sensor model:

- We will start adding sensor_kit and vehicle_id as `manual.launch.xml`.
We will start adding sensor_kit and vehicle_id as `manual.launch.xml`.
Optionally, you can modify sensor_model and vehicle_id over this xml snippet:

```diff
+ <?xml version="1.0" encoding="UTF-8"?>
+ <launch>
+ <arg name="vehicle_id" default="tutorial_vehicle"/> <!-- Please Update with your own vehicle_id -->
+
+
+ <let name="sensor_model" value="tutorial_vehicle_sensor_kit"/> <!-- Please Update with your own sensor_kit -->
+ <let name="parent_frame" value="sensor_kit_base_link"/>
+
+
+ <!-- extrinsic_calibration_client -->
+ <arg name="src_yaml" default="$(find-pkg-share individual_params)/config/$(var vehicle_id)/$(var sensor_model)/sensor_kit_calibration.yaml"/>
+ <arg name="dst_yaml" default="$(env HOME)/sensor_kit_calibration.yaml"/>
+
+ <arg name="dst_yaml" default="$(env HOME)/sensor_kit_calibration.yaml"/>
+
+ <node pkg="extrinsic_calibration_client" exec="extrinsic_calibration_client" name="extrinsic_calibration_client" output="screen">
+ <param name="src_path" value="$(var src_yaml)"/>
+ <param name="dst_path" value="$(var dst_yaml)"/>
+ </node>
```

- Then, we will add all our sensor frames on extrinsic_calibration_manages as child frames.
Then, we will add all our sensor frames on extrinsic_calibration_manages as child frames.
For tutorial_vehicle there are four sensors (two lidar, one camera, one gnss/ins), so it will be like this:

```diff
+ <!-- extrinsic_calibration_manager -->
+ <node pkg="extrinsic_calibration_manager" exec="extrinsic_calibration_manager" name="extrinsic_calibration_manager" output="screen">
+ <param name="parent_frame" value="$(var parent_frame)"/>
+ <!-- add your sensor frames here -->
+ <param name="child_frames" value="
+ <param name="child_frames" value="
+ [rs_helios_top_base_link,
+ rs_bpearl_front_base_link,
+ camera0/camera_link,
+ gnss_link]"/>
+ </node>
```

- Lastly, we will launch a manual calibrator each frame for our sensors,
Lastly, we will launch a manual calibrator each frame for our sensors,
please update namespace (ns) and child_frame argument on `tutorial_vehicle` example:

```diff
Expand Down Expand Up @@ -171,69 +164,64 @@ please update namespace (ns) and child_frame argument on `tutorial_vehicle` exam
```

The final version of the manual_sensor_kit.launch.xml for tutorial_vehicle should be like this:
<details><summary>Sample manual_sensor_kit.launch.xml file for tutorial vehicle</summary>
<p>

```xml
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<arg name="vehicle_id" default="tutorial_vehicle"/> <!-- Please Update with your own vehicle_id -->

<let name="sensor_model" value="tutorial_vehicle_sensor_kit"/> <!-- Please Update with your own sensor model -->
<let name="parent_frame" value="sensor_kit_base_link"/>

<!-- extrinsic_calibration_client -->
<arg name="src_yaml" default="$(find-pkg-share individual_params)/config/$(var vehicle_id)/$(var sensor_model)/sensor_kit_calibration.yaml"/>
<arg name="dst_yaml" default="$(env HOME)/sensor_kit_calibration.yaml"/>

<node pkg="extrinsic_calibration_client" exec="extrinsic_calibration_client" name="extrinsic_calibration_client" output="screen">
<param name="src_path" value="$(var src_yaml)"/>
<param name="dst_path" value="$(var dst_yaml)"/>
</node>

<!-- extrinsic_calibration_manager -->
<node pkg="extrinsic_calibration_manager" exec="extrinsic_calibration_manager" name="extrinsic_calibration_manager" output="screen">
<param name="parent_frame" value="$(var parent_frame)"/>
<!-- Please Update with your own sensor frames -->
<param name="child_frames" value="
[rs_helios_top_base_link,
rs_bpearl_front_base_link,
camera0/camera_link,
gnss_link]"/>
</node>

<!-- extrinsic_manual_calibrator -->
<!-- Please create a launch for all sensors that you used. -->
<include file="$(find-pkg-share extrinsic_manual_calibrator)/launch/calibrator.launch.xml">
<arg name="ns" value="$(var parent_frame)/rs_helios_top_base_link"/>
<arg name="parent_frame" value="$(var parent_frame)"/>
<arg name="child_frame" value="rs_helios_top_base_link"/>
</include>

<include file="$(find-pkg-share extrinsic_manual_calibrator)/launch/calibrator.launch.xml">
<arg name="ns" value="$(var parent_frame)/rs_bpearl_front_base_link"/>
<arg name="parent_frame" value="$(var parent_frame)"/>
<arg name="child_frame" value="rs_bpearl_front_base_link"/>
</include>

<include file="$(find-pkg-share extrinsic_manual_calibrator)/launch/calibrator.launch.xml">
<arg name="ns" value="$(var parent_frame)/camera0/camera_link"/>
<arg name="parent_frame" value="$(var parent_frame)"/>
<arg name="child_frame" value="camera0/camera_link"/>
</include>

<include file="$(find-pkg-share extrinsic_manual_calibrator)/launch/calibrator.launch.xml">
<arg name="ns" value="$(var parent_frame)/gnss_link"/>
<arg name="parent_frame" value="$(var parent_frame)"/>
<arg name="child_frame" value="gnss_link"/>
</include>
</launch>

??? note "Sample manual_sensor_kit.launch.xml for tutorial_vehicle"

```xml
<?xml version="1.0" encoding="UTF-8"?>
<launch>
<arg name="vehicle_id" default="tutorial_vehicle"/> <!-- Please Update with your own vehicle_id -->

<let name="sensor_model" value="tutorial_vehicle_sensor_kit"/> <!-- Please Update with your own sensor model -->
<let name="parent_frame" value="sensor_kit_base_link"/>

<!-- extrinsic_calibration_client -->
<arg name="src_yaml" default="$(find-pkg-share individual_params)/config/$(var vehicle_id)/$(var sensor_model)/sensor_kit_calibration.yaml"/>
<arg name="dst_yaml" default="$(env HOME)/sensor_kit_calibration.yaml"/>

<node pkg="extrinsic_calibration_client" exec="extrinsic_calibration_client" name="extrinsic_calibration_client" output="screen">
<param name="src_path" value="$(var src_yaml)"/>
<param name="dst_path" value="$(var dst_yaml)"/>
</node>

<!-- extrinsic_calibration_manager -->
<node pkg="extrinsic_calibration_manager" exec="extrinsic_calibration_manager" name="extrinsic_calibration_manager" output="screen">
<param name="parent_frame" value="$(var parent_frame)"/>
<!-- Please Update with your own sensor frames -->
<param name="child_frames" value="
[rs_helios_top_base_link,
rs_bpearl_front_base_link,
camera0/camera_link,
gnss_link]"/>
</node>

<!-- extrinsic_manual_calibrator -->
<!-- Please create a launch for all sensors that you used. -->
<include file="$(find-pkg-share extrinsic_manual_calibrator)/launch/calibrator.launch.xml">
<arg name="ns" value="$(var parent_frame)/rs_helios_top_base_link"/>
<arg name="parent_frame" value="$(var parent_frame)"/>
<arg name="child_frame" value="rs_helios_top_base_link"/>
</include>

```
<include file="$(find-pkg-share extrinsic_manual_calibrator)/launch/calibrator.launch.xml">
<arg name="ns" value="$(var parent_frame)/rs_bpearl_front_base_link"/>
<arg name="parent_frame" value="$(var parent_frame)"/>
<arg name="child_frame" value="rs_bpearl_front_base_link"/>
</include>

</p>
</details>
<include file="$(find-pkg-share extrinsic_manual_calibrator)/launch/calibrator.launch.xml">
<arg name="ns" value="$(var parent_frame)/camera0/camera_link"/>
<arg name="parent_frame" value="$(var parent_frame)"/>
<arg name="child_frame" value="camera0/camera_link"/>
</include>

<include file="$(find-pkg-share extrinsic_manual_calibrator)/launch/calibrator.launch.xml">
<arg name="ns" value="$(var parent_frame)/gnss_link"/>
<arg name="parent_frame" value="$(var parent_frame)"/>
<arg name="child_frame" value="gnss_link"/>
</include>
</launch>
```

After the completion of manual.launch.xml and manual_sensor_kit.launch xml file for extrinsic_calibration_manager package,
we need to build package:
Expand All @@ -258,7 +246,7 @@ Then play ROS 2 bag file:

```bash
ros2 bag play <rosbag_path> --clock -l -r 0.2 \
--remap /tf:=/null/tf /tf_static:=/null/tf_static # if tf is recorded
--remap /tf:=/null/tf /tf_static:=/null/tf_static # if tf is recorded
```

You will show to a manual rqt_reconfigure window,
Expand All @@ -271,9 +259,8 @@ we will update calibrations by hand according to the rviz2 results.
!!! warning

The initial calibration process can be important before the using other calibrations. We will look into the lidar-lidar calibration
and camera-lidar calibration. At this point, there is hard to calibrate two sensors with exactly same frame, so you should find
and camera-lidar calibration. At this point, there is hard to calibrate two sensors with exactly same frame, so you should find
approximately (it not must be perfect) calibration pairs between sensors.

Here is the video for demonstrating a manual calibration process on tutorial vehicle:

<iframe width="560" height="315" src="https://www.youtube.com/embed/R_JbRpuGPW4?si=yErFos25sTA2W87A" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
![type:video](https://youtube.com/embed/ZJZ48vrVaNg)
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Lidar-Lidar Calibration

## Overview

In this tutorial,
we will explain lidar-lidar calibration over [mapping-based lidar-lidar calibration tool](https://github.com/tier4/CalibrationTools/blob/tier4/universe/sensor/docs/how_to_extrinsic_mapping_based.md) of Tier IV's
CalibrationTools.
Also,
[map-based lidar-lidar calibration method](https://github.com/tier4/CalibrationTools/blob/tier4/universe/sensor/docs/how_to_extrinsic_map_based.md) included in the Tier IV's tools.
[LL-Calib](https://github.com/autocore-ai/calibration_tools/tree/main/lidar-lidar-calib) on GitHub,
provided by [AutoCore](https://autocore.ai/),
is a lightweight toolkit for online/offline 3D LiDAR to LiDAR calibration.
It's based on local mapping and "GICP" method to derive the relation between main and sub lidar.
If you want more details about these methods such as usage, troubleshooting etc. please check the links above.

!!! warning

Please get initial calibration results from [Generic Calibration](./generic-calibration.md) section, it is important for getting accurate results from this tool.
We will use initial calibration parameters that we calculated on previous step on this tutorial.

0 comments on commit 85228ce

Please sign in to comment.