9.3 can't catkin_make the my_custom_action_msg_pkg

I get the following error, when compiling my custom action message package:

– ==> add_subdirectory(my_custom_action_msg_pkg)
– Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
– Generating .msg files for action my_custom_action_msg_pkg/Name /home/user/catkin_ws/src/my_custom_action_msg_pkg/action/Name.action
Generating for action Name
CMake Error at /home/user/catkin_ws/build/my_custom_action_msg_pkg/cmake/my_custom_action_msg_pkg-genmsg.cmake:3 (message):
Could not find messages which
‘/home/user/catkin_ws/devel/share/my_custom_action_msg_pkg/msg/NameAction.msg’
depends on. Did you forget to specify generate_messages(DEPENDENCIES …)?

At first I though I had made a mistake, but I have simply copied the codes, supplied in the example, and the error occurs. I seems to require a /msg folder in the /build/my_custom_action_msg_pkg folder, however this confuses me.
Anyone experienced this issue, when compiling a custom action message?

My CMakeList.txt is the following (the same as in the torturial):
cmake_minimum_required(VERSION 2.8.3)
project(my_custom_action_msg_pkg)

Find catkin macros and libraries

if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)

is used, also find other catkin packages

find_package(catkin REQUIRED COMPONENTS
std_msgs
actionlib_msgs
)

Generate actions in the ‘action’ folder

add_action_files(
FILES
Name.action
)

Generate added messages and services with any dependencies listed here

generate_messages(
DEPENDENCIES
std_msgs
actionlib_msgs
)

catkin_package(
CATKIN_DEPENDS rospy
)

Specify additional locations of header files

Your package locations should be listed before other locations

include_directories(include)

include_directories(
${catkin_INCLUDE_DIRS}
)

I apologize for the bold text…

Hi @asgerdl ,

Welcome to the Community!

Could you expand your package directory completely in your IDE left panel and post a picture here.
I would like to see your folder structure of your package.

— Girish


Here you go

Hi @asgerdl

Found your problem. It is right there in error traceback / warnings.

Add generate_messages under find_package

find_package(catkin REQUIRED COMPONENTS
  rospy
  std_msgs
  actionlib_msgs
  generate_messages
 )
catkin_package(
  CATKIN_DEPENDS
  rospy
  std_msgs
  actionlib_msgs
 )

Add these to your package.xml if not added already:

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

That’s all!

Let me know if it worked!

Regards,
Girish

@asgerdl ,

Just realized something. If you have replaced your CMakeLists.txt file with the 33 lines as you have showed me in the picture you attached, chances are your package will again throw an error during compilation.

Since you replaced the entire contents of your CMakeLists.txt file, you might have to start over again by deleting the package and creating it again.

Well… let me know if that is the case!

Reagrds,
Girish

Thanks for the help!
I’ve added the script snippets you suggested, however for the find_package() the “generate_messages” cant’t be found. So I’ve tried with “message_generation” which is used for the Age.msg in Unit 4.

Unfortunately, with the added code, I still receive the same error.

@asgerdl ,

Oh, yeah! My bad! It must be message_generation and not generate_messages.

Then I guess, you need to redo the package. This time, do not replace the CMakeLists.txt file.

Let me know if it worked.

— Girish


¨
Unfortunatly it still doesn’t work.
I have tried several ways now, both with and without the added dependencies.
Have you tried to see if you are able to compile a package with a custom action message?
It seems that their might be some information missing, with regards to the messages generation…
In the -Notes- they state: * Note that you haven’t imported the std_msgs package anywhere. But you can use the messages declared there in your custom .actions.*
I have no idea what custom .actions they are referring to.

I think I have found the issue… In the tutorial they state the Name.action as:

#goal
package_where_message_is/message_type goal_var_name

#result
package_where_message_is/message_type result_var_name

#feedback
package_where_message_is/message_type feedback_var_name

Which is stupid so I replaced it with:
#goal
float32 my_goal

#result
int32 my_result

#feedback
string my_feedback

And now it works! I don’t know exactly if this was the issue, but they might want to change it in the tutorial.
They state: If you do not need one part of the message (for example, you don’t need to provide feedback), then you can leave that part empty. But you must always specify the hyphen separtors. which makes me wonder if the action msgs are neccesary to provide or if you can just leave the .action file empty with only hyphen seperators… This is all confusing, but I’m glad it worked in the end.

@asgerdl ,

OK, now I understand your issue. You just created your action message too early without actually finishing that part of the chapter. Thus you have put the package definitions instead of the message itself.

Please don’t get me wrong, there is nothing wrong with the tutorial. This was YOUR negligence. You should have read until your chapter takes you to “Exercise”.

Yes, if you have an empty goal, no feedback and no result then your action message file can simply be as below

---
---
---

But actions require some output to keep track of the action if it succeeded or not. So it is always best to have all the three: goal, result and feedback specified in the action message. You can try them out yourself to get a hang of ROS.

Trying yourself and failing is the best way to learn! That is how I finished this course!

All the best,
Girish

1 Like

So leaving the messages blank would have worked, but filling it in with a wrong script, will result in error?
I guess this makes sense, and looking at what was included in the .action, I would have probably figured it out if I had given it a second thought, even thou it wasn’t stated in the exercise.
Good to know, and thanks for the support!

Kind regards,
Asger

True.

No problem! Glad you understood. [Also I just “helped” you. Did not give you “support” as I am not a part of The Construct].

Regards,
Girish

1 Like