MATLAB Answers

Generating ROS Custom Action Service Messages in R2021a

7 views (last 30 days)
Wesley Au
Wesley Au on 17 Mar 2021
Edited: Cam Salzberger on 1 Sep 2021
My project has a custom message structure for an action service that needs compiling in MATLAB. This works perfectly fine in R2020a using the ROS Custom Message toolbox.
Now I understand R2020b+ has changed things around. I'm currently using R2021a, and with the new version all my custom messages and service messages compile completely fine except custom action service messages. They're basically ignored so I'm unable to create a client to my action service due to the missing custom messages. All other messages seem to work fine.
Has anyone else had this issue? Do I need to make any modifications to my CMakeLists.txt to get the new rosgenmsg() to work? My .action files are in the "action" folder, in the same level as "msg" and "srv" folders.
Here's an excerpt of my CMakeLists.txt in case someone can point out missing dependencies for action servers (snipped irrelevant parts).
cmake_minimum_required(VERSION 3.0.2)
add_compile_options(-std=c++11)
project( ... )
find_package(catkin REQUIRED COMPONENTS
message_generation
roscpp
rospy
std_msgs
geometry_msgs
actionlib_msgs
actionlib
)
find_package(Boost REQUIRED COMPONENTS system)
add_action_files(
FILES
PlanExecute.action
)
generate_messages(
DEPENDENCIES
std_msgs
geometry_msgs
actionlib_msgs
)
catkin_package(
CATKIN_DEPENDS message_runtime actionlib_msgs
DEPENDS Boost
)

Accepted Answer

Cam Salzberger
Cam Salzberger on 17 Mar 2021
Edited: Cam Salzberger on 1 Sep 2021
Hello Wesley,
In R2020a and before, custom actions were not officially supported for ROS Toolbox. It's noted in the documentation here:
"ROS actions are not currently supported and will be ignored during the custom message generation."
Unofficially, it seems that actions worked to a certain extent if the package files were created correctly. In R2020b and R2021a, only officially-supported features were included when the custom message workflow was revamped.
Custom actions are available in R2021b.
As an FYI, in R2020b+, there is no need to use a package.xml or CMakeLists.txt file for the custom message folder. Those files are ignored, as MATLAB generates its own based on the dependencies specified within the message definitions.
-Cam
  2 Comments
Cam Salzberger
Cam Salzberger on 1 Sep 2021
This functionality is availabe in R2021b, which is currently in pre-release state. If you have a license to get the pre-release, you can use it now. Otherwise, it will be available when 21b is fully released.
I've updated my answer accordingly.

Sign in to comment.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!