ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org |
![]() | 1 | initial version |
I found. This is the code.
#include "ros/ros.h"
#include <gps_common/GPSFix.h>
void GPSCallback(const gps_common::GPSFix::ConstPtr& msg)
{
std::cout<<"Latitude: "<<msg->latitude<<"\t"<<"Longitude: "<<msg->longitude<<"\n";
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "listener");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("/GPSFix", 1000, GPSCallback);
ros::spin();
return 0;
}