From 8bfda0f974277c0eb5fb98f79df3f01fef3b4349 Mon Sep 17 00:00:00 2001
From: homography <xieyuanfan@gmail.com>
Date: Wed, 18 Apr 2018 10:05:09 +0800
Subject: [PATCH] add imu vehicle calibration tool, also add ceres-solver to
 docker file. note that, the ceres solver version provided by apt is 1.8.

---
 docker/build/dev.x86_64.dockerfile            |  1 +
 .../build/installers/install_ceres_solver.sh  | 22 +++++++++++
 .../apollo_2_0_sensor_calibration_guide.md    | 39 +++++++++++++++++++
 3 files changed, 62 insertions(+)
 create mode 100755 docker/build/installers/install_ceres_solver.sh

diff --git a/docker/build/dev.x86_64.dockerfile b/docker/build/dev.x86_64.dockerfile
index e3f49e0bd5a..2ebbdb11ab0 100644
--- a/docker/build/dev.x86_64.dockerfile
+++ b/docker/build/dev.x86_64.dockerfile
@@ -7,6 +7,7 @@ COPY installers /tmp/installers
 RUN bash /tmp/installers/pre_install.sh
 RUN bash /tmp/installers/install_bazel.sh
 RUN bash /tmp/installers/install_bazel_packages.sh
+RUN bash /tmp/installers/install_ceres_solver.sh
 RUN bash /tmp/installers/install_gflags_glog.sh
 RUN bash /tmp/installers/install_glew.sh
 RUN bash /tmp/installers/install_glusterfs.sh
diff --git a/docker/build/installers/install_ceres_solver.sh b/docker/build/installers/install_ceres_solver.sh
new file mode 100755
index 00000000000..e29f6165e0f
--- /dev/null
+++ b/docker/build/installers/install_ceres_solver.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+###############################################################################
+# Copyright 2018 The Apollo Authors. 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.
+###############################################################################
+
+# Fail on first error.
+set -e
+
+apt-get install -y libceres-dev
diff --git a/docs/quickstart/apollo_2_0_sensor_calibration_guide.md b/docs/quickstart/apollo_2_0_sensor_calibration_guide.md
index 8e4e04bea5d..3103808f1b4 100644
--- a/docs/quickstart/apollo_2_0_sensor_calibration_guide.md
+++ b/docs/quickstart/apollo_2_0_sensor_calibration_guide.md
@@ -5,6 +5,7 @@ This guide introduces the Apollo Sensor Calibration Service and describes the th
 - Camera-to-Camera Calibration
 - Camera-to-LiDAR Calibration
 - Radar-to-Camera Calibration
+- IMU-to-Vehicle Calibration
 
 ## About This Guide
 
@@ -278,6 +279,44 @@ bash sensor_calibration.sh radar_camera
     You need to run the `radar_lidar_visualizer` tool to generate the image. 
     See [Radar LiDAR Visualizer Projection Tool](####Radar LiDAR Visualizer Projection Tool) for more information.
 
+## IMU-to-Vehicle Calibration
+1.	Download the [calibration tool](https://apollocache.blob.core.windows.net/apollo-cache/imu_car_calibrator.zip).
+2. Start the vehicle to move before calibration. The vehicle should keep going straight at speed of 3m/s for 10s at least.  There is no need to provide the intrinsic and initial extrinsic.
+3. Required topic: INS /apollo/sensors/gnss/odemetry 100Hz
+
+4. Run the IMU-to-Vehicle Calibration using these commands:
+
+```bash
+cd /apollo
+bash scripts/sensor_calibration.sh imu_vehicle
+```
+4. The result is saved as vehicle_imu_extrinsics.yaml in current path. Here is an example:
+```bash
+    header
+      seq: 0
+      stamp:
+        secs: 1522137131
+        nsecs: 319999933
+      frame_id: imu
+    transform:
+      translation:
+        x: 0.0
+        y: 0.0
+        z: 0.0
+      rotation:
+        x: -0.008324888458427
+        y: -0.000229845441991
+        z: 0.027597957866274
+        w: 0.999584411705604
+    child_frame_id: vehicle
+
+    #pitch install error: -0.954337
+    #roll install error: 0.000000
+    #yaw install error: 3.163004
+```
+
+
+
 ### (Optional) Run All Calibration Tools
 
 If necessary, users can run all calibration tools using these commands: