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

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

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

SarSam gravatar image

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

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 image DavidN  ( 2016-03-24 04:09:15 -0500 )edit

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

rosmsg list | grep mymsg

and

rosmsg show your_package_name/mymsg

DavidN gravatar image DavidN  ( 2016-03-24 04:10:26 -0500 )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 image SarSam  ( 2016-03-24 04:26:35 -0500 )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 image DavidN  ( 2016-03-24 04:52:58 -0500 )edit

Sorry, I'm just a beginner.

rosmsg list | grep mymsg

gives this:

robot_position/mymsg

SarSam gravatar image SarSam  ( 2016-03-24 05:02:47 -0500 )edit

and rosmsg robot_position/mymsg gives this

rosmsg is a command-line tool for displaying information about ROS Message types......
SarSam gravatar image SarSam  ( 2016-03-24 05:05:09 -0500 )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 image DavidN  ( 2016-03-24 05:51:30 -0500 )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 image SarSam  ( 2016-03-24 05:55:44 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

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

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 image DavidN  ( 2016-03-26 06:11:08 -0500 )edit

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

SarSam gravatar image SarSam  ( 2016-03-28 12:25:34 -0500 )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 image SarSam  ( 2016-03-28 13:07:27 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 2,609 times

Last updated: Mar 24 '16