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

robot_localization and navsat_transform_node provide wrong pose

asked 2021-06-07 05:29:09 -0500

Marcus Barnet gravatar image

Hi to all,

I'm trying to get a correct pose for my skid-steering vehicle by using IMU and RTK-GPS (from ublox).

I use navsat_transform_node to generate the /odometry/filtered by using /ublox_gps/fix combined with the /imu_data/ and then the ekf_localization_node as second instance.

The problem is that I'm not getting correct information under RVIZ. If I set odom frame as fixed frame in RVIZ, I can see nothing drawn by /odometry/filtered and /odometry/gps topics.

Should I have a map to make the robot_localization work? Do I need to publish a tf from map to odom frame?

The /odometry/filtered topic is generated by robot_localization, but I can't understand if it's correct and however I cannot plot it in RVIZ.

I cannot understand why I'm not able to see the path in RVIZ.

<launch>
    <node name="bl_gps" pkg="tf2_ros" type="static_transform_publisher" args="0 0 0 0 0 0 1 base_link gps" />
    <node name="bl_imu" pkg="tf2_ros" type="static_transform_publisher" args="0 0 0 0 0 0 1 base_link imu_link" />

 <node pkg="robot_localization" type="navsat_transform_node" name="navsat_transform_node" respawn="true" output="screen">
        <param name="magnetic_declination_radians" value="0"/>
        <param name="zero_altitude" value="false"/>
        <param name="publish_filtered_gps" value="false"/>
        <param name="broadcast_utm_transform" value="true"/>
        <param name="wait_for_datum" value="true"/>
        <rosparam param="datum">[18.33294909563789, 40.06012014572104, 0.0, odom, base_link]</rosparam>
        <remap from="/gps/fix" to="/ublox_gps/fix"/>
        <remap from="/odometry/filtered" to="/odometry/filtered"/>
        <remap from="/imu/data" to="/imu_data"/>
    </node>

    <node pkg="robot_localization" type="ekf_localization_node"  name="ekf_odom" clear_params="true">
        <param name="odom0" value="/odometry/gps"/>
        <param name="imu0" value="/imu_data"/>
        <param name="frequency" value="10"/>
        <param name="sensor_timeout" value="0.1"/>
        <param name="two_d_mode" value="false"/>
        <param name="odom_frame" value="odom"/>
        <param name="base_link_frame" value="base_link"/>
        <param name="world_frame" value="odom"/>
        <rosparam param="imu0_config">[false, false, false,
                                        true,  true,  true,
                                        false, false, false,
                                        true,  true,  true,
                                        true,  true,  true]
        </rosparam>
        <param name="imu0_differential" value="false"/>
        <param name="imu0_remove_gravitational_acceleration" value="false"/>    
        <rosparam param="odom0_config">[true, true, true,
                                        false, false, false,
                                        false, false, false,
                                        false, false, false,
                                        false, false, false]
        </rosparam>
        <param name="odom0_differential" value="false"/>
        <param name="print_diagnostics" value="true"/>
        <param name="debug"           value="false"/>
        <param name="debug_out_file"  value="$(env HOME)/debug_ekf_localization.txt"/>    
    </node>

This is the output of /odometry/filtered:

    rostopic echo /odometry/filtered 
    header: 
      seq: 1286
      stamp: 
        secs: 1623059374
        nsecs: 659658909
      frame_id: "odom"
    child_frame_id: "base_link"
    pose: 
      pose: 
        position: 
          x: -325589.188922
          y: 2412419.0677
          z: 62.2733933113
        orientation: 
          x: 0.0109867434586
          y: 0.517231872535
          z: -0.0260019721528
          w: 0.855379669472
      covariance: [3.6044557794876098, -0.015878677513247248, 0.1368625236632224, 8.633587369403668e-11, -8.861249973655481e-10, -3.216145652088185e-11, -0.015878677513247248, 3.3048011011806797, -0.007119917916770026, 1.8472131111753644e-09, 6.326607301682415e-11, -8.108363233884301e-10, 0.13686252366322227, -0.00711991791677001, 2.268879609198499, -2.3844925176785617e-11, 1.621572947146949e-09, 1.6267748949876525e-16, 8.633587369403666e-11, 1.8472131111753646e-09, -2.3844925176785614e-11, 9.99667020457038e-07, 3.6771290652079676e-20, 2.2731193331381272e-15, -8.861249973655484e-10 ...
(more)
edit retag flag offensive close merge delete

Comments

1

Are you trying to localise your bot in the map frame? If yes, you would also need a node to publish the map -> odom transform.

skpro19 gravatar image skpro19  ( 2021-06-07 10:10:54 -0500 )edit

No, I didn't try because I have no map. I can't understand how to fix it. I tried to publish a static transform: rosrun tf static_transform_publisher 0.0 0.0 0.0 0.0 0.0 0.0 1.0 odom map 1000 but obviously it didn't solved the problem. How can I properly setup the map frame? I use no encoders, just the GPS and the IMU.

Marcus Barnet gravatar image Marcus Barnet  ( 2021-06-07 10:17:01 -0500 )edit

Did you have a look at the gmapping package?

skpro19 gravatar image skpro19  ( 2021-06-07 10:20:25 -0500 )edit

gmapping works with laser, I have no laser installed on my robot.

Marcus Barnet gravatar image Marcus Barnet  ( 2021-06-07 10:36:52 -0500 )edit

Try setting the map to odom propperly. <node pkg="tf2_ros" type="static_transform_publisher" name="map_odom" args="0 0 0 0 0 0 map odom"/>

xaru8145 gravatar image xaru8145  ( 2021-06-10 03:32:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-08-18 03:44:17 -0500

Tom Moore gravatar image

updated 2021-08-18 03:44:58 -0500

This setup is a little confusing to me. It looks like you're trying to generate a pose estimate for your robot using just IMU and GPS data, and r_l is not well-suited to that problem. Do you have any kind of velocity reference, like from wheel encoders? Even a twist stamped message with your commanded velocities would be something. Then you can fuse that into the EKF, as a TwistWithCovarianceStamped input.

Anyway, to answer some other questions:

I use navsat_transform_node to generate the /odometry/filtered

Looking at your configuration, the EKF is generating odometry/filtered, not navsat_transform_node.

The problem is that I'm not getting correct information under RVIZ. If I set odom frame as fixed frame in RVIZ, I can see nothing drawn by /odometry/filtered and /odometry/gps topics.

That's because your state estimate is in the stratosphere. Look at the position in your EKF output:

      x: -325589.188922
      y: 2412419.0677
      z: 62.2733933113

Your robot also thinks it's moving at insane speeds (like -56 m/s in Z). If you change the target frame in your "Views" pane to be base_link and then press the "Zero" button, it'll jump to the location where the stuff is being drawn. But looking at your Y position, rviz might struggle to draw that at all.

The fact that your state estimate is exploding means it's not getting all the data it needs. In this case, it looks like your orientation data is coming in fine from the IMU, but it doesn't look like your navsat_transform_node instance is putting out any data at all (i.e., /odometry/gps is not publishing). Start with figuring out whether navsat_transform_node is actually publishing data.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2021-06-07 05:29:09 -0500

Seen: 249 times

Last updated: Aug 18 '21