Custom ROS messages in Matlab - AD-EYE/AD-EYE_Core GitHub Wiki

Installing the Matlab add-on

Install the add-on ROS Toolbox interface for ROS Custom Messages in Matlab. That add-on enables the creation of custom ROS messages in Matlab.

Creating the message package

The package containing the messages needs to be created with the same folder name as the name present in package.xml. See adeye_msgs as an example.

The package.xml file must contain:

<buildtool_depend>catkin</buildtool_depend>
<build_depend>message_generation</build_depend>
<run_depend>message_runtime</run_depend>

With eventually, based on the message dependencies:

<build_depend>std_msgs</build_depend>
<build_depend>geometry_msgs</build_depend>

Generating the Matlab representations of the messages

Use the commands rosgenmsg('path_to_msg_package') where path_to_msg_package is the path to the folder one level above the message package (C:\Users\adeye\AD-EYE_Core\AD-EYE\ROS_Packages\src in our case).

Setting up Matlab to find the generated messages

Then add the generated folder to the Matlab path:

addpath('C:\Users\adeye\AD-EYE_Core\AD-EYE\ROS_Packages\src\matlab_gen\msggen')
savepath

Add the jar files to the java path:

cd(prefdir)
edit('javaclasspath.txt')

And add the path to the jar file representing the message (C:\Users\adeye\AD-EYE_Core\AD-EYE\ROS_Packages\src\matlab_gen\jar\adeye_msgs-0.0.1.jar for adeye_msgs)

Source: https://se.mathworks.com/matlabcentral/answers/634969-why-do-i-get-the-error-cannot-find-a-matlab-message-class-for-type-package-type-for-my-custom

⚠️ **GitHub.com Fallback** ⚠️