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

Revision history [back]

click to hide/show revision 1
initial version

Heading may depend on localization type you are using. If we talk about lidar localization then it depends on how map was built. If it was not aligned with GPS during building then zero heading depends on map (basically where your car was directed to during map collecting/building is a zero heading). /current_pose topic is a geometry_msgs::PoseStamped topic, so it store angles in quaternion, you have to convert it to degrees manually. If you are using ros it will gives you -180....180.

double yawDeg(const geometry_msgs::Quaternion &quat){
    tf::Quaternion q(
                quat.x,
                quat.y,
                quat.z,
                quat.w);
    tf::Matrix3x3 m(q);
    double roll, pitch, yaw;
    m.getRPY(roll, pitch, yaw);
    return yaw/M_PI*180.;
}
double yawDegree = yawDeg(msg->pose.orientation);

You can transform angles as you wish (0...360 or -180...180), stackoverflow has some answers. What type of localizer are you using?