Having trouble building custom ROS msgs in MATLAB 2020a

7 views (last 30 days)
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

Accepted Answer

Cam Salzberger
Cam Salzberger on 24 Jun 2020
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
  7 Comments
Cam Salzberger
Cam Salzberger on 23 Nov 2020
In R2020b, the ability to generate custom messages has been added to ROS Toolbox, so there is no need for the support package. The version of messages that ships with ROS Toolbox has also changed - in R2020b, the ROS Melodic definitions are used. There is no longer any need to update the Java class path after generating custom messages, though the "addpath" call is still required to update the MATLAB search path. Like discussed above, all custom message package folders should be under one parent folder, which is provided to rosgenmsg.
Instead of the support package, R2020b requires Python 2.7, CMake, and a supported compiler installed on your system. See here for more details.
To update the built-in message definitions, you can just use rosgenmsg like any other custom message package.
-Cam

Sign in to comment.

More Answers (2)

Jiyo Palatti
Jiyo Palatti on 10 Jul 2020
Hi Cam,
The fix you mentioned above has fixed the issue. I moved both of the msgs folder to the same parent directory and msg generation is working.
I was under the impression that once the custom ROS msgs are generated and added to the path (java & matlab), it will be used for future custom ROS msg generation.
Thanks for your help.
  1 Comment
Cam Salzberger
Cam Salzberger on 13 Jul 2020
Hey Jiyo,
I'm glad to hear that resolved the issue. I am not completely sure about the intracacies of rosjava message library generation, but if it is anything like standard catkin and colcon then there is a different rule for message dependencies. Packages that depend on other packages need to all be built in the same build command, or otherwise added to the library path through back-end variables. The library path update can be done for the built-in messages shipping with MATLAB, but any other custom messages with dependencies need to all be together.
It's really just easier to put all custom message packages in the same location to prevent issues like this.
-Cam

Sign in to comment.


Julius Sustarevas
Julius Sustarevas on 24 Oct 2020
Thanks for this, I was able to update visualiation msgs to melodic and send to rviz.
I'd like to submit a feature request for this process to be easier. The different jar files for full ros-desktop-intstall messages could ship with matlab for hydro,indigo,kinetic,melodic. etc. Some type of automatic reloading of different jar files for kinetic, melodic msg definitions.
btw std_msgs do not buil at all using this procedure(I think its the known Header bug)

Categories

Find more on Custom Message Support in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!