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

Can't import OccupancyGrid.msg

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

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:

<build_depend>nav_msgs</build_depend>
<build_export_depend>nav_msgs</build_export_depend>
<exec_depend>nav_msgs</exec_depend>

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
1

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

jayess gravatar image

Try

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

Comments

Thank you! You are right!

Ageneinair gravatar image Ageneinair  ( 2019-04-15 18:48:40 -0500 )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 -0500 )edit

Question Tools

Stats

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

Seen: 724 times

Last updated: Apr 15 '19