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

problem in gpsd_client tutorials

asked 2011-02-17 15:04:30 -0600

avin111 gravatar image

updated 2011-02-17 21:20:18 -0600

Eric Perko gravatar image

Hi, My name is Avinash Thiruvayipati, a graduate student in ASU.I am trying to work out gpsd_client tutorial.the link of the tutorial is http://www.ros.org/wiki/gpsd_client/T... .

When trying to implement the tutorial it is not giving gps data.I mean according to the tutorial it should print the current gps latitude and longitude.So it is not able to subscribe to the fix message in gpsd_client.The code looks good to me.Could you please help me find where I am going wrong

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
3

answered 2011-02-17 16:51:31 -0600

Ken gravatar image

updated 2011-02-21 05:42:18 -0600

The relevant topic names and message types have been shuffled a bit since that tutorial was last updated. You'll want to replace gps_common::GPSFix with gps_common::NavSatFix (or sensor_msgs::NavSatFix if you're using Diamondback), and your #include should point to gps_common/NavSatFix.h. You'll also need to have a <depend package="gps_common"/> line in your package's manifest.xml. If you're using Cturtle, set gpsd_client's ~report_as parameter to "navsat".

#include <ros/ros.h>
// Change following lines to "gps_common" if you're using Cturtle
#include <sensor_msgs/NavSatFix.h>
#include <sensor_msgs/NavSatStatus.h>
using sensor_msgs;

void callback(const NavSatFixConstPtr &fix) {
  if (fix->status.status == NavSatStatus::STATUS_NO_FIX) {
    std::cout << "Unable to get a fix on the location." << std::endl;
    return;
  }

  std::cout << "Current Latitude: " << fix->latitude << std::endl;
  std::cout << "Current Longitude " << fix->longitude << std::endl;
}

int main(int argc, char **argv) {
  ros::init(argc, argv, "gps_subscriber");
  ros::NodeHandle nh;

  ros::Subscriber gps_sub = nh.subscribe("fix", 1, callback);

  ros::spin();
  return 0;
}
edit flag offensive delete link more

Comments

So gpsd_client has been switch to Diamondback only support? If so, perhaps this should be documented and isn't? This WikiMacro should help you out with that: http://www.ros.org/wiki/WikiMacros#Version
Eric Perko gravatar image Eric Perko  ( 2011-02-17 21:22:44 -0600 )edit
I did'nt switch to diamond back yet.I am using cturtle instead.So what are the message types in cturtle that has changed from gps_common::GPSFix.Thanks for the help.
avin111 gravatar image avin111  ( 2011-02-18 06:23:58 -0600 )edit
@avin111 Updated with Cturtle instructions to match my e-mail. @Eric Perko Thanks, I've added /cturtle and /diamondback documentation to the wiki.
Ken gravatar image Ken  ( 2011-02-21 05:44:03 -0600 )edit
1

answered 2012-01-31 06:01:32 -0600

StrongEnough gravatar image

Ken's sample code did not compile, under Electric, until I changed:

"using sensor_msgs;"

to:

using namespace sensor_msgs;

After that, thumbs-up.

edit flag offensive delete link more
-1

answered 2011-02-17 18:03:13 -0600

avin111 gravatar image

I did'nt switch to diamond back yet.I am using cturtle instead.So what are the message types in cturtle that has changed from gps_common::GPSFix.Thanks for the help.

edit flag offensive delete link more

Comments

You can comment on @Ken's answer and/or edit your question to include this new information instead of posting it as an answer (which it isn't really).
Eric Perko gravatar image Eric Perko  ( 2011-02-17 21:18:49 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2011-02-17 15:04:30 -0600

Seen: 1,154 times

Last updated: Jul 16 '13