Skip to content

Commit

Permalink
Merge branch 'tier4/universe' into feat/apply-flexible-lpf
Browse files Browse the repository at this point in the history
  • Loading branch information
takayuki5168 authored Jul 29, 2022
2 parents 0661239 + 0374b09 commit e26a1d2
Show file tree
Hide file tree
Showing 35 changed files with 6,752 additions and 233 deletions.
61 changes: 24 additions & 37 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,42 @@
## PR Type

<!-- Select one and remove others. If an appropriate one is not listed, please write by yourself. -->

- New Feature
- Improvement
- Bug Fix

## Related Links

<!-- Please write related links to GitHub/Jira/Slack/etc. -->

## Description

<!-- Describe what this PR changes. -->
<!-- Write a brief description of this PR. -->

## Related links

## Review Procedure
<!-- Write the links related to this PR. -->

<!-- Explain how to review this PR. -->
## Tests performed

## Remarks
<!-- Describe how you have tested this PR. -->

<!-- Write remarks as you like if you need them. -->
## Notes for reviewers

## Pre-Review Checklist for the PR Author
<!-- Write additional information if necessary. It should be written if there are related PRs that should be merged at the same time. -->

**PR Author should check the checkboxes below when creating the PR.**
## Pre-review checklist for the PR author

- [ ] Code follows [coding guidelines][coding-guidelines]
- [ ] Assign PR to reviewer
The PR author **must** check the checkboxes below when creating the PR.

## Checklist for the PR Reviewer
- [ ] I've confirmed the [contribution guidelines].
- [ ] The PR follows the [pull request guidelines].

**Reviewers should check the checkboxes below before approval.**
## In-review checklist for the PR reviewers

- [ ] Commits are properly organized and messages are according to the guideline
- [ ] Code follows [coding guidelines][coding-guidelines]
- [ ] (Optional) Unit tests have been written for new behavior
- [ ] PR title describes the changes
The PR reviewers **must** check the checkboxes below before approval.

## Post-Review Checklist for the PR Author
- [ ] The PR follows the [pull request guidelines].
- [ ] The PR has been properly tested.
- [ ] The PR has been reviewed by the code owners.

**PR Author should check the checkboxes below before merging.**
## Post-review checklist for the PR author

- [ ] All open points are addressed and tracked via issues or tickets
- [ ] Write [release notes][release-notes]
The PR author **must** check the checkboxes below before merging.

## CI Checks
- [ ] There are no open discussions or they are tracked via tickets.
- [ ] The PR is ready for merge.

- **Build and test for PR**: Required to pass before the merge.
- **Check spelling**: NOT required to pass before the merge. It is up to the reviewer(s). See [here][spell-check-dict] if you want to add some words to the spell check dictionary.
After all checkboxes are checked, anyone who has write access can merge the PR.

[coding-guidelines]: https://tier4.atlassian.net/wiki/spaces/AIP/pages/1194394777/T4
[release-notes]: https://tier4.atlassian.net/l/c/X1p69s6B
[spell-check-dict]: https://github.com/tier4/autoware-spell-check-dict#how-to-contribute
[contribution guidelines]: https://autowarefoundation.github.io/autoware-documentation/main/contributing/
[pull request guidelines]: https://autowarefoundation.github.io/autoware-documentation/main/contributing/pull-request-guidelines/
27 changes: 27 additions & 0 deletions .github/workflows/sync-tier4-universe-to-humble.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: sync-tier4-universe-to-humble
on:
schedule:
- cron: 0 0 * * *
workflow_dispatch:

jobs:
sync-branches:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: generate-token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.PRIVATE_KEY }}

- name: Run sync-branches
uses: autowarefoundation/autoware-github-actions/sync-branches@v1
with:
token: ${{ steps.generate-token.outputs.token }}
base-branch: humble
sync-target-repository: git@github.com:tier4/CalibrationTools.git
sync-target-branch: tier4/universe
sync-branch: sync-tier4-universe-to-humble
pr-title: "chore: sync tier4/universe to humble"
auto-merge-method: merge
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,18 @@ Calibration tools used for autonomous driving

## Requirement

- Ubuntu20.04
- Ros Galactic

- Ubuntu 20.04
- ROS 2 Galactic

## Installation procedures

After cloning pilot-auto(private repository) or [autoware](https://github.com/tier4/autoware), execute the following commands:
After installing [autoware](https://github.com/tier4/autoware) (please see [source-installation](https://autowarefoundation.github.io/autoware-documentation/main/installation/autoware/source-installation/) page), execute the following commands:

```bash
mkdir src
vcs import src < autoware.repos
cd src/autoware
git clone git@github.com:tier4/CalibrationTools.git
cd ../../
vcs import src < src/autoware/calibration_tools/calibration_tools.repos
cd autoware
wget https://raw.githubusercontent.com/tier4/CalibrationTools/tier4/universe/calibration_tools.repos
vcs import src < calibration_tools.repos
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
```

Expand All @@ -28,28 +25,28 @@ colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

We provide calibration tool for sensor pairs like LiDAR - LiDAR, LiDAR - Camera, etc.

[README](https://github.com/tier4/calibration_tools.iv/blob/tier4/universe/sensor/README.md)
[README](sensor/README.md)

### localization - deviation estimation tools

Estimate parameters of sensors used for dead reckoning (IMU and odometry) for a better localization performance

[README](https://github.com/tier4/calibration_tools.iv/blob/tier4/universe/localization/deviation_estimation_tools/ReadMe.md)
[README](localization/deviation_estimation_tools/ReadMe.md)

### control - vehicle cmd analyzer

Visualization and analysis tools for the control outputs from Autoware

[README](https://github.com/tier4/calibration_tools.iv/blob/tier4/universe/control/vehicle_cmd_analyzer/README.md)
[README](control/vehicle_cmd_analyzer/README.md)

### vehicle - time delay estimator

Calibration tool to fix the delay of the commands to the vehicle

[README](https://github.com/tier4/calibration_tools.iv/blob/tier4/universe/vehicle/time_delay_estimator/README.md)
[README](vehicle/time_delay_estimator/README.md)

### system - tunable static tf broadcaster

GUI to modify the parameters of generic TFs.

[README](https://github.com/tier4/calibration_tools.iv/blob/tier4/universe/system/tunable_static_tf_broadcaster/README.md)
[README](system/tunable_static_tf_broadcaster/README.md)
8 changes: 8 additions & 0 deletions calibration_tools.repos
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
repositories:
autoware/calibration_tools:
type: git
url: git@github.com:tier4/CalibrationTools.git
version: tier4/universe
vendor/lidartag:
type: git
url: git@github.com:tier4/LiDARTag.git
Expand All @@ -19,3 +23,7 @@ repositories:
type: git
url: git@github.com:Box-Robotics/ros2_numpy.git
version: rolling
vendor/image_pipeline:
type: git
url: https://github.com/tier4/image_pipeline.git
version: 47964112293eb19f9f57254b2e6b68706954cc63
Empty file.
23 changes: 13 additions & 10 deletions localization/deviation_estimation_tools/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ If your are using rosbag, it should contain the following topics:
- /localization/pose_estimator/pose_with_covariance
- /clock
- /tf_static (that contains transform from `base_link` to `imu_link`)
- (/localization/twist_estimator/twist_with_covariance: required in the next step)
- (/localization/pose_twist_fusion_filter/kinematic_state: required in the next step)

Play the rosbag in a different terminal:
Expand All @@ -43,17 +44,19 @@ ros2 bag play YOUR_BAG # You can also play in a faster rate, e.g. -r 5

```sh
Files: localized_not_calibrated_0.db3
Bag size: 11.1 MiB
Bag size: 9.6 MiB
Storage id: sqlite3
Duration: 151.303s
Start: Apr 20 2022 20:49:10.440 (1650455350.440)
End: Apr 20 2022 20:51:41.744 (1650455501.744)
Messages: 53400
Topic information: Topic: /tf | Type: tf2_msgs/msg/TFMessage | Count: 9806 | Serialization Format: cdr
Topic: /clock | Type: rosgraph_msgs/msg/Clock | Count: 30260 | Serialization Format: cdr
Topic: /localization/twist_estimator/twist_with_covariance | Type: geometry_msgs/msg/TwistWithCovarianceStamped | Count: 4281 | Serialization Format: cdr
Topic: /localization/pose_estimator/pose_with_covariance | Type: geometry_msgs/msg/PoseWithCovarianceStamped | Count: 1484 | Serialization Format: cdr
Topic: /localization/pose_twist_fusion_filter/kinematic_state | Type: nav_msgs/msg/Odometry | Count: 7565 | Serialization Format: cdr
Duration: 76.539s
Start: Jul 8 2022 11:21:41.220 (1657246901.220)
End: Jul 8 2022 11:22:57.759 (1657246977.759)
Messages: 32855
Topic information: Topic: /localization/twist_estimator/twist_with_covariance_raw | Type: geometry_msgs/msg/TwistWithCovarianceStamped | Count: 2139 | Serialization Format: cdr
Topic: /localization/kinematic_state | Type: nav_msgs/msg/Odometry | Count: 3792 | Serialization Format: cdr
Topic: /localization/twist_estimator/twist_with_covariance | Type: geometry_msgs/msg/TwistWithCovarianceStamped | Count: 2139 | Serialization Format: cdr
Topic: /clock | Type: rosgraph_msgs/msg/Clock | Count: 15308 | Serialization Format: cdr
Topic: /tf | Type: tf2_msgs/msg/TFMessage | Count: 4950 | Serialization Format: cdr
Topic: /localization/pose_twist_fusion_filter/kinematic_state | Type: nav_msgs/msg/Odometry | Count: 3792 | Serialization Format: cdr
Topic: /localization/pose_estimator/pose_with_covariance | Type: geometry_msgs/msg/PoseWithCovarianceStamped | Count: 731 | Serialization Format: cdr
Topic: /tf_static | Type: tf2_msgs/msg/TFMessage | Count: 4 | Serialization Format: cdr

```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
parameter_estimator:
/**:
ros__parameters:
# Parameters that you want to evaluate
stddev_vx: 0.3 # [m/s]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
<arg name="rviz" default="false" description="launch rviz"/>
<arg name="map_path" default="" description="point cloud and lanelet2 map directory path"/>
<arg name="save_dir" default="/home/$(env USER)/deviation_evaluator_sample"/>
<arg name="param_path" default="$(find-pkg-share deviation_evaluator)/config/deviation_evaluator.yaml"/>
<arg name="param_path" default="$(find-pkg-share deviation_evaluator)/config/deviation_evaluator.param.yaml"/>

<arg name="in_twist_with_covariance" default="/localization/twist_estimator/twist_with_covariance"/>
<arg name="in_ndt_pose_with_covariance" default="/localization/pose_estimator/pose_with_covariance"/>
<arg name="in_ekf_gt_odom" default="/localization/pose_twist_fusion_filter/kinematic_state"/>
<arg name="out_ekf_odom" default="/localization/deviation_evaluator/ekf_localizer/kinematic_state"/>
<arg name="out_twist_with_covariance" default="/localization/deviation_evaluator/twist_estimator/twist_with_covariance"/>
<arg name="out_pose_with_covariance" default="/localization/deviation_evaluator/pose_estimator/pose_with_covariance"/>
<arg name="lanelet2_map_file" default="lanelet2_map.osm" />
<arg name="pointcloud_map_file" default="pointcloud_map.pcd" />
<arg name="lanelet2_map_file" default="$(var map_path)/lanelet2_map.osm" />

<node pkg="deviation_evaluator" exec="deviation_evaluator" name="deviation_evaluator" output="screen">
<remap from="in_twist_with_covariance" to="$(var in_twist_with_covariance)"/>
Expand Down Expand Up @@ -52,9 +51,10 @@

<!-- Map -->
<group>
<include file="$(find-pkg-share map_launch)/launch/map.launch.py" if="$(var rviz)">
<arg name="lanelet2_map_path" value="$(var map_path)/$(var lanelet2_map_file)" />
<arg name="pointcloud_map_path" value="$(var map_path)/$(var pointcloud_map_file)"/>
<include file="$(find-pkg-share map_loader)/launch/lanelet2_map_loader.launch.xml" if="$(var rviz)">
<arg name="lanelet2_map_path" value="$(var lanelet2_map_file)"/>
<arg name="lanelet2_map_topic" value="/map/vector_map"/>
<arg name="lanelet2_map_marker_topic" value="/map/vector_map_marker"/>
</include>
</group>

Expand Down
96 changes: 80 additions & 16 deletions sensor/README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,94 @@
# Sensor Calibration Tools

## Calibration tools installation (alongside autoware)
Sensor calibration can be split into two categories: intrinsic sensor calibration and extrinsic sensor calibration. In our calibration tools, we implement different methods for both categories.

After cloning autoware, execute the following commands:
## Extrinsic Calibration

```sh
mkdir src
vcs import src < autoware.proj.repos
vcs import src < src/autoware/calibration_tools/calibration_tools.repos
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
```
Extrinsic calibration refers to the relative poses among sensors that are provided to ROS2 nodes using the TF interface. Our calibration tools assume a TF diagram like the one presented in Figure 1.

## Extrinsic Calibration
<figure align="center">
<img src="docs/design/sensor_calibration.svg" width="600">
<figcaption align="center">Figure 1. Extrinsic calibration diagram</figcaption>
</figure>

In our design, `base_link` corresponds to the projection on the ground of the vehicle's rear axis and each vehicle may possess one or more sensor kits, which is a physical location on the vehicle where sensors are mounted. For example, a normal car would possess one sensor kit mounted on its top, whereas larger vehicles (e.g., a bus) would have several sensor kits distributed along the vehicle.

Although in the diagram present in Figure 1 the TFs from the base to the sensor kits, and from each kit to its sensors are provided, these are not the calibration targets. Instead, we calibrate from the `base_link` to a particular lidar, then from said lidar to the rest of the lidars, and finally from lidars to cameras. In order to comply with the diagram from Figure 1, the final output of the calibration process becomes:

$T(\text{sensor⎽kit⎽base⎽link}, \text{lidar0⎽base⎽link}) = T(\text{base⎽link}, \text{sensor⎽kit⎽base⎽link})^{-1} \times T(\text{base⎽link}, \text{lidar0⎽base⎽link})$

$T(\text{sensor⎽kit⎽base⎽link}, \text{lidar1⎽base⎽link}) = T(\text{sensor⎽kit⎽base⎽link}, \text{lidar0⎽base⎽link}) \times T(\text{lidar0⎽base⎽link}, \text{lidar1⎽base⎽link})$

$T(\text{sensor⎽kit⎽base⎽link}, \text{camera0/camera⎽link}) = T(\text{sensor⎽kit⎽base⎽link}, \text{lidar0⎽base⎽link}) \times T(\text{lidar0⎽base⎽link}, \text{camera0/camera⎽link})$

where the $T(\text{base⎽link}, \text{sensor⎽kit⎽base⎽link})$ is usually provided by a CAD model or can be simply approximated since it is a convenient frame and does not affect other computations.

Looking at the diagram from Figure 1, we could also directly calibrate all the sensors with respect to the `base_link`. However, we believe that sensor-sensor calibration provides more accurate and consistent results so we only use one `base_link` to sensor calibration and from then all other calibrations are performed via pairs of sensors.

### Generic calibration

- [Extrinsic manual calibration](docs/how_to_extrinsic_manual.md)

Intended as a proof-of-concept of our calibration API and as a baseline to which to compare automatic calibration tools, this method allows us to directly modify the values of the TF tree with a rviz view to evaluate the tfs and calibration.

<figure align="center">
<img src="docs/images/rviz_lidar.png" width="400">
<figcaption align="center">Figure 2. Manual calibration</figcaption>
</figure>

### Base-lidar calibration

- [How to Extrinsic Manual Calibration](docs/how_to_extrinsic_manual.md)
- [Ground-plane base-lidar calibration](docs/how_to_extrinsic_ground_plane.md)

- [How to Extrinsic Automatic Calibration](docs/how_to_extrinsic_auto.md)
This calibration method assumes the floor around the vehicle forms a plane and adjusts the calibration tf so that the points corresponding to the ground of the point cloud lie on the XY plane of the `base_link`. As such, only the `z`, `roll`, and `pitch` values of the tf are calibrated, with the remaining `x`, `y`, and `yaw` values needing to be calibrated via other methods such as manual calibration.

- [How to Extrinsic Interactive Calibration](docs/how_to_extrinsic_interactive.md)
<figure align="center">
<img src="docs/images/base-lidar/initial_calibration.png" width="250">
<img src="docs/images/base-lidar/final_calibration.png" width="250">
<figcaption align="center">Figure 3. Ground-plane base-lidar calibration (before and after calibration)</figcaption>
</figure>

- [How to Extrinsic Tag-based Calibration](docs/how_to_extrinsic_tag_based.md)
### Lidar-lidar calibration

- [How to Extrinsic Ground-plane Calibration](docs/how_to_extrinsic_ground_plane.md)
- [Map-based lidar-lidar calibration](docs/how_to_extrinsic_map_based.md)

To calibrate pairs of lidars, this method uses standard point cloud registration. However, due to the sparsity of traditional lidars, direct registration proves difficult. To address this issue, this method uses an additional point cloud map and a localization system to solvent this limitation during registration.

<figure align="center">
<img src="docs/images/map_based_calibration_results.png" width="400">
<figcaption align="center">Figure 4. Map-based calibration</figcaption>
</figure>

### Camera-lidar calibration

- [Extrinsic interactive camera-lidar calibration](docs/how_to_extrinsic_interactive.md)

To calibrate camera-lidar pairs of sensors, a common practice is to compute corresponding pairs of points and then minimize their reprojection error. This calibration method implements a UI to help the selection of these pairs and evaluate their performance interactively.

<figure align="center">
<img src="docs/images/camera-lidar/interactive_calibration_ui.png" width="400">
<figcaption align="center">Fig 5. Interactive camera-lidar calibration UI</figcaption>
</figure>

- [Tag-based camera-lidar calibration](docs/how_to_extrinsic_tag_based.md)

This calibration method extends the interactive calibration by performing the corresponding points acquisition automatically via moving a known tag (lidartag) through the shared field of view.

<figure align="center">
<img src="docs/images/camera-lidar/correct_calibration.png" width="400">
<figcaption align="center">Fig 6. Tag-based camera-lidar calibration</figcaption>
</figure>

## Intrinsic Calibration

- [How to Camera Calibration](docs/how_to_camera.md)
Intrinsic calibration is the process of obtaining the parameters that allow us to transform raw sensor information into a coordinate system. In the case of cameras, it refers to the camera matrix and the distortion parameters, whereas in lidars it can refer to the offset and spacing of beams. In our repository, we focus only on camera calibration, since lidar intrinsic calibration is usually vendor-specific (and either the direct parameters or instructions are usually provided by them).

### Intrinsic camera calibration

- [Camera calibration](docs/how_to_camera.md)

Based on the traditional ROS camera calibration procedure, we add extra visualizations to aid the calibration process and support for apriltag boards.

- [Camera calibration via camera-lidar calibration](docs/how_to_extrinsic_interactive.md)

- [How to Camera Calibration via camera-lidar calibration (Experimental)](docs/how_to_extrinsic_interactive.md)
Traditionally, camera calibration is performed by detecting several views of planar boards in an image, and so, by knowing the board's dimensions, the camera matrix and distortion can be computed. However, this same process can also be performed by obtaining generic camera-object pairs, like the ones obtained during camera-lidar calibration. By reutilizing the calibration points from camera-lidar calibration, we can perform camera intrinsic calibration and camera-lidar extrinsic calibration simultaneously.
Loading

0 comments on commit e26a1d2

Please sign in to comment.