///////////////////////////////////////////////////////////////////////////////777 int main(int argc, char ** argv) { ros::init(argc, argv, "gpsd_client"); //GPSDClient2 client; GPSDClient client; if (!client.start()) { printf("client start failed!"); return -1; } while(ros::ok()) { try{ ros::spinOnce(); client.step(); }catch(Exception e) { printf(e.what()); } } client.stop(); }
int main(int argc, char ** argv) { ros::init(argc, argv, "corobot_gps"); GPSDClient client; //create an updater that will send information on the diagnostics topics diagnostic_updater::Updater updater; updater.setHardwareIDf("GPS"); updater.add("gps", &client, &GPSDClient::gps_diagnostic); //function that will be executed with updater.update() if (!client.start()) { updater.force_update(); return -1; } while(ros::ok()) { ros::spinOnce(); updater.update(); client.step(); } client.stop(); }
int main(int argc, char ** argv) { ros::init(argc, argv, "gpsd_client"); ros::NodeHandle node; ros::NodeHandle priv_node("~"); priv_node.param<std::string>("frame_id", frame_id, ""); priv_node.param<std::string>("child_frame_id", child_frame_id, ""); odom_pub = node.advertise<nav_msgs::Odometry>("odom", 10); tf::TransformBroadcaster tfBC; odom_broadcaster = &tfBC; GPSDClient client; if (!client.start()) return -1; while(ros::ok()) { ros::spinOnce(); client.step(); } client.stop(); }