0
$\begingroup$

Rosanswers logo

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.


Originally posted by alejandro on ROS Answers with karma: 3 on 2018-04-29

Post score: 0


Original comments

Comment by robotchicken on 2018-04-29:
Can you paste your CMakeFile.txt? I suspect the dependencty on std_msgs is probably not present.

Comment by robotchicken on 2018-04-29:
Forgot to mention earlier, can you try a catkin_make clean and then a catkin_make?

Comment by alejandro on 2018-04-29:
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.

Comment by alejandro on 2018-04-29:
Sorry but I had forgotten one line in my Num.msg which is the last one: sensor_msgs/Image

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by PeteBlackerThe3rd with karma: 9529 on 2018-04-29

This answer was ACCEPTED on the original site

Post score: 5


Original comments

Comment by alejandro on 2018-04-29:
Thats what I needed, thank u

Comment by jayess on 2018-04-29:
@alejandro if this answered your question, then please mark it as correct by clicking on the check mark.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.