ros custom messages not adding to rosmsg list

6 vues (au cours des 30 derniers jours)
Jacob Knaup
Jacob Knaup le 24 Jan 2020
Hello,
I am trying to use the ROS custom message support add-on, following the instructions. https://www.mathworks.com/help/ros/ug/ros-custom-message-support.html
I have run rosgenmsg inside my package, and it generates some files in matlab_gen that look like they contain my message structure.
E.g.
classdef carsimIn < robotics.ros.Message
%carsimIn MATLAB implementation of Carsim_private_msgs/carsimIn
% This class was automatically generated by
% robotics.ros.msg.internal.gen.MessageClassGenerator.
% Copyright 2014-2020 The MathWorks, Inc.
%#ok<*INUSD>
properties (Constant)
MessageType = 'Carsim_private_msgs/carsimIn' % The ROS message type
end
properties (Constant, Hidden)
MD5Checksum = 'e026cbb8db5eb294079d0930d0ade4d3' % The MD5 Checksum of the message definition
end
properties (Access = protected)
JavaMessage % The Java message object
end
properties (Constant, Access = protected)
StdMsgsHeaderClass = robotics.ros.msg.internal.MessageFactory.getClassForType('std_msgs/Header') % Dispatch to MATLAB class for message type std_msgs/Header
end
properties (Dependent)
Header
Sender
ThrottleCmd
SteerCmd
BrakeCmd
end
properties (Access = protected)
Cache = struct('Header', []) % The cache for fast data access
end
properties (Constant, Hidden)
PropertyList = {'BrakeCmd', 'Header', 'Sender', 'SteerCmd', 'ThrottleCmd'} % List of non-constant message properties
ROSPropertyList = {'BrakeCmd', 'header', 'sender', 'SteerCmd', 'ThrottleCmd'} % List of non-constant ROS message properties
end
methods
...
I followed the three steps, and I can see with path and javaclasspath that both the java files and the message class files are a part of my paths.
However, when I run rosmsg list, my messages are no where to be found.

Réponses (1)

Cam Salzberger
Cam Salzberger le 27 Jan 2020
Modifié(e) : Cam Salzberger le 27 Jan 2020
Hello Jacob, I have a few suggested solutions and trouble-shooting steps here.
  • Did you restart MATLAB? That is necessary to load new files from the Java path. It also refreshes the available ROS message list.
  • Also, make sure that the folder structure is correct. MATLAB won't pick up message definitions that are nested under the expected top-level -> package -> msg/srv structure. In other words, it should look like:
% +top_level_folder/ - input to rosgenmsg
% |-+package_1/
% | '-+msg/
% | '--MessageA.msg
% '-+package_2/
% |-+msg/
% | '--MessageB.msg
% '-+srv/
% '--ServiceC.srv
If neither of these work:
  • Have you tried using the messages? Try both creating an empty message and sending/receiving with publisher/subscriber.
  • Can you post the message definition? It looks pretty simple from what's autogenerated, but I want to see if they're matching.
-Cam

Catégories

En savoir plus sur Custom Message Support dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by