0

Rosanswers logo

I'm trying to use the nmea_msgs/Sentence message and I'm stumped on what is probably a python problem.

I've built the package and I can see the results in devel/

$ ls ~/catkin_ws/devel/lib/python2.7/dist-packages/nmea_msgs/msg
__init__.py  __init__.pyc  _Sentence.py  _Sentence.pyc

And it shows up fine with rosmsg:

$ rosmsg show nmea_msgs/Sentence
std_msgs/Header header
  uint32 seq
  time stamp
  string frame_id
string sentence

But if I source devel/setup.bash and then run ipython, and then import the module I don't actually get a proper Sentence class. For example:

In [1]: from nmea_msgs.msg import Sentence
In [2]: a = Sentence
In [3]: print a.header
<member 'header' of 'Sentence' objects>

Although there is a "header" object, it is not a "Header" object in the sense of a ROS message definition. That is, it has none of the attributes of 'stamp', 'seq' and 'frame_id' for the Header message.

I cannot figure out why.

-Val


Originally posted by vschmidt on ROS Answers with karma: 242 on 2017-08-11

Post score: 0

1 Answers1

0

Rosanswers logo

I found the problem!!!

I should have defined the message in iPython like this:

a = Sentence()

Thanks!


Originally posted by vschmidt with karma: 242 on 2017-08-11

This answer was ACCEPTED on the original site

Post score: 1