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

Messages aren't built

asked 2019-02-18 10:53:16 -0600

Jägermeister gravatar image

updated 2019-02-18 11:11:13 -0600

I've downloaded a ROS package and I would like to use its messages in my program, however, for some weird reason the messages aren't built and thus I get an error.

My package.xml has this:

<exec_depend>nerian_stereo</exec_depend>

my CMakeLists.txt has this:

find_package(catkin REQUIRED COMPONENTS
  rospy
  message_runtime
  std_msgs
  nerian_stereo
)

and my code file has this:

from nerian_stereo import * 
self.camera_info = rospy.Subscriber("/nerian_stereo/stereo_camera_info", StereoCameraInfo ,self.stereo_camera_cb)

however I still get this annoying error of:

NameError: global name 'StereoCameraInfo' is not defined

What's wrong? I also observed my catkin_make and I see that this package is not built at all, the output does not show its name. Is there yet another file which needs to be edited?

EDIT: Here is the message: http://docs.ros.org/api/nerian_stereo...

edit retag flag offensive close merge delete

Comments

Can you locate your package with rospack find ?

kosmastsk gravatar image kosmastsk  ( 2019-02-18 10:55:24 -0600 )edit

Yes, it returns /opt/ros/melodic/share/nerian_stereo.

Jägermeister gravatar image Jägermeister  ( 2019-02-18 10:57:13 -0600 )edit

Did you source your workspace first? When you are at ~/catkin_ws, try to source devel/setup.bash and then catkin_make

kosmastsk gravatar image kosmastsk  ( 2019-02-18 11:05:20 -0600 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-02-18 11:07:08 -0600

gvdhoorn gravatar image

updated 2019-02-18 11:18:06 -0600

Afaik importing msgs in Python would follow the pattern:

from pkg_name.msg import SomeMsg

In your case you'd probably have to adapt your import line to use that pattern, or spec msg.StereoCameraInfo in your rospy.Subscriber(..) line.

edit flag offensive delete link more

Comments

Now it did work, yes. It was from nerian_stereo.msg import StereoCameraInfo . If you add it as answer I can accept.

Jägermeister gravatar image Jägermeister  ( 2019-02-18 11:13:37 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2019-02-18 10:53:16 -0600

Seen: 225 times

Last updated: Feb 18 '19