Error cannot load message class for

I have seen the other topics about the similar error (like here http://answers.ros.org/question/10897... ), but they don't seem to fit to my problem. I am using Ubuntu 12.04 and ROS Hydro. I have a robotino_node which is publishing several things. They show up if I use rostopic list. i also can use rostopic type and rostopic info, here the robotino_node is listed as a publisher. But if I use rostopic hz or rostopic echo the error form the topic line shows up, eg Cannot load message class for [robotino_msgs/PowerReadings]. Are your messages built? rosmsg show does also work, eg [robotino_msgs/PowerReadings] time stamp float current float voltage Now interestingly if I try rostopic echo with "bumper", which is the only std_msg published by the robotino_node it shows one time data: False --- but that's it. I suspect that my cmake file for the messages is wrong, but I am not sure; it looks like this # CATKIN_MIGRATION: removed during catkin migration # cmake_minimum_required(VERSION 2.8.3) project(robotino_msgs) find_package(catkin REQUIRED COMPONENTS geometry_msgs std_msgs message_generation roscpp) include_directories(include ${catkin_INCLUDE_DIRS} ) add_message_files( FILES AnalogReadings.msg BHAReadings.msg DigitalReadings.msg EncoderReadings.msg GrapplerReadings.msg GripperState.msg MotorReadings.msg NorthStarReadings.msg PowerReadings.msg SetBHAPressures.msg SetBHAPressures.msg SetGrapplerAxes.msg SetGrapplerAxis.msg) add_service_files( FILES ResetOdometry.srv SetEncoderPosition.srv SetGripperState.srv) #add_dependencies(robotino_msgs geometry_msgs_generate_messages_cpp) #or yes? #target_link_libraries(robotino_msgs ${catkin_LIBRARIES} ) # or yes ## Generate added messages and services with any dependencies listed here generate_messages( DEPENDENCIES geometry_msgs std_msgs ) # catkin_package parameters: http://ros.org/doc/groovy/api/catkin/html/dev_guide/generated_cmake_api.html#catkin-package # TODO: fill in what other packages will need to use this package catkin_package( DEPENDS roscpp geometry_msgs std_msgs CATKIN_DEPENDS # TODO INCLUDE_DIRS # TODO include LIBRARIES # TODO ) My launch file looks like this <!-- entfernt da KinectNode nicht aktualisiert--> <!-- --> <!-- --> <!-- --> <!-- --> So even if just the std_msgs work, shouldn't at least the bumper published with ... (more)

I have seen the other topics about the similar error (like here http://answers.ros.org/question/10897… ), but they don’t seem to fit to my problem.

I am using Ubuntu 12.04 and ROS Hydro.

I have a robotino_node which is publishing several things. They show up if I use rostopic list. i also can use rostopic type and rostopic info, here the robotino_node is listed as a publisher.
But if I use rostopic hz or rostopic echo the error form the topic line shows up, eg

Cannot load message class for [robotino_msgs/PowerReadings]. Are your messages built?

rosmsg show does also work, eg

[robotino_msgs/PowerReadings]
time stamp
float current
float voltage

Now interestingly if I try rostopic echo with «bumper», which is the only std_msg published by the robotino_node it shows one time

data: False
---

but that’s it.

I suspect that my cmake file for the messages is wrong, but I am not sure; it looks like this

# CATKIN_MIGRATION: removed during catkin migration
# cmake_minimum_required(VERSION 2.8.3)
project(robotino_msgs)

find_package(catkin REQUIRED COMPONENTS geometry_msgs std_msgs message_generation roscpp)

include_directories(include
 ${catkin_INCLUDE_DIRS}
)

add_message_files(
FILES
AnalogReadings.msg
BHAReadings.msg
DigitalReadings.msg
EncoderReadings.msg
GrapplerReadings.msg
GripperState.msg
MotorReadings.msg
NorthStarReadings.msg
PowerReadings.msg
SetBHAPressures.msg
SetBHAPressures.msg
SetGrapplerAxes.msg
SetGrapplerAxis.msg)

add_service_files(
FILES
ResetOdometry.srv
SetEncoderPosition.srv
SetGripperState.srv)

#add_dependencies(robotino_msgs geometry_msgs_generate_messages_cpp) #or yes?
#target_link_libraries(robotino_msgs  ${catkin_LIBRARIES} ) # or yes
## Generate added messages and services with any dependencies listed here
generate_messages(
   DEPENDENCIES geometry_msgs std_msgs
)

# catkin_package parameters: http://ros.org/doc/groovy/api/catkin/html/dev_guide/generated_cmake_api.html#catkin-package
# TODO: fill in what other packages will need to use this package
catkin_package(
   DEPENDS roscpp geometry_msgs std_msgs
   CATKIN_DEPENDS # TODO
   INCLUDE_DIRS # TODO include
   LIBRARIES # TODO
)

My launch file looks like this

    <launch>
      <arg name="hostname" default="172.26.1.1" />

        <node name="robotino_node" pkg="robotino_node" type="robotino_node" output="screen">
            <param name="hostname" value="$(arg hostname)" />
            <param name="max_linear_vel" value="0.5" />
            <param name="min_linear_vel" value="0.05" />
            <param name="max_angular_vel" value="3.0" />
            <param name="min_angular_vel" value="0.1" />
    <!--        <param name="downsample_kinect" value="true" />
            <param name="leaf_size_kinect" value="0.04" />  entfernt da KinectNode nicht aktualisiert-->
            <remap from="robotino_joint_states" to="joint_states" />
            <!--remap from="image_raw" to="image"/-->
        </node>

    <!--
      <node name="robotino_odometry_node" pkg="robotino_node" type="robotino_odometry_node" output="screen">
        <param name="hostname" value="$(arg hostname)" />
      </node>
    -->
    <!--
      <node name="robotino_laserrangefinder_node" pkg="robotino_node" type="robotino_laserrangefinder_node" output="screen">
        <param name="hostname" value="$(arg hostname)" />
        <param name="laserRangeFinderNumber" value="0" />
      </node>
    -->

    <!--
      <node name="robotino_camera_node" pkg="robotino_node" type="robotino_camera_node" output="screen">
        <param name="hostname" value="$(arg hostname)" />
        <param name="cameraNumber" value="0" />
      </node>
    -->

        <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher" output="screen">
            <param name="publish_frequency" type="double" value="20.0" />
        </node>

    <!--
      <node name="robotino_mapping_node" pkg="robotino_node" type="robotino_mapping_node" output="screen">
        <param name="hostname" value="$(arg hostname)" />
      </node>

-->

    <!--node pkg="tf" type="static_transform_publisher" name="laser_link_broadcaster" args="0.12 0 0.025 0 0 0 base_link laser_link 50" /-->

    <param name="robot_description" textfile="$(find robotino_description)/urdf/robotino.urdf" />
</launch>

So even if just the std_msgs work, shouldn’t at least the bumper published with … (more)

3 Answers

I know this is very late, but I just encountered the exact same problem. My problem originated from not having the .msg file added in my CMake file when I built. Here is how I resolved it:

First, ensure the file has been added to the CMakeLists.txt (yours already has)

Second, clean your build by running «catkin_make clean» in the root of your workspace.

Third, remake your project with «catkin_make»

Lastly, resource the devel/setup.bash in your workspace.

I know this is not a great answer, but I encountered the exact same problem where rosmsg could find my message, but rostopic could not, and these are the exact steps I took that resolved it.

Please Check your ROS_PACKAE_PATH. Make sure you run rostopic echo on your workspace executing terminal. Try following,

  1. roscd or cd ~/catkin_ws
  2. source devel/setup.bash
  3. rostopic echo /topic

Source source devel/setup.bash from your Catkin workspace.

Other answer mentions this among many other things to look at, but really this is the only thing you need to do if your packages run and communicate and only rostopic is a problem.

Your Answer

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

Question Tools

2 followers

Related questions

When I play mkz_20151207.bag and try to echo topic /can_bus_dbw/can_rx I get the error:

ERROR: Cannot load message class for [dataspeed_can_msgs/CanMessageStamped]. Are your messages built?

Upon further investigation, I found can_msgs_migration.md in dataspeed_can which says that frame format is obsolete in favor of can_msgs/Frame and that I can convert an old bag with ‘rosbag fix old.bag new.bag’. But, when I run rosbag fix mkz_20151207.bag mkz_20151207_fixed.bag’, I get this error message:

Bag could not be migrated. The following migrations could not be performed:
* From: dataspeed_can_msgs/CanMessageStamped [33747cb98e223cafb806d7e94cb4071f]
To: Unknown
1 rules missing:
* From: dataspeed_can_msgs/CanMessageStamped [33747cb98e223cafb806d7e94cb4071f]
To: Unknown
Try running ‘rosbag check’ to create the necessary rule files or run ‘rosbag fix’ with the ‘—force’ option.

Running ‘rosbag check mkz_20151207.bag’ produces:

The following migrations need to occur:
* From: dataspeed_can_msgs/CanMessageStamped [33747cb98e223cafb806d7e94cb4071f]
To: Unknown
1 rules missing:
* From: dataspeed_can_msgs/CanMessageStamped [33747cb98e223cafb806d7e94cb4071f]
To: Unknown

To generate rules, please run with -g <rulefile>

I don’t know how to provide this rule and can_msgs_migration.md seems to imply it should just be available as part of the package. Plus, «Unknown» seems like the wrong target any way.

How can I successfully play back the ROS bags provided in dbw_mkz_ros? (Or any example ROS bag; I’m just trying to produce example output prior to connecting to our actual hardware)

Hi all,

I apologize in advance if this is a real ROS beginner’s question…

I believe I’ve properly configured a remote machine to use the Euclid as ROS master. I can ‘rostopic list’ just fine, and I can ‘rostopic echo’ topics that have generic messages.

For example:

— ‘rostopic echo /rosout’ works fine.

— running ‘rostopic pub /test_topic std_msgs/Bool true’ on the Euclid, and

‘rostopic echo /test_topic’ on the remote machine also works fine.

What I can’t echo are any of the Euclid specific topics:

/cpu_info /hardware_status /nodes_status /usb_status /wifi_status

jay@Jay-MacBookPro:~$ rostopic echo /cpu_info

ERROR: Cannot load message class for [system_monitor/CpuStatus]. Are your messages built?

jay@Jay-MacBookPro:~$ rostopic echo /nodes_status

ERROR: Cannot load message class for [configuration_node/NodesStatus]. Are your messages built?

jay@Jay-MacBookPro:~$ rostopic echo /usb_status

ERROR: Cannot load message class for [system_monitor/USBStatus]. Are your messages built?

jay@Jay-MacBookPro:~$ rostopic echo /wifi_status

ERROR: Cannot load message class for [system_monitor/WifiStatus]. Are your messages built?

Digging around online seems to point to these messages types not being published properly (?). Or, maybe I still don’t have something configured properly between the two machines?

I’m sure someone will know right away what I’m doing wrong… Any help would be appreciated :-)

Thanks,

Jay

You would still import it the same way as any other message: from tello_driver.msg import TelloStatus.msg. The important part is you must have the correct environment sourced; this is the purpose of source <install_dir/setup.bash>. Make sure you source whatever install directory the build files are in. As a note, you should never try to add files in src/ to be used at runtime this is what install or devel is for.

Editing based on your comment:

There’s a few things to make sure happen here. First in the package tello_driver make sure the message files are actually set to build in CMakeLists.txt. Make sure it includes lines to add message files

add_message_files(
  FILES
  TelloStatus.msg
)

then make sure messages are being built

generate_messages(
  DEPENDENCIES
  std_msgs
)

Also make sure the package.xml has the dependencies to build messages by adding(if it’s not already there)

<build_depend>message_generation</build_depend>
<exec_depend>message_runtime</exec_depend>

Finally before building again make sure to clean your workspace with catkin_make clean then rebuild with catkin_make. After doing that and sourcing devel/setup.bash you can verify the message exists via rosmsg show TelloStatus

Понравилась статья? Поделить с друзьями:
  • Error cannot install in homebrew on arm processor in intel default prefix usr local
  • Error cannot initialize plugins directory
  • Error cannot initialize object parameter of type qwidget with an expression of type mainwindow
  • Error cannot initialize library solidworks при активации
  • Error cannot initialize gfx