Having trouble reading ROS 2 bag with custom messages

24 ビュー (過去 30 日間)
Ari Schwartz
Ari Schwartz 2023 年 3 月 5 日
回答済み: Sakshay 2023 年 3 月 13 日
I used ros2genmsg to generate the custom message types, but then I run ros2bagreader, it fails. It says that it doesn't recognize one of the message types.
When I run "ros2 msg list" in matlab, the custom message does appear...
Would appreciate any help. Thanks in advance!

回答 (1 件)

Sakshay
Sakshay 2023 年 3 月 13 日
Hello Ari,
As per my understanding, after running "ros2genmsg" function, you are not able to view the custom messages that are generated using the "ros2 msg list" command.
ROS 2 custom messages are specified in ROS 2 package folders that contain a folder named "msg". The "msg" folder should contain all the custom message type definitions. Hence, you must have a ROS 2 package that contains the required "msg" file.
After ensuring that your custom message package is correct, you specify the path to the parent folder and call "ros2genmsg" with the specified path. The commands for that would look as below:
folderPath = fullfile(pwd,"<ROS2 Package Name>");
ros2genmsg(folderPath);
After running this command, make sure that the output indicates a successful build. After a successful build, you may run the "ros2 msg list" command to make sure the custom message is generated correctly.
For more information on generating custom messages from ROS2 definitions, you may refer to the following documentation:

カテゴリ

Help Center および File ExchangeSpecialized Messages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by