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

robot_localization package ros

asked 2023-05-25 14:39:59 -0500

Siddharth Bhurat gravatar image

updated 2023-06-06 10:18:27 -0500

I am trying to use the robot localization package of ros to fuse the data coming from imu (on imu topic), wheel encoder (computed odometry on /odom topic) and a RTK GPS (differential gps on topic /odom_gps). The data coming from this differential gps is not lot/long coordinates. They are the relative position from the base station which is at a certain distance from the robot. Since this differential gps is giving data in the NED frame, I am publishing this data using odometry message. And all the positions and orientations are with respect to this base station frame.

Now since I have 2 odoms and 1 imu to fuse, I need 2 tf's, that is one from baselink to odom_gps and the other from baselink to odom. Only then it will be fused by the filter correctly. I am not able to do this since it gives warning/error of having 2 parents for 1 child (baselink).

Please can someone suggest the correct way to do this.

This is my config file:

#Configuation for robot odometry EKF

frequency: 30

two_d_mode: true

publish_tf: true

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


#the odom0 configuration
odom0: /odom_gps
odom0_config: [true, true, false,
 false, false, false,
 false,  false,  false,
 false, false, false,
 false, false, false] 
odom0_differential: false


#  odom1 configuration
odom1: /odom
odom1_config: [true, true, false,
 false, false, true,
 true,  true,  false,
 false, false, true,
 false, false, false]
odom1_differential: true


# imu0 configuration
imu0: /imu
imu0_config: [false, false, false,
 false, false, false,
 false,  false,  false,
 false, false, true,   #angular velocity about z
 true, false, false]  #linear accleration along x
imu0_differential: false

process_noise_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.06, 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.03, 0,    0,     0,     0,    0,    0,    0,    0,    0,    0,
                            0,    0,    0,    0,    0,    1e-9, 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.025, 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.01, 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.02, 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.01, 0,
                            0,    0,    0,    0,    0,    0,    0,     0,     0 ...
(more)
edit retag flag offensive close merge delete

Comments

Please edit your message and include a sample message from each sensor input.

Tom Moore gravatar image Tom Moore  ( 2023-06-06 03:43:28 -0500 )edit

@Tom Moore , I have updated the details

Siddharth Bhurat gravatar image Siddharth Bhurat  ( 2023-06-06 10:19:08 -0500 )edit

Sorry for the run-around, but I have one more request. Given that this site is migrating to robotics.stackexchange.com, would you mind asking this question again there and sharing the link?

Tom Moore gravatar image Tom Moore  ( 2023-06-19 03:50:15 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2023-05-25 18:43:43 -0500

ketill gravatar image

updated 2023-05-26 16:38:39 -0500

I am more familiar with ROS2 but can perhaps be to some help. First about "warning/error of having 2 parents for 1 child (baselink)". It sounds like you have done it the wrong way around. Shouldn't the baslink be the parent and the other two the child. From /odom_gps you should probably only use x and y and not yaw. Do not know what type of robot you are using but if it is a differential odom1 should probably be velocity x and angular velocity. The colors in the plots makes no sense from a sensor perspective. The gps should be noisy but little drift and the encoder should be the opposite so something seems wrong.

edit flag offensive delete link more

Comments

I have updated the correct config file in the post above. But the problem I am still facing are the transforms. Because I have odometry coming from differential gps which is in the base station frame and the computed wheel odometry which is also in the base station frame. How will the tranform look like. Because there will be 2 transforms from odom and odom_gps to baselink. How to have the correct transforms ?

The colors are just denoting which sensor these x,y values are coming from. The gps is not that noisy because it is differential gps and so its not giving lat long coordinates but north, east, down (x, y, z respectively) values in the base station frame.

Siddharth Bhurat gravatar image Siddharth Bhurat  ( 2023-05-26 10:24:03 -0500 )edit

I think it would be better to only use velocity estimation from odom1. Should not be necessary but I have experience better performance that way. Especially if they have different start up times. For example if the wheels are spinning for some time before the startup of the filter they could give a state estimation far of from the starting point. If instead velocity is used the previous states would not matter. About the frames: do you need two frames? The only frame you care about is from base_station - base_link? Then you just fuse the data in the filter.

ketill gravatar image ketill  ( 2023-05-26 16:35:56 -0500 )edit

The 2 parents for 1 child might be because you have 2 nodes broadcasting Odom->base_link and it won’t show in the tf tree. Do any of your odometry sources broadcast that tf? If so, turn it off it allows.

chased11 gravatar image chased11  ( 2023-05-26 17:27:56 -0500 )edit

@ketill, I tried using just velocity estimates, but then there are more jumps between odom and gps_odom. When I use positions from both, then the jumps are less. The plots for both:

with only velocity from odom1

with position and velocity from odom1

And for the transforms, I will have odom to baselink, odom_gps to baselink. This might cause that warning of redundant transforms and having multiple parents

Siddharth Bhurat gravatar image Siddharth Bhurat  ( 2023-05-27 11:11:10 -0500 )edit

@chased11 yes I have 2 broadcasters, one from odom_gps to baselink, and other is from odom to baselink. I think if I don't have one of the transform, then the filter might not accept/use it right ?

Siddharth Bhurat gravatar image Siddharth Bhurat  ( 2023-05-27 11:14:07 -0500 )edit

Are you shore the wheel odometry is correct. Are you using simulation or a real robot? It is important that the radius of the wheels and the distance between them is correct. On a real robot the number of tics from the encoder also must be correct.

ketill gravatar image ketill  ( 2023-05-28 05:52:18 -0500 )edit

I think it is correct, I have checked those dimension twice. It is a real robot. But whatever calculations I am doing are using wheel velocities and being transformed to basestation frame (both position and orientation). I have another question:

Since I am publishing one odometry using wheel velocities and other odometry from gps, is it fine if I set both the messages to have the frame id as odom and child as baselink. And the I dont publish any transform between these links, rather set the publish transform as true in the robot localization config file. Will that be fine ?

Siddharth Bhurat gravatar image Siddharth Bhurat  ( 2023-05-28 22:50:30 -0500 )edit

Yes that should be fine. You only want the final pose estimation to come from robot_localization

ketill gravatar image ketill  ( 2023-05-30 02:12:12 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2023-05-25 14:39:59 -0500

Seen: 171 times

Last updated: Jun 06 '23