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

add a std_msg Header to my custom msg

asked 2020-02-13 00:47:44 -0600

Aviad gravatar image

updated 2020-02-13 02:44:37 -0600

gvdhoorn gravatar image

Hello everyone,

I am trying to add an Header to my custom msg, but what I run catkin_make install there is an error. In my CMakeLists.txt std_msgs was declare perfectly. my .msg file is like that:

std_msgs/Header header
int8 pedal_position
float64 steering_angle
bool pto_state
bool emergency_stop

without the first line it is working perfect. I tried to write only Header header and it doesn't work too. I know that I can write by myself these variables but I want to know How to do this like this.


Edit: error message:

[  0%] Built target std_msgs_generate_messages_cpp
[  0%] Built target std_msgs_generate_messages_py
[  0%] Built target std_msgs_generate_messages_nodejs
[  0%] Built target std_msgs_generate_messages_eus
[  0%] Built target sensor_msgs_generate_messages_lisp
[  0%] Built target std_msgs_generate_messages_lisp
The dependencies of the message/service 'send_data/datarx' have changed. Please rerun cmake.
send_data/CMakeFiles/_send_data_generate_messages_check_deps_datarx.dir/build.make:57: recipe for target 'send_data/CMakeFiles/_send_data_generate_messages_check_deps_datarx' failed
make[2]: *** [send_data/CMakeFiles/_send_data_generate_messages_check_deps_datarx] Error 1
CMakeFiles/Makefile2:1714: recipe for target 'send_data/CMakeFiles/_send_data_generate_messages_check_deps_datarx.dir/all' failed
make[1]: *** [send_data/CMakeFiles/_send_data_generate_messages_check_deps_datarx.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  0%] Built target sensor_msgs_generate_messages_nodejs
[  0%] Built target sensor_msgs_generate_messages_eus
[  0%] Built target sensor_msgs_generate_messages_cpp
[  0%] Built target _send_data_generate_messages_check_deps_datatx
[  0%] Built target sensor_msgs_generate_messages_py
[  0%] Built target _realsense2_camera_generate_messages_check_deps_Extrinsics
[  0%] Built target _realsense2_camera_generate_messages_check_deps_IMUInfo
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make install -j8 -l8" failed
edit retag flag offensive close merge delete

Comments

1

there is an error.

Can you edit your question to show the error please ?

Delb gravatar image Delb  ( 2020-02-13 01:34:29 -0600 )edit

Please show your complete CMakeLists.txt. And please delete the build and devel folders from your workspace and try rebuilding. Just to make sure there are no corrupt/unexpected files or caches somewhere.

gvdhoorn gravatar image gvdhoorn  ( 2020-02-13 02:45:52 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-02-13 02:11:22 -0600

How, you are dealing with your CmakeLists.txt ?

you should have fields below, in order to create header file of your custom message

find_package(catkin REQUIRED COMPONENTS
  message_generation
  std_msgs
)

add_message_files(
  FILES
  YourCustomMessage.msg
)

generate_messages(
  DEPENDENCIES
  std_msgs
)

catkin_package(
  CATKIN_DEPENDS message_runtime std_msgs
)

in your package.xml you need to depend on correct packages;

  <build_depend>message_generation</build_depend>
  <exec_depend>message_runtime</exec_depend>
  <depend>std_msgs</depend>

and finally, your .msg file should be under msg folder in the project root directory

edit flag offensive delete link more

Comments

except this catkin_package( CATKIN_DEPENDS message_runtime std_msgs ) everything was declared in CMakeLists.txt. The .msg file without this std_msgs/Header is working well like I said. Now,I added this std_msgs to catkin_package.... and it is still not working.

Aviad gravatar image Aviad  ( 2020-02-13 02:36:12 -0600 )edit
0

answered 2020-02-13 03:15:46 -0600

Aviad gravatar image

It is working. Thanks.

I think that I simply add std_msgs to catking package(.... inside the CMakeLists.txt. I think that catkin_make install worked only after I did catkin_make first.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2020-02-13 00:47:44 -0600

Seen: 3,398 times

Last updated: Feb 13 '20