Localisation inaccurate because navsat_transform is incorrectly calculating odometry
I'm trying to localise my robot in an outdoor environment by integrating GPS data in ROS. I'm running two ekf_localisation
instances and one navsat_transform
instance. In addition, I'm running an instance of /move_base
so I can send ActionGoals to control the UGV. But in general, the localisation is inaccurate, and the origin of my /map
and /odom
frames move relative to each other, and relative to the real world. I'm not entirely sure why.
In addition, I'm trying to use navsat_transform
to create a /map
frame at a specified latitude/longitude whose 'Y' axis always faces true north. But I'm having difficulty achieving this as well, and I suspect that one problem is causing or at least contributing to the other.
Here is all the details and diagnostic info:
Robot: Clearpath Jackal UGV
OS: Ubuntu 14.04 on laptop, Ubuntu server on robot
ROS distro: Indigo Igloo
Launch files: ekf_plus_navsat.launch, odom_demo.launch
Frame tree: frames
rqt_graph_output: Nodes and topics
Example bag files: box_mapFrame.bag, box_mapFrame_odometry_and_sensors_only.bag, box_odomFrame.bag
Example sensor inputs: sample_imu_data.txt, sample_odometry_data.txt, sample_gps_data.txt
All of my sensor data conforms to REP-103 and REP-105. The IMU reports 0.0 facing True North but I use the yaw_offset
parameter in navsat_transform
to compensate accordingly
There is a variety of strange behaviour I'm seeing, so I'll try to break it down sequentially. In the bag files above (more coming soon) I mark out a 4x4 m grid starting the robot in one corner, manually drive it round the square and back to its origin. So the first time it moves around, it should definitely be moving in a (rough) 4x4 grid. I then remotely command the robot to move around the square by issuing it ActionGoals sequentially in either /map
frame or /odom
frame (I.e. 4,0 -> 4,4 -> 0,4 -> 0,0). Where the robot ends up is no-where near where it started, regardless of whether I'm giving issuing ActionGoals in the /map
or /odom
frame.
I've documented the various errors as best I can below. Any help or advice will be greatly appreciated.
UPDATE 1:
I can finally edit this again when I couldn't for a few days?! Anyway...
Here are my updated ekf_launch files: ekf_and_gps_localisation.launch
And separate launch files for each node: ekf_local.launch, ekf_global.launch, navsat_transform.launch
IMU appears to be faulty
[EDIT]: Ignore any of my comments regarding the IMU - as it turns out the raw mag data from both
/imu/mag
and/imu/magnetic_field
are un-calibrated which made me think the IMU wasn't working (it is). So lesson learned: use/imu/data
only to get an earth-referenced heading. In fairness the documentation could be a little clearer on this issue.Transforms missing when launching EKF/navsat nodes
The various EKF and navsat nodes are VERY picky about how they are launched. If you run the ekf_and_gps_localisation.launch by itself after bootup, the EKF nodes will launch properly, but ...
Can you please post sample input messages for each sensor? It can be a bit quicker sometimes to rapidly troubleshoot issues if I don't have to pull down the bag first.
Also, the map and odom frame will move away from one another. Also also, please turn off debug mode! You're taxing your CPU a LOT by turning that on, and outputting a massive text file somewhere. :)
It looks like a pretty solid launch file. Post some raw input data and I'll try to take a look at the bag soon.
I now suspect that I haven't set up navsat_transform quite right because the /odometry/gps data doesn't match the raw gps input. Regardless, I've uploaded sample sensor data and more bag files. Thanks for pointing out the debug file size - serves me right for not reading the documentation properly.
As for the launch file, I largely copied it from one you had posted in a different answer. I was struggling to understand the GPS integration tutorial, but having a full working example to look at helped enormously, especially regarding how the /map, /odom and /utm frames are set up.
I can't edit my own question now for some reason, but I'm convinced that my IMU and navsat_transform are the cause of the problem. the origin of /map is never where it's supposed to be - its always out by at least 2 meters, often more.
The XYZ output of a vector magnetometer points in the direction of the magnetic field, isn't that correct? So as the robot rotates 360, the XY component on that vector should pass through every quadrant of a circle shouldn't it? I.e (X+,Y+) -> (X-,Y+) -> (X-,Y-) -> (X+,Y-) from
/imu/magnetic_field
Mine doesn't, it skips a whole quadrant. There is never any situation where X is +ve and Y is -ve. Unless I'm fundamentally misunderstanding something (and I may be), I'm pretty sure this is not the behaviour I should be seeing, and it must be contributing to the problem.