2 #include <sensor_msgs/NavSatFix.h> 3 #include <sensor_msgs/NavSatStatus.h> 9 #define STATUS_NO_FIX -1 11 #define STATUS_GBAS_FIX 2 13 #define COVARIANCE_TYPE_DIAGONAL_KNOWN 2 17 double d = std::stod(s)/100.0;
18 d = floor(d) + (d - floor(d))*10/6;
28 sat.header.frame_id=
"gps";
33 else if( loc.
fix ==
"1" )
41 sat.altitude = std::stod(loc.
alt);
44 sat.position_covariance[0] = std::stod(loc.
hdop);
45 sat.position_covariance[4] = std::stod(loc.
hdop);
46 sat.position_covariance[8] = 10;
54 int main(
int argc,
char **argv)
60 std::string serverName,userName,password,serverPort,serialPort;
61 nh.
param<std::string>(
"server",serverName,
"rtk.ntrip.qxwz.com");
62 nh.
param<std::string>(
"port",serverPort,
"8002");
63 nh.
param<std::string>(
"username",userName,
"user");
64 nh.
param<std::string>(
"password",password,
"password");
65 nh.
param<std::string>(
"serialPort",serialPort,
"");
69 args.
server = serverName.c_str();
71 args.
user = userName.c_str();
73 args.
nmea =
"$GNGGA,034458.00,2810.79928,N,11256.54467,E,2,12,0.64,36.0,M,-12.7,M,1.0,0773*7D";
74 args.
data =
"RTCM32_GGB";
86 if( serialPort.empty())
97 const std::string topic =
"dgps";
106 if( loc.
lat.empty() )
112 sensor_msgs::NavSatFix sat;
void ntrip_client(Args *const)
double NMEA2float(std::string s)
void publish(const boost::shared_ptr< M > &message) const
void fillSatMessage(sensor_msgs::NavSatFix &sat, Location &loc)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
boost::array< double, 9 > covariance
enum SerialProtocol protocol
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
enum SerialDatabits databits
#define COVARIANCE_TYPE_DIAGONAL_KNOWN
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
enum SerialStopbits stopbits
ROSCPP_DECL void spinOnce()
int main(int argc, char **argv)