Random position in AMCL with robot_localization
Hello,
I have a problem in using AMCL package , The output position is totally random. When feeding the /initial_pose topic with current output of robot localization , the car is on the right position on the map. As shown in the next pic:
As soon as the car moves , Particles start to vastly spread out and randomly jump and the car never localize itself in a proper way again as shown in the video: amcl
I didn't investigate much at amcl parameters . But I suspect that I have a fundamental issue. Am I missing something? Here is my setup:
robot localization ( 1 local node): inputs: imu , wheel_odometry ( I put odometry child_frame_id as base_footprint and imu as i mu_link "fixed transfor to base_footprint" )
Sample Msgs:
IMU:
header:
seq: 25
stamp:
secs: 1538665174
nsecs: 779748916
frame_id: "imu_link"
orientation:
x: -0.021728795831
y: 0.0629217740198
z: 0.934970575289
w: 0.348423209804
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.01]
angular_velocity:
x: 0.0010685628315
y: 0.00427425132599
z: 0.00747993982048
angular_velocity_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
linear_acceleration:
x: 1.45088620605
y: 1.59932670898
z: 10.4099888184
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Wheel_Odom:
header:
seq: 1
stamp:
secs: 1538665300
nsecs: 997972965
frame_id: "odom"
child_frame_id: "base_footprint"
pose:
pose:
position:
x: 0.0
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 0.0
covariance: [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.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, 0.0, 0.0, 0.0, 0.0, 0.0]
twist:
twist:
linear:
x: 0.0
y: 0.0
z: 0.0
angular:
x: 9.0
y: 0.0
z: 0.0
covariance: [1e-05, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1e-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.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]
Launch File:
<launch>
<node pkg="robot_localization" type="ekf_localization_node" name="ekf_loc" clear_params="true" output="screen">
<remap from="odometry/filtered" to="/odometry/filtered1" />
<param name="frequency" value="5"/>
<param name="sensor_timeout" value="0.3"/>
<param name="map_frame" value="map"/>
<param name="two_d_mode" value="true"/>
<param name="odom_frame" value="odom"/>
<param name="base_link_frame" value="base_footprint"/>
<param name="world_frame" value="odom"/>
<param name="use_control" value="false"/>
<param name="odom0" value="/rdwheel_odometry_new"/>
<param name="imu0" value ...
You should have the wheels in your tf tree. Also you can see that the buffer length between map and odom is 0.0 which means no data is sent. Can you tell us which robot you are using ?
Also I'd recommend two things :
odom
output when moving straight forward is correct.ekf_localization_node
and see what happenMy robot is an ackerman golf cart. I use wheel odometry twist messege in base_footprint frame which is in the middle of the 2 rear wheels. I didn't notice the buffer lenght . I think that's why there is insane output position. But why amcl node (the publisher of this tf) did that?
If I didn't use robot localization . I think I have to publish a transform (base_footprint -> odom ) myself. I already tried that . I published this transform using imu and wheel_odometry data . And The same thing happened.
I've looked the urdf of the ackerman golf cart and you should definitly have a bigger
tf_tree
. You don't even have the tf base_link->base_footprint. Can you load correctly your urdf in rviz ? (if yes can you show us the tf_tree only when visualizing the robot and using nothing else please ?)Thank you for your time. Please check the question. I updated it.
Using
two_d_mode
only specify if you are operating in a planar envirronment to facilitate the calculations so it's not related to tf. Does using the full urdf create errors ? Also have you checked thatodom
has coherent values when moving straight forward ?No , using the full urdf doesn't create errors. I 'll revise odom values again to check that , and I'll return with a bag file. Until that what do you suspect? Is there something wrong in robot localization configuration that may outputs coherent values ?