"rosgenmsg": folder does not contain a valid ROS package, because the 'package.xml' file is missing.

3 次查看(过去 30 天)
I am attempting to use MATLAB to read from a bagfile and that works fine for most topics, except for any regarding /mavros/. I have installed the Robotics System Toolbox Interface for ROS Custom Messages and attempted to use the rosgenmsg function with the mavros_msgs folder located at /opt/ros/kinetic/share/mavros_msgs. These are all default locations when installing ROS kinetic. 
When running rosgenmsg('/opt/ros/kinetic/share/mavros_msgs') I get returned an error saying that this location is not a real ROS pkg complaining that there might not be a package.xml even though there is. 
I get the following error:
>> rosgenmsg('/opt/ros/kinetic/share/mavros_msgs')
Checking subfolder "cmake" for custom messages.
Warning: The folder /opt/ros/kinetic/share/mavros_msgs/cmake does not contain a valid ROS
package, because the 'package.xml' file is missing. Create the 'package.xml' file in this
folder.
> In robotics.ros.custommsg.internal.CustomMessageJAR/buildFolders (line 93)
In rosgenmsg (line 42)
No message packages were found in folder /opt/ros/kinetic/share/mavros_msgs. Check to
make sure the path to your folder is correct.

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2021-9-27
The folder supplied to "rosgenmsg" is supposed to be the parent folder of the one that is being provided. I recommend that you check the example provided in the following link:
As you can see, the file structure looks like:
In this case, you would be providing the "packages" folder to "rosgenmsg". In a more typical ROS file structure, you might provide the common_msgs folder. For this folder, please check the link below:
It contains all the individual message packages. In this case, you would need to provide the "share" folder. On the other hand, this might have a bunch of other message packages that may or may not be useful to you, so you may or not want to use them in MATLAB. So it may be better to copy the mavros_msgs folder to another location, and provide that location as the path.
 

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Custom Message Support 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by