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

Robot localization Ignoring IMU

asked 2020-09-17 06:17:15 -0500

nalistic gravatar image

updated 2021-04-24 02:31:36 -0500

miura gravatar image

I Have tried to followed all the information available in the forum regarding imu and robot localization without luck. Context: I am using the Robot localization package to fuse my IMU with my encoders. I have tried increasing the robot localization threshold, and set all the parameters, I have checked the /diagnostic topic and it says the package should be running fine, i have enabled debugging to find the errors but i am not being able, i attach the debug information returned, the demo was running with the robot still in place and moving the imu.

here are the logs from robot localization https://justpaste.it/7vwyf

and here my configuration of the robot localization package

frequency: 30
two_d_mode: true
publish_tf: false

base_link_frame: base_link
world_frame: map
map_frame: map
odom_frame: odom

imu0: Imu
imu0_config: [false, false, false,
          false,  false,  true,
          false, false, false,
          false,  false,  true,
          true,  false,  false]

imu0_differential: true
odom0: odom_raw
odom0_config: [true, true, false,
           false, false, false,
           true, true, false,
           false, false, true,
           false, false, false]

odom0_differential: true

imu0_linear_acceleration_rejection_threshold: 100
imu0_pose_rejection_threshold: 10
imu0_angular_velocity_rejection_threshold: 10
debug: true
debug_out_file: /home/add/Escritorio/Test


process_noise_covariance: [0.05, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                          0.0, 0.05, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                          0.0, 0.0, 0.06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                          0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                          0.0, 0.0, 0.0, 0.0, 0.03, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                          0.0, 0.0, 0.0, 0.0, 0.0, 0.06, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.025, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.04, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
                                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 0.0, 0.0,
                                          0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0 ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-09-17 10:11:56 -0500

JackB gravatar image

updated 2020-09-26 10:13:23 -0500

You have imu0_differential: true which is going to take the derivative of the of the two terms that your IMU is providing you (omega_z and a_x). If you take the derivative of those they are going to become angular acceleration and jerk respectively, both values which the filter does not use. Set imu0_differential: false and you should see the correct behavior assuming nothing else is wrong. Please let us know!

The Real Answer: The problem was that the tf tree had been configured to have multiple odom frames contrary to best practices established in REP105. Also the configuration file above had the world_frame set to "map", when it needs to be set to "odom" for a robot_localization node producing the odom->base_link tf.

edit flag offensive delete link more

Comments

Thanks a lot for the response! Ill test tommorrow early in the morning and update the post.

nalistic gravatar image nalistic  ( 2020-09-17 10:32:55 -0500 )edit

I have already test it without luck no different appreciated,

here i am sharing what the robot localization debug returns for the imu (while wheels encoders are posting 0) https://justpaste.it/7vwyf

also here is my tf in case it is something wrong wih it

transforms.push_back(tf::StampedTransform(
     tf::Transform(tf::Quaternion(0, 0, 1, 0), tf::Vector3(0.15, 0.0, 0.15)),
    ros::Time::now(),"base_link", "laser"));
transforms.push_back( tf::StampedTransform(
    tf::Transform(tf::Quaternion(0, 0, 1, 0), tf::Vector3(0.0, 0.0, 0.0)),
    ros::Time::now(),"base_link", "imu_link"));

the imu messages and the odometry (encoders) look fine, they are in the odom and imu_link frames

nalistic gravatar image nalistic  ( 2020-09-18 02:48:07 -0500 )edit

Just a tip, do rosrun tf view_frames to get a graphical output of the frames. I have found many problems using this tool that I would not have otherwise. I will try to read that debug output when I have a chance today.

JackB gravatar image JackB  ( 2020-09-18 08:31:08 -0500 )edit

It doesnt let me upload the view_frame to ros anwers, but maybe my issue is with the tf, the odom_raw is an odometry message with child_frame_id "odom_raw" and frame_id "base_link", is that set up correct? since there is no parent_frame_id thats the only solution i managed to make the odom_raw (odometry from encoders) child of the base link

nalistic gravatar image nalistic  ( 2020-09-21 06:59:08 -0500 )edit

In order to conform with REP 105 and the best practice of the robot_localization package your odom_raw odometry message should have the frame_id=odom and child_frame_id=base_link.

JackB gravatar image JackB  ( 2020-09-21 07:57:05 -0500 )edit

More generally, the only "discretionary" frames you should have, considering that we are not super users, are the frames below base_link. Above base_link it should always be map->odom->base_link. If you are ever tempted to change this idea, by adding "odom_raw" as a frame or something else like that, you should second guess yourself.

JackB gravatar image JackB  ( 2020-09-21 08:04:09 -0500 )edit

But right now I have 2 odometry sources and the odometry filtered result from the package, all odometry sources should be in the same Odom frame?

nalistic gravatar image nalistic  ( 2020-09-21 08:05:16 -0500 )edit

For this case yes. Your robot only has one odom frame no matter what happens, the same way it has only one base_link or map frame.

JackB gravatar image JackB  ( 2020-09-21 08:09:17 -0500 )edit

Also, your world_frame should be odom if you are only fusing imu and encoder data :)

JackB gravatar image JackB  ( 2020-09-21 11:36:24 -0500 )edit

Sorry, I did update the code to use odom as world frame, I have tested using the same ID and child frame id but roswtf was complaining about multiple nodes publishing the same tf, should I only publish the Odom frame once? If so, with which positions data? The one returned by the filter?

nalistic gravatar image nalistic  ( 2020-09-21 12:32:11 -0500 )edit

Its ok, the only node publishing the odom->base_link frame should be the robot_localization node. That is really the point of the node, to publish the frame. It is not good practice to have multiple nodes publishing the same node for the general case.

JackB gravatar image JackB  ( 2020-09-21 12:53:34 -0500 )edit
1

Thanks! that did it, my issue was with tf i was publishing each odometry in a different frame

nalistic gravatar image nalistic  ( 2020-09-24 03:58:08 -0500 )edit

@nalistic I am happy to hear you found it! To make sure people can debug their own issues and take advantage of your experience you can post and accept an answer to your own question here explaining the original problem, the process you went through, and how exactly you solved it.

JackB gravatar image JackB  ( 2020-09-24 07:00:34 -0500 )edit
1

Thanks JackB for the help! my issue was with how my robots TF was set up. The issue had nothing to do with the IMU itself, but when fusing visual and encoders odometry, I had set up each odometry source in different frames, instead of having only once odometry frame with multiple topics.

nalistic gravatar image nalistic  ( 2020-09-24 07:05:14 -0500 )edit

I cant see any accept button as in other xxx.answers forumns not even to my or your answer

nalistic gravatar image nalistic  ( 2020-09-24 07:06:27 -0500 )edit

It is the little checkmark directly below the upvote or downvote button :)

JackB gravatar image JackB  ( 2020-09-24 08:36:51 -0500 )edit

I have one last question and mayb you could help me, I am using the rf2o package to publish the Laser data to the Odom frame as you explained me before, my issue is that the laser itself is offsetted 15cm and rotated 180 degrees but i have no way to indicate that the LaserOdommetry should be offsetted 15 cm and 180 degrees from the Odom, i am not sure if i am being clear enough

nalistic gravatar image nalistic  ( 2020-09-25 03:35:45 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-09-17 06:17:15 -0500

Seen: 423 times

Last updated: Sep 26 '20