# robot_localization

I am trying to use robot_localization package to stimate the position of my robot. First I am going to explain what I have.

Sensors:

IMU publishing sensor_msgs::Imu publishing in /imu_rectificada topic. The IMU frame is ENU, 0 degrees when Y is in Norht and Z is up. I will fill the covariance once the node is working.

---
seq: 191036
stamp:
secs: 1434547057
nsecs: 229000000
frame_id: /imu
orientation:
x: -0.628702991434
y: -0.315484655538
z: 0.321512012361
w: 0.633902097503
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity:
x: -0.0138241518289
y: -0.0111814923584
z: 0.0322032161057
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.0442927330732
y: -9.97963142395
z: 0.102352119982
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---


Wheel odometry publishing nav_msgs::Odometry in /odom topic. It starts at 0 position.

---
seq: 110736
stamp:
secs: 1434546465
nsecs: 469210289
frame_id: /odom
pose:
pose:
position:
x: 276.840007856
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 1.0
covariance: [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
twist:
twist:
linear:
x: 0.1
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0
covariance: [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
---


tf:

I publish the transform /odom -> /base_link only with the information of odometry, so it doesnt have any global information. I cloud change this with the information of the imu, but actually im not interested in global positioning.

Here my first question, where should I set the transform for the IMU, I am trying with a transform /base_link -> /imu where imu_frame is just base_link_frame but with the rotation reported from the IMU.

Q1: Is it good the transform I am publishing with the odometry? Where should I set the transform for the IMU?

My launch file is:

<launch>
<node pkg="robot_localization" type="ukf_localization_node" name="ukf_localization" clear_params="true">

<!-- My odometry publish at this frequency -->
<param name="frequency" value="10"/>
<param name="sensor_timeout" value="0.15 ...
edit retag close merge delete

So entering this:

rostopic echo /odometry/filtered

...produces nothing? You can try turning on debug mode and very briefly run the node, then kill it and look at the debug output. Look for "failed" in the debug file. I suspect transforms.

( 2015-06-18 07:11:08 -0500 )edit

When you say the estimation is "not correct," in what way is it not correct? Are you saying that everything works in simulation, but not on a real robot?

( 2015-07-08 18:55:10 -0500 )edit

Sort by » oldest newest most voted

1. I publish the transform /odom -> /base_link only with the information of odometry, so it doesnt have any global information. I cloud change this with the information of the imu, but actually im not interested in global positioning.

Don't do that. robot_localization (ekf_localization_node or ukf_localization_node) will publish the odom->base_link transform for you.

Here my first question, where should I set the transform for the IMU, I am trying with a transform /base_link -> /imu where imu_frame is just base_link_frame but with the rotation reported from the IMU.

Just use a static transform. You don't need to constantly update the base_link->imu transform. If your IMU is really mounted at the center of your robot, just use the tf2 (or tf) static_transform_publisher and give it a transform of all zeros.

2. You mis-spelled "false" in your odom0 configuration for yaw. You have:

<rosparam param="odom0_config">[false, false, false,
false, false, flase,
true,  true, false,
false, false, true,
false, false, false]</rosparam>


You want:

<rosparam param="odom0_config">[false, false, false,
false, false, false,
true,  true, false,
false, false, true,
false, false, false]</rosparam>


EDIT in response to update:

If no output is being produced, then see my comment above about turning on debug mode. Right now, I am actually suspecting an issue with the transforms. You have forward slashes in the frame_ids in your messages, and you also put them in the configuration for ukf_localization_node. This would normally be correct. However, robot_localization uses tf2, and we strip all forward slashes from the frame_ids to be compliant with it. In other words, you should do two things

1. Remove the forward slashes from the frame_ids in your messages.
2. (Optional, but you should do it anyway) Remove the forward slashes from the frame_ids in your ukf_localization_node launch file.

By the way, if you're only fusing velocities (like you are for odom0), then you don't need to turn on relative mode. That's only for fusing absolute position or orientation data.

EDIT in response to update 2:

Are you sure your IMU is outputting linear accelerations correctly? See this page. For the sample IMU message you posted above, was your IMU resting flat on a table in its neutral orientation? If so, your acceleration data is wrong. It should read +9.81 m/s^2 for Z when resting flat on a surface in its neutral orientation. If you roll it +90 degrees, it should read +9.81 m/s^2 for Y. If you pitch it +90 degrees (front end down), it should read -9.81 m/s^2 for X.

more

I am not sure if this should be here or in a upload of the question...

my IMU is rotated, it isn't in his neutral orientation, I am using a static transform to model this

( 2015-06-25 03:24:00 -0500 )edit