MATLAB: Having trouble building custom ROS msgs in MATLAB 2020a

carlacustom messagegeometry_msgsrosros melodicROS Toolbox

Hi,
I am having trouble building custom ROS msgs and adding them to availabe msg definitions in MATLAB.
I am getting the follwing error.
Building custom message files for the following packages:
carla_common
carla_msgs
carla_ros_bridge
:rosjava_messages is spawning subprojects: [carla_common, carla_msgs, carla_ros_bridge]
Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties.
Deprecated dynamic property: "mavenRepository" on "org.ros.gradle_plugins.RosPluginExtension_Decorated@6aef4eb8", value: "".
Deprecated dynamic property "mavenRepository" created in multiple locations.
:carla_common:bugfixtask
:carla_common:generateSources
:carla_common:compileJava UP-TO-DATE
:carla_common:processResources UP-TO-DATE
:carla_common:classes UP-TO-DATE
:carla_common:jar
:carla_common:assemble
:carla_common:compileTestJava UP-TO-DATE
:carla_common:processTestResources UP-TO-DATE
:carla_common:testClasses UP-TO-DATE
:carla_common:test UP-TO-DATE
:carla_common:check UP-TO-DATE
:carla_common:build
:carla_msgs:bugfixtask
:carla_msgs:generateSources
:carla_msgs:compileJavawarning: [options] bootstrap class path not set in conjunction with -source 1.6
/home/jiyo/workspace/autonomous-overtaking/autonomous-overtaking/matlab_gen/build/rosjava_build/carla_msgs/build/generated-src/carla_msgs/CarlaEgoVehicleStatus.java:12: error: cannot find symbol
geometry_msgs.Accel getAcceleration();
^
symbol: class Accel
location: package geometry_msgs
/home/jiyo/workspace/autonomous-overtaking/autonomous-overtaking/matlab_gen/build/rosjava_build/carla_msgs/build/generated-src/carla_msgs/CarlaEgoVehicleStatus.java:13: error: cannot find symbol
void setAcceleration(geometry_msgs.Accel value);
^
symbol: class Accel
location: package geometry_msgs
2 errors
1 warning
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':carla_msgs:compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.958 secs
An error occurred while building custom messages. See the full error message above.
Possible reasons for the error:
1. The msg or srv files may have syntax errors.
2. The dependencies on other message packages may not be declared correctly in the build_depends tags in the package.xml.
3. Messages packages declared as dependencies may not be available.
4. The custom message packages may be missing a build dependency on "message_generation".
See the ROS Custom Messages documentation for more information.
I figured that the geometry_msgs available in MATLAB are old and don't contain new definitons, therefore I built the geometry_msgs alone forst and added it to the MATLAB. I am able to see them in the rosmsg list
geometry_msgs/Accel
geometry_msgs/AccelStamped
geometry_msgs/AccelWithCovariance
geometry_msgs/AccelWithCovarianceStamped
geometry_msgs/Inertia
geometry_msgs/InertiaStamped
geometry_msgs/Point
geometry_msgs/Point
geometry_msgs/Point32
geometry_msgs/Point32
geometry_msgs/PointStamped
geometry_msgs/PointStamped
geometry_msgs/Polygon
geometry_msgs/Polygon
geometry_msgs/PolygonStamped
geometry_msgs/PolygonStamped
geometry_msgs/Pose
geometry_msgs/Pose
geometry_msgs/Pose2D
geometry_msgs/Pose2D
geometry_msgs/PoseArray
geometry_msgs/PoseArray
geometry_msgs/PoseStamped
geometry_msgs/PoseStamped
geometry_msgs/PoseWithCovariance
geometry_msgs/PoseWithCovariance
geometry_msgs/PoseWithCovarianceStamped
geometry_msgs/PoseWithCovarianceStamped
geometry_msgs/Quaternion
geometry_msgs/Quaternion
geometry_msgs/QuaternionStamped
geometry_msgs/QuaternionStamped
geometry_msgs/Transform
geometry_msgs/Transform
geometry_msgs/TransformStamped
geometry_msgs/TransformStamped
geometry_msgs/Twist
geometry_msgs/Twist
geometry_msgs/TwistStamped
geometry_msgs/TwistStamped
geometry_msgs/TwistWithCovariance
geometry_msgs/TwistWithCovariance
geometry_msgs/TwistWithCovarianceStamped
geometry_msgs/TwistWithCovarianceStamped
geometry_msgs/Vector3
geometry_msgs/Vector3
geometry_msgs/Vector3Stamped
geometry_msgs/Vector3Stamped
geometry_msgs/Wrench
geometry_msgs/Wrench
geometry_msgs/WrenchStamped
geometry_msgs/WrenchStamped
I am still getting the error when building. Please let me know what I am doing wrong

Best Answer

Hello Jiyo,
Seeing each of the geometry_msgs show up twice is rosmsg list is indicative of an issue, not the building of it working. If you need to override existing message definitions, there is a different procedure to follow. Please see these steps for details.
Alternatively, you may be able to just add the new geometry_msgs messages that were missing (e.g. Accel), if it is acceptable to keep the old definitions for the existing messages.
-Cam