0
$\begingroup$

Rosanswers logo

I am trying to use a gps and imu for localization of a gazebo simulated robot. For this I am using navsat and ekf nodes. But my navsat node is always publishing zero.

The error message I am receiving is

    Warning: Invalid argument "/world" passed to canTransform argument source_frame in tf2 frame_ids cannot start with a '/' like:
         at line 134 in /tmp/binarydeb/ros-melodic-tf2-0.6.5/src/buffer_core.cpp
[ WARN] [1614584451.566137626, 316.190000000]: Could not obtain transform from /world to chassis. Error was Invalid argument "/world" passed to lookupTransform argument source_frame in tf2 frame_ids cannot start with a '/' like:

[ WARN] [1614584451.566646918, 316.190000000]: Unable to obtain chassis->/world transform. Will assume navsat device is mounted at robot's origin
[ INFO] [1614584451.567084449, 316.190000000]: Corrected for magnetic declination of 0.368788, user-specified offset of 0.000000 and meridian convergence of -0.001334. Transform heading factor is now 3.493143
[ INFO] [1614584451.567666613, 316.190000000]: Transform world frame pose is: Origin: (0 0 0)
Rotation (RPY): (0, 0, -0.015900924710489677816)

[ INFO] [1614584451.567958639, 316.190000000]: World frame->cartesian transform is Origin: (2445618.4779923087917 4981487.1742727346718 -0.44221211776894475687)
Rotation (RPY): (0, -0, 2.7741413272136945523)

Warning: Invalid argument "/world" passed to canTransform argument source_frame in tf2 frame_ids cannot start with a '/' like:
         at line 134 in /tmp/binarydeb/ros-melodic-tf2-0.6.5/src/buffer_core.cpp
[ WARN] [1614584451.804221307, 316.290000000]: Could not obtain chassis->/world transform. Will not remove offset of navsat device from robot's origin.
Warning: Invalid argument "/world" passed to canTransform argument source_frame in tf2 frame_ids cannot start with a '/' like:
         at line 134 in /tmp/binarydeb/ros-melodic-tf2-0.6.5/src/buffer_core.cpp
Warning: Invalid argument "/world" passed to canTransform argument source_frame in tf2 frame_ids cannot start with a '/' like:
         at line 134 in /tmp/binarydeb/ros-melodic-tf2-0.6.5/src/buffer_core.cpp

my navsat node code is

        <launch>
    
      <node name="bl_gps" pkg="tf2_ros" type="static_transform_publisher" args="0 0 0 0 0 0 1 chassis gps" />
    
      <node name="bl_m" pkg="tf2_ros" type="static_transform_publisher" args="0 0 0 3.1416 -1.5708 0 chassis 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.36878808"/>
      <param name="zero_altitude" value="false"/>
      <param name="publish_filtered_gps" value="true"/>
      <param name="broadcast_cartesian_transform" value="true"/>
      <param name="wait_for_datum" value="false"/>
    
      <remap from="/gps/fix" to="/fix"/>
      <remap from="/imu/data" to="/imu"/>
    </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"/>
    
      <param name="frequency" value="30"/>
      <param name="sensor_timeout" value="2"/>
      <param name="two_d_mode" value="true"/>
    
      <param name="map_frame" value="map"/>

  <param name="odom_frame" value="odom"/>
  <param name="base_link_frame" value="chassis"/>
  <param name="world_frame" value="odom"/>

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

  <param name="imu0_differential" value="false"/>
  <param name="imu0_remove_gravitational_acceleration" value="true"/>

  <rosparam param="odom0_config">[true, true, false,
                                  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)/adroit_files/debug_ekf_localization.txt"/>

</node>

</launch>

can someone help me with this. I have seen ros answers post. They are linked below. https://answers.ros.org/question/332905/robot_localization-navsat-transform-node-does-not-publish/ https://answers.ros.org/question/200071/how-to-fuse-imu-gps-using-robot_localization/?answer=200087#post-id-200087 https://answers.ros.org/question/236588/imu-and-gps-fusion-without-odom-robot_localization/?answer=237043#post-id-237043

I am a bit confused about how the whole thing works. I have also read REP 105


Originally posted by HELPme on ROS Answers with karma: 7 on 2021-03-01

Post score: 0


Original comments

Comment by xaru8145 on 2021-03-01:
Can you add sample messages of your gps and imu?

Comment by HELPme on 2021-03-01:
the imu message is

  header:
  seq: 214
  stamp:
    secs: 21
    nsecs: 780000000
  frame_id: "imu_link"
orientation:
  x: -3.57496048755e-06
  y: 2.76906236663e-05
  z: -0.000219465066084
  w: 0.999999975528
orientation_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
angular_velocity:
  x: 3.08407873507e-06
  y: 0.0109527869533
  z: -3.9952695321e-06
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.635660503637
  y: -8.76429508382e-05
  z: 9.79947574441
linear_acceleration_covariance: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
---

the gps message is

 header:
  seq: 443
  stamp:
    secs: 111
    nsecs:         0
  frame_id: "/world"
status:
  status: 0
  service: 0
latitude: 49.9000287128
longitude: 8.89997284201
altitude: -8.94856210614
position_covariance: [25.
$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

The GPS message frame_id is wrong. As the warning suggests, your frame_id cannot start with a '/'. Change the header from /world to world.

On a side note, setting the GPS frame_id to world is a bad practice since it is a fix frame. And you are also providing a gps to chassis transform. I would then suggest to change the GPS frame to gps_link. Then change the transform:

<node name="bl_gps" pkg="tf2_ros" type="static_transform_publisher" args="0 0 0 0 0 0 1 chassis gps_link" />

Also, if you do not have any source that is publishing a transfrom between odom and world, you should do that at the beginning of the launch file:

<node pkg="tf2_ros" type="static_transform_publisher" name="map_odom" args="0 0 0 0 0 0 map odom" />

Let me know if that solves your problem.

NOTE: I would strongly advice you against having a 0 value covariance. The covariance measures how confident you are about a measurement. Set that to a small value e.g. 0.001 if you have a good IMU. The GPS covariance msg seems incomplete so I cannot speak for this one.


Originally posted by xaru8145 with karma: 105 on 2021-03-01

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by HELPme on 2021-03-01:
can u please specify how to change the frame for gps. I have changed the frameID. But still the message doesn't change

Comment by xaru8145 on 2021-03-01:
If you are using Gazebo, then I guess look where you are defining your model for the GPS you are also defining the frame_id of the sensor.

Comment by HELPme on 2021-03-01:
thank you very much. But now i am having one more error

[ WARN] [1614607761.617343623, 73.450000000]: Failed to meet update rate! Took 0.38000000100000003167
[ WARN] [1614607763.756964125, 74.750000000]: Transform from chassis to odom was unavailable for the time requested. Using latest instead.

[ WARN] [1614607766.647844729, 76.750000000]: Transform from chassis to odom was unavailable for the time requested. Using latest instead.

[ WARN] [1614607769.624945507, 79.250000000]: Transform from chassis to odom was unavailable for the time requested. Using latest instead.

[ WARN] [1614607772.029804789, 80.910000000]: Failed to meet update rate! Took 0.22666673900000000597
[ WARN] [1614607772.051239817, 80.920000000]: Failed to meet update rate! Took 0.20333340600000002207
[ WARN] [1614607772.463841100, 81.250000000]: Transform from chassis to odom was unavailable for the time requested. Using latest instead.

[ WARN] [1614607775.641248285

Comment by xaru8145 on 2021-03-02:
This is is a WARNING not an ERROR. Check this post. Try setting in the robot localization pkg: <param name="predict_to_current_time" value="true"/>

Are you getting valid results?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.