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

Can't import OccupancyGrid.msg

asked 2019-04-15 15:49:28 -0600

Ageneinair gravatar image

I try to read /map message which is published by 'slam_gmapping' How I import in my code:

from OccupancyGrid.msg import data

and in my package.xml, I added:


my CMakeLists.txt, I added:

find_package(catkin REQUIRED COMPONENTS roscpp rospy nav_msgs)

However, when I run my code, it showed:

ImportError: No module named OccupancyGrid.msg

Where am I wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-04-15 18:23:00 -0600

jayess gravatar image


from nav_msgs.msg import OccupancyGrid

You need to do an import using the following pattern

from <package_name>.<directory_name> import <message_name>
edit flag offensive delete link more


Thank you! You are right!

Ageneinair gravatar image Ageneinair  ( 2019-04-15 18:48:40 -0600 )edit

Could you please click on the check mark next to the answer to mark it as correct?

jayess gravatar image jayess  ( 2019-04-15 19:02:34 -0600 )edit

Question Tools


Asked: 2019-04-15 15:49:28 -0600

Seen: 650 times

Last updated: Apr 15 '19