So, the two major conventions for GPS is NED (North-East-Down) and ENU (East-North-Up). Both of these are right-handed. NED is commonly used in aerial vehicles, where everything of interest is below, and ENU is commonly used in ground-based vehicles, where altitude is of interest.
Heading is represented in the NED coordinate system. This means that your heading, Phi, is 0 in the North direction, and is positive in the East direction, the same as a compass heading.
ROS works better following the ENU convention, as it more closely matches the body coordinate frame (X-forward,Y-left,Z-up).
Basically, you probably want to choose a convention for your work, and rotate the course over ground heading into your chosen coordinate frame. Looking at the datasheet for your receiver, it looks like course over ground is given as a compass heading (ENU) from True north, or Magnetic north, whichever you choose to use.
To get this into NED coordinates, you need to rotate the ENU coordinate frame. This can be accomplished using quaternions, rotation matricies, etc.
Assuming that your heading is represented in Radians, with North = 0, Pi to -Pi
- Subtract pi/2 from your heading (phi -= pi/2)
- Negate your heading (phi = -phi)
- Check the wrap on your heading (re-wrap to Pi to -Pi)
I'm not sure if a checkwrap function exists in ROS's geometry libraries, but you can get an example from Our EKF Functions, where we had to deal with the same problem.
Originally posted by mjcarroll with karma: 6414 on 2011-05-16
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by mjcarroll on 2011-05-18:
We just did exactly that, but without the GPS heading. Here is our MATLAB implementation: https://github.com/mjcarroll/mech7710-final
Comment by Jurica on 2011-05-17:
So if I want true heading of robot i must add track+90°(or -(270-track) gives same result) , and i finnaly have same odometry frame in right angle towards global GPS (UTM) frame.(I plot odometryin utm and GPS x,y in utm and they match, so i think that is good).
Comment by Jurica on 2011-05-17:
I think i will use ENU system so track angle which GPs gives(fix topic) is angle which shows how far from north y-axis is rotated in right direction. Robot (P3AT) heading is 0° and turns about x-axes(what ROS gives is negative angluar velocity so turns in clockwise direction).
Comment by Jurica on 2011-05-17:
I plan to use gps track angle for fusion with odometry heading, so i use odometry + GPS in EKF and i plan to fuse measurements form GPSn like x,y(in utm system) and gps track angle and speed which GPS gives(SOG). First realization in Matlab and then i hope so in ROS.
Comment by mjcarroll on 2011-05-17:
We recently ran into the same issue on our project. I would say that ENU seems to work "better" with the ROS body-frame coordinate conventions.
Comment by Jurica on 2011-05-16:
Thx for yours answer. Yes it seems that headins is in NED convention, so i must choose which i will be using, and then convert one coordinate system to another.