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

custom msg throwing this error

asked 2018-04-29 06:51:32 -0500

alejandro gravatar image

updated 2018-04-29 21:48:34 -0500

jayess gravatar image

I´ve followed this tutorial about creating a custom msg: http://wiki.ros.org/msg , but instead of having strings as the content of my message file ( Num.msg) i wanted my message to have this content:

std_msgs/Header header

...

uint8[] data
sensor_msgs/Image

But I´m getting this error when compiling it:

The dependencies of the message/service 'rqt_bag/Num' have changed. Please rerun cmake.
rqt_bag/CMakeFiles/_rqt_bag_generate_messages_check_deps_Num.dir/build.make:57:recipe for target 'rqt_bag/CMakeFiles/_rqt_bag_generate_messages_check_deps_Num'' failed
make[2]: * [rqt_bag/CMakeFiles/_rqt_bag_generate_messages_check_deps_Num] Error 1
CMakeFiles/MakeFiles2:858: recipe for target 'rqt_bag/CMakeFiles/_rqt_bag_generate_messages_check_deps_Num.dir/all' failed
make[1]: [rqt_bag/CMakeFiles/_rqt_bag_generate_messages_check_deps_Num.dir/all] Error 2 Makefile: 138: recipe for target 'all' failed make: ** [all] Error 2
Invoking "make -j1 -l1" failed

As i said before I´ve followed the tutorial, so i have modified the CMakeFile.txt and the package.xml as it is said in the tutorial adding those new fields. However if my message file have just "strings", for example, "string first_name", it all works.

Here is my CMakeFile.txt:

cmake_minimum_required(VERSION 2.8.3)
project(rqt_bag)

find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
message_generation
)

add_message_files(
FILES
Num.msg
)

generate_messages(
DEPENDENCIES
std_msgs
)

catkin_package(
CATKIN_DEPENDS message_runtime
)

include_directories(
${catkin_INCLUDE_DIRS}
)

${catkin_EXPORTED_TARGETS})

install(FILES plugin.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

install(DIRECTORY launch resource
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)

install(PROGRAMS scripts/rqt_bag
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

Why????? Thank you so much in advanced.

edit retag flag offensive close merge delete

Comments

Can you paste your CMakeFile.txt? I suspect the dependencty on std_msgs is probably not present.

robotchicken gravatar image robotchicken  ( 2018-04-29 12:10:50 -0500 )edit

Forgot to mention earlier, can you try a catkin_make clean and then a catkin_make?

robotchicken gravatar image robotchicken  ( 2018-04-29 12:27:29 -0500 )edit

Thats my CMakeFile.txt. What I actually want to do is to save in a bag file a message like sensor_msgs/Image apart from other parameters. So I´ve copied the content of sensor_msgs/Image into Num.msg to try to imitate the behaviour as I can´t modify the image.msg one.

alejandro gravatar image alejandro  ( 2018-04-29 12:28:38 -0500 )edit

Sorry but I had forgotten one line in my Num.msg which is the last one: sensor_msgs/Image

alejandro gravatar image alejandro  ( 2018-04-29 13:13:45 -0500 )edit

1 Answer

Sort by » oldest newest most voted
5

answered 2018-04-29 17:32:23 -0500

If your custom message type includes sensor_msgs/image then you'll need to add a dependency on sensor_msgs as well as std_msgs for this to build successfully.

Hope this helps.

edit flag offensive delete link more

Comments

Thats what I needed, thank u

alejandro gravatar image alejandro  ( 2018-04-29 17:34:17 -0500 )edit

@alejandro if this answered your question, then please mark it as correct by clicking on the check mark.

jayess gravatar image jayess  ( 2018-04-29 21:49:27 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2018-04-29 06:51:32 -0500

Seen: 1,356 times

Last updated: Apr 29 '18