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

Issue with IMU config. ( Livox Horizon w/ External IMU ) #405

Closed
Ab-Tx opened this issue Mar 8, 2023 · 6 comments
Closed

Issue with IMU config. ( Livox Horizon w/ External IMU ) #405

Ab-Tx opened this issue Mar 8, 2023 · 6 comments

Comments

@Ab-Tx
Copy link

Ab-Tx commented Mar 8, 2023

Hi

I am having some trouble getting LIO-SAM working with my own hardware.
I am observing behaviour like described in issue #94.

For these tests, the LiDAR and IMU are not moving.

terminal and rviz

I'm using ptpd2 for synchronization. These are two headers recorded at the same time. There is a difference on the "nsecs" parameter, which is around 95 ms.

IMU message header:

header:
  seq: 4133
  stamp:
    secs: 1678293435
    nsecs: 194799837
  frame_id: "imu_link"

LiDAR point cloud message header:

header:
  seq: 91
  stamp:
    secs: 1678293435
    nsecs:  99923849
  frame_id: "livox_frame"
height: 1
width: 24000

It runs without any problem when working with the provided Livox dataset (I am using TixiaoShan livox_ros_driver package, also had "useImuHeadingInitialization: false" when playing the dataset).

- Hardware:

Livox Horizon
Xsens MTi-680G

The IMU alignment is the same as the LiDAR so I have set both "extrinsicRot" and "extrinsicRPY" to identity matrices.

- params.yaml

What I have changed on the LIO-SAM params.yaml:

  # Topics
  pointCloudTopic: "points_raw"  
  imuTopic: "imu/data" 
  odomTopic: "odometry/imu"
  gpsTopic: "odometry/gpsz"

  # Frames
  lidarFrame: "base_link"
  baselinkFrame: "base_link"
  odometryFrame: "odom"
  mapFrame: "map"
  
    # GPS Settings
  useImuHeadingInitialization: false 
  
    # Sensor Settings
  sensor: livox 
  N_SCAN: 6 
  Horizon_SCAN: 4000
  downsampleRate: 1 
  lidarMinRange: 1.0 
  lidarMaxRange: 1000.0 

  # Extrinsics: T_lb (lidar -> imu)
  extrinsicTrans: [-115.0, 0.0, 63,26.0] # x y z 
  extrinsicRot: [1, 0, 0,
              				  0, 1, 0,
               				  0, 0, 1]
  extrinsicRPY: [1, 0, 0,
               				  0, 1, 0,
               				  0, 0, 1]

With the provided bag file I use the default values for extrinsicTrans, extrinsicRot, extrinsicRPY and use /imu_raw instead of /imu/data.

On the recorded bag I'm pointing the LiDAR at a corner (from the ground pointing at the roof), that's why it looks like it is tilted.

- tf tree

tf_tree

- bag file

Here is a bag file recorded with my setup.
https://drive.google.com/file/d/1vHyeEK8l7XN48wCtQlUm2okEzSpmU_vc/view?usp=sharing

Any suggestions on what I should tweak?

@Ab-Tx
Copy link
Author

Ab-Tx commented Mar 16, 2023

Update:
The issue I was facing was wrong extrinsic parameters. While I had the IMU oriented the same way as the LiDAR (according to each device's datasheet) the LiDAR orientation was configured differently, noticed this after checking the LiDAR's configuration with Livox Viewer.

I had to input the extrinsic parameters in both extrinsicRot and extrinsicRPY.

Also the tf tree I uploaded may be incorrect.
After remapping /imu/data to /imu_raw, and using /imu_raw in LIO-SAM's params.yaml, the "imu_link" is now a child of "chassis link".

@Ab-Tx Ab-Tx closed this as completed Mar 16, 2023
@CharlieV5
Copy link

Update: The issue I was facing was wrong extrinsic parameters. While I had the IMU oriented the same way as the LiDAR (according to each device's datasheet) the LiDAR orientation was configured differently, noticed this after checking the LiDAR's configuration with Livox Viewer.

I had to input the extrinsic parameters in both extrinsicRot and extrinsicRPY.

Also the tf tree I uploaded may be incorrect. After remapping /imu/data to /imu_raw, and using /imu_raw in LIO-SAM's params.yaml, the "imu_link" is now a child of "chassis link".

Hi! Could you tell me how you set the extrinsicRot and extrinsicRPY, finally?

@Ab-Tx
Copy link
Author

Ab-Tx commented May 10, 2023

Sure, they were:
extrinsicRot: [0, 0, 1, 0, -1, 0, 1, 0, 0] extrinsicRPY: [0, 0, 1, 0, -1, 0, 1, 0, 0]

Here is the full configuration file:
params.yaml

@CharlieV5
Copy link

Sure, they were: extrinsicRot: [0, 0, 1, 0, -1, 0, 1, 0, 0] extrinsicRPY: [0, 0, 1, 0, -1, 0, 1, 0, 0]

Here is the full configuration file: params.yaml

Thanks! By the way, why these matrices can work? Shouldn't we set the calibrated extrinsic parameters?

@Ab-Tx
Copy link
Author

Ab-Tx commented May 10, 2023

There isn't necessarily a "calibration" for this matrices, it can be manually calculated but that depends on your hardware setup.
The IMU and the LiDAR each have their own orientation and a transformation from one to another has to be provided.

Let me borrow this part of the LIO-SAM description:

IMU alignment. LIO-SAM transforms IMU raw data from the IMU frame to the Lidar frame, which follows the ROS REP-105 convention (x - forward, y - left, z - upward). To make the system function properly, the correct extrinsic transformation needs to be provided in "params.yaml" file. The reason why there are two extrinsics is that my IMU (Microstrain 3DM-GX5-25) acceleration and attitude have different cooridinates. Depend on your IMU manufacturer, the two extrinsics for your IMU may or may not be the same. Using our setup as an example:

  • we need to set the readings of x-z acceleration and gyro negative to transform the IMU data in the lidar frame, which is indicated by "extrinsicRot" in "params.yaml."

  • The transformation of attitude readings might be slightly different. IMU's attitude measurement q_wb usually means the rotation of points in the IMU coordinate system to the world coordinate system (e.g. ENU). However, the algorithm requires q_wl, the rotation from lidar to world. So we need a rotation from lidar to IMU q_bl, where q_wl = q_wb * q_bl. For convenience, the user only needs to provide q_lb as "extrinsicRPY" in "params.yaml" (same as the "extrinsicRot" if acceleration and attitude have the same coordinate).

This website may help you understand this parameters.

@CharlieV5
Copy link

Thank you very much! Your replies help me a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants