Could not find custom message

asked 2019-07-07 13:21:59 -0500

pretel gravatar image

updated 2019-07-07 14:38:38 -0500

I created a custom message named linear_move and imported it like so: from bot.msg import linear_move. When I try to check if the massage exists using rosmsg show linear_move everything appears as it should. But when I try to run the python script with the imported custom message I get this ImportError: No module named bot.msg. And this error just appears when I run the program, no error during the compilation. I also made the appropriate additions to my package.xml and my CMakeList.txt, but I also included them in this question in case I did something wrong. Do you guys have any suggestion of what could be the problem?

My package.xml file:

<?xml version="1.0"?>
<package format="2">
  <name>bot</name>
  <version>0.0.0</version>
  <description>The bot package</description>

  <maintainer email="tomas@todo.todo">tomas</maintainer>

  <license>TODO</license>

  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>rospy</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>message_generation</build_depend>
  <build_export_depend>roscpp</build_export_depend>
  <build_export_depend>rospy</build_export_depend>
  <build_export_depend>std_msgs</build_export_depend>
  <exec_depend>roscpp</exec_depend>
  <exec_depend>rospy</exec_depend>
  <exec_depend>std_msgs</exec_depend>
  <exec_depend>message_runtime</exec_depend>

  </export>
</package>

My CMakeLists.txt file:

cmake_minimum_required(VERSION 2.8.3)
project(bot)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  message_generation ##add to custom messages
)

 add_message_files(
   FILES
   linear_move.msg ##custom message
 )

 generate_messages(
   DEPENDENCIES
   std_msgs
 )


catkin_package(
  INCLUDE_DIRS include
  LIBRARIES bot
  CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
  DEPENDS system_lib
)

include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

${catkin_EXPORTED_TARGETS})

${catkin_EXPORTED_TARGETS})

edit retag flag offensive close merge delete

Comments

Did you solve #q327792?

gvdhoorn gravatar image gvdhoorn  ( 2019-07-07 14:31:12 -0500 )edit
1

Please remove all the boilerplate comments from both your CMakeLists.txt as well as your package.xml.

gvdhoorn gravatar image gvdhoorn  ( 2019-07-07 14:32:00 -0500 )edit

I did not solve my previous question. The problem in occurring on a PC at my uni, so I'm just going to be able to change anything tomorrow morning.

pretel gravatar image pretel  ( 2019-07-07 14:42:34 -0500 )edit