Ask Your Question
0

Cannot load message class for [robot_position/mymsg]. Are your messages built?

asked 2016-03-24 02:06:16 -0600

SarSam gravatar image

updated 2016-03-24 02:31:53 -0600

I correctly followed the steps as mentioned here: link text Home>assign2>src>robot_position Where robot_position is my package name. I created a directory named msg inside it and inside msg directory, I made mymsg.msg file. I wrote this inside it:

float64 x
float64 y

then I added these lines in package.xml file:

<build_depend>message_generation</build_depend>
  <run_depend>message_runtime</run_depend>

then I added message dependencies in CMakeLists.txt file as:

find_package(catkin REQUIRED COMPONENTS
  geometry_msgs
  roscpp
  rospy
  std_msgs
  message_generation
)

then I wrote message_runtime in CMakeLists.txt file as in here:

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

then I added this:

  add_message_files(
       FILES
       mymsg.msg
     )

and then this:

 generate_messages(
   DEPENDENCIES
   geometry_msgs   std_msgs
 )

and then did this: catkin_make install

Did I miss anything?

edit retag flag offensive close merge delete

Comments

Is there a mymsg.h file inside catkin_ws/devel/include/your_package_name/? If the msg is compiled properly, there should be a .h file generated in the mentioned folder.

DavidN gravatar imageDavidN ( 2016-03-24 04:09:15 -0600 )edit

Also, after compilation, you can check the msg details by

rosmsg list | grep mymsg

and

rosmsg show your_package_name/mymsg

DavidN gravatar imageDavidN ( 2016-03-24 04:10:26 -0600 )edit

Thanks for replying, Is there a mymsg.h file? Yes. After compilation, yes I can check msg details by rosmsg list | grep mymsg

but rosmsg show your_package_name/mymsg gives error: Unable to load msg [your_package_name/mymsg]: Cannot locate message [mymsg]: unknown package [your_package_name]..

SarSam gravatar imageSarSam ( 2016-03-24 04:26:35 -0600 )edit

what is the output of rosmsg list | grep mymsg? By the way, when I say 'your_package_name', I mean to use your package name (which is robot_position)

DavidN gravatar imageDavidN ( 2016-03-24 04:52:58 -0600 )edit

Sorry, I'm just a beginner.

rosmsg list | grep mymsg

gives this:

robot_position/mymsg

SarSam gravatar imageSarSam ( 2016-03-24 05:02:47 -0600 )edit

and rosmsg robot_position/mymsg gives this

rosmsg is a command-line tool for displaying information about ROS Message types......
SarSam gravatar imageSarSam ( 2016-03-24 05:05:09 -0600 )edit

It s ok. We were all beginners once :). The actual command is rosmsg show robot_position/mymsg. You can dorosmsg -h to see more options of rosmsg

DavidN gravatar imageDavidN ( 2016-03-24 05:51:30 -0600 )edit

It works fine, shows what's intended

float64 x float64 y

but I'm having problem when I echo any rostopic! and following message appears

Cannot load message class for [robot_position/mymsg]. Are your messages built?
SarSam gravatar imageSarSam ( 2016-03-24 05:55:44 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-03-24 07:03:19 -0600

SarSam gravatar image

Before echoing a rostopic, I ran this: source ~/assign2/devel/setup.bash

and then I did rostopic echo (topic-name) and it worked.

Note that: assign2 is the name of the directory where I have all my files!

edit flag offensive delete link more

Comments

1

You can add source ~/your_folder/devel/setup.bash into .bashrc permanently so that it will be sourced automatically each time you open new terminal :)

DavidN gravatar imageDavidN ( 2016-03-26 06:11:08 -0600 )edit

Thank you! Can you explain how to do that? I couldn't find .bashrc file!

SarSam gravatar imageSarSam ( 2016-03-28 12:25:34 -0600 )edit

Thank you! I entered this in terminal: gedit ~/.bashrc and it opened .bashrc file in which I put this source ~/my_folder/devel/setup.bash and saved it. It indeed is helpful and time-saving!

SarSam gravatar imageSarSam ( 2016-03-28 13:07:27 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-03-24 02:06:16 -0600

Seen: 1,174 times

Last updated: Mar 24 '16