How to use rosgenmsg when package.xml file is in different directory and msg directory is in different directory?

8 views (last 30 days)
I'm using ROS Kinetic and MATLAB R2018b on Ubuntu 16.04.5.
Now, I want to use MATLAB for the localization of TurtleBot3 but as MATLAB R2018b does not support ROS Kinetic, I'm getting md5sum error.
For that, I found out that, I have to create custom ROS messages using rosgenmsg(folder_path) command in MATLAB.
But in that, what about folder_path? Because in case of TurtleBot3, msg folder is in completely directoy/package; package.xml is also in different directory/package. So, what should I do now?
Please help!
Thanks a lot in advance!

Answers (2)

Cam Salzberger
Cam Salzberger on 26 Apr 2019
Hello Milan,
If you check out the example workflow and packages that are used in the custom message example here, you can see that the path passed to rosgenmsg is to the folder containing the message package folders. In other words, the example looks like this:
custom_msgs/
├── A/
├── msg/
└── DependsOnB.msg
└── package.xml
├── B/
├── msg/
└── Standalone.msg
└── package.xml
└── C/
├── msg/
└── DependsOnB.msg
└── package.xml
In this case, "A", "B", and "C" are your package folders. You would provide the path to the "custom_msgs" folder to rosgenmsg.
Since you are looking into regenerating all built-in messages, you can find more detailed instructions on this answer. The most important folder to regenerate would be the common_msgs folder, which contains most of the messages packages used in ROS.
In terms of TurtleBot3, the majority of it uses the common messages, but there is a separate turtlebot3_msgs package that you can add to your custom message folder if you want to use them.
-Cam

Ehtisham ul Hasan
Ehtisham ul Hasan on 17 Mar 2021
Hi Milan,
Did you manage to find the folder path that needs to be entered with rosgenmsg ? I could not find any folder named custom_msgs or common_msgs on my system and thought should ask you if you found it.
Thanks
Best
Hasan
  1 Comment
Cam Salzberger
Cam Salzberger on 17 Mar 2021
If you have a ROS installation, you can search for *.msg files to find the locations. These message definitions will likely be in multiple packages, and the packages themselves may be nested in a folder structure, so you may need to copy out the package folders with message definitions into a different location to use with rosgenmsg.
If you do not have a ROS installation, you can get packages from their respective Github pages. For example, here is common_msgs. Be sure to select the branch appropriate to your ROS version.
If you have follow-up questions like this, it's recommended to put them in a "comment" under the question or answer it is directed at, rather than as a separate "answer".
-Cam

Sign in to comment.

Categories

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

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!