ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

IMU Data Problem

asked 2016-11-12 12:34:03 -0600

MarkyMark2012 gravatar image

updated 2016-12-01 02:26:12 -0600

damonkohler gravatar image

Hi,

I have a gyro - no accelerometer or compass so only generating orientation IMU data. I'm getting a problem with Google's cartographer where is dies with an error:

[FATAL] [1478971675.576678386]: F1112 17:27:55.000000  2963 imu_tracker.cc:70] Check failed: (orientation_ * gravity_vector_).z() > 0. (nan vs. 0)

From the code this is coming from the Linear Acceleration checks:

void ImuTracker::AddImuLinearAccelerationObservation(
 const Eigen::Vector3d& imu_linear_acceleration) {
 // Update the 'gravity_vector_' with an exponential moving average using the
 // 'imu_gravity_time_constant'.
 const double delta_t =
  last_linear_acceleration_time_ > common::Time::min()
      ? common::ToSeconds(time_ - last_linear_acceleration_time_)
      : std::numeric_limits<double>::infinity();
  last_linear_acceleration_time_ = time_;
  const double alpha = 1. - std::exp(-delta_t / imu_gravity_time_constant_);
 gravity_vector_ =
     (1. - alpha) * gravity_vector_ + alpha * imu_linear_acceleration;
 // Change the 'orientation_' so that it agrees with the current
 // 'gravity_vector_'.
 const Eigen::Quaterniond rotation = Eigen::Quaterniond::FromTwoVectors(
  gravity_vector_, orientation_.inverse() * Eigen::Vector3d::UnitZ());
 orientation_ = (orientation_ * rotation).normalized();
 //cout << "Orientation: " << orientation_ << endl;
 CHECK_GT((orientation_ * gravity_vector_).z(), 0.);

So I think my defaulting of this data is incorrect (As I don't have the sensors for the o/p)

An example of my data is:

header: 
  seq: 62350
  stamp: 
    secs: 1478974808
    nsecs: 401812741
  frame_id: imu_msg
orientation: 
  x: 0.573576460039
  y: 0.0
  z: -0.0
  w: -0.819152027703
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity: 
  x: 0.0
  y: 0.0
  z: 0.0
angular_velocity_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
linear_acceleration: 
  x: 0.0
  y: 0.0
  z: 0.0
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

Any help would me appreciated.

Thanks

Mark

edit retag flag offensive close merge delete

Comments

This is a problem I am grappling with as well. If a sensor does not generate data for part of a message, what should the value be set to? A value of 0 for linear_acceleration is a valid number. Also, a covariance of 0.0 indicates that it is perfect. Shouldn't the value be set to NAN?

mike gravatar image mike  ( 2016-11-15 12:04:34 -0600 )edit

So the extended question is what should unused fields in a message be set to?

mike gravatar image mike  ( 2016-11-15 12:05:04 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-12-01 02:28:27 -0600

damonkohler gravatar image

Cartographer requires linear acceleration to do gravity alignment. We do provide a "flat_world_imu" for your use case here: https://github.com/googlecartographer...

edit flag offensive delete link more

Comments

Thanks - I'll give it a go and let you know Cheers Mark

MarkyMark2012 gravatar image MarkyMark2012  ( 2016-12-01 04:59:48 -0600 )edit
0

answered 2016-11-15 11:45:52 -0600

fsteinhardt gravatar image

updated 2016-11-15 11:51:10 -0600

Try setting the first element of the covariance to -1 for the unused measurement fields.

# If you have no estimate for one of the data elements (e.g. your IMU doesn't produce an orientation 
#  estimate), please set element 0 of the associated covariance matrix to -1

(from the IMU message description http://docs.ros.org/api/sensor_msgs/html/msg/Imu.html )

But I don't know if this helps with your cartographer problem, I haven't used it yet.

edit flag offensive delete link more

Comments

This is what I had in the 1st place, however cartographer doesn't like the -1. It crashed (from memory). So I need something in the covariance

MarkyMark2012 gravatar image MarkyMark2012  ( 2016-11-16 04:39:44 -0600 )edit

Setting the top-left covariance element to -1 is something of a convention that I don't think many users have heard of and consequently, not many nodes take into account. I wouldn't be surprised if the Cartographer wrapper does not handle this 'properly'.

gvdhoorn gravatar image gvdhoorn  ( 2016-11-16 04:57:12 -0600 )edit

Agreed. Would seem likely to be the case.

MarkyMark2012 gravatar image MarkyMark2012  ( 2016-11-16 06:37:07 -0600 )edit

Either cartographer really needs the acceleration values or just has the covariance/value input problem. You could file a cartographer issue and ask, maybe they can follow the -1 covariance convention.

fsteinhardt gravatar image fsteinhardt  ( 2016-11-16 09:36:11 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2016-11-12 12:34:03 -0600

Seen: 2,370 times

Last updated: Dec 01 '16