Robot System Toolbox doesn't support the message type: mavros_msg​s/Position​Target?

조회 수: 9 (최근 30일)
Steps for reproducing the problem:
  • Open the attached Simulink model file.
  • Double click the Publish block.
Is there a simple method that can let MATLAB support the ROS message type of mavros_msgs/PositionTarget? Otherwise, I will need to use another message type to send a topic and the write a node to convert the message to mavros_msgs/PositionTarget. Any ideas on this? Thanks, Bo
  댓글 수: 1
Bo
Bo 2017년 10월 24일
I am changing to another computer. When I try to run my old Simulink model containing my custom message, I got this error:
Error evaluating 'InitFcn' callback of Constant block 'iopid_clamping/Blank Message/Constant'.
Callback string is 'robotics.slros.internal.block.MessageBlockMask.dispatch('constantBlkInitFcn', gcb);'
Caused by:
Cannot find a MATLAB message class for type mavros_msgs/PositionTarget.
I put them here to let search engine able to find this page by the error message.

댓글을 달려면 로그인하십시오.

채택된 답변

Bo
Bo 2017년 9월 8일
편집: Bo 2017년 11월 9일
I got the solution from MATLAB support.
Please see the following documentation page about the Custom Message Support Package: https://www.mathworks.com/help/robotics/ug/ros-custom-message-support.html?requestedDomain=www.mathworks.com
As mentioned in the page above, to download this support package please enter the following command: roboticsAddons
into the MATLAB Command Window and select to download the "Robotics System Toolbox Interface for ROS Custom Messages"
Afterwards, please use the following example to learn how to add a custom message type: https://www.mathworks.com/help/robotics/ug/create-custom-messages-from-ros-package.html
My attachment "mavros_msgs.zip" contains an example of the ROS package needed to create a msg type called "mavros_msgs/PositionTarget".
Extract the zip file to Desktop and run:
>> folderpath = '/Users/boshang/Desktop/mavros_msgs/'
>> rosgenmsg(folderpath)
Q&A:
If you see messages like this:
>> folderpath = '/Users/boshang/Desktop/mavros_msgs/mavros_msgs/'
>> rosgenmsg(folderpath)
Checking subfolder "msg" for custom messages. Warning: The folder name 'msg' does not match the package name 'mavros_msgs' specified in 'package.xml'. Rename the folder 'msg' to 'mavros_msgs'. > In robotics.ros.custommsg.internal.CustomMessageJAR/buildFolders (line 93) In rosgenmsg (line 42)
Checking subfolder "srv" for custom messages. Warning: The folder /Users/boshang/Desktop/mavros_msgs/mavros_msgs/srv 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 /Users/boshang/Desktop/mavros_msgs/mavros_msgs. Check to make sure the path to your folder is correct.
You'll need to run command: "cd .." to go back and run "rosgenmsg(folderpath)" again.
  댓글 수: 5
Bo
Bo 2018년 6월 21일
Have you restarted MATLAB? @lily liu
Jakob Klein
Jakob Klein 2019년 1월 23일
I had the same issue and discovered a typing error in the javaclasspath.txt file...

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Gleb Derzkij
Gleb Derzkij 2018년 3월 5일
How to fix problem on Windows?

Gleb Derzkij
Gleb Derzkij 2018년 3월 5일
편집: Gleb Derzkij 2018년 3월 5일
2-d question is
How do you stabilize drone? when arm &takeoff 2
My drone flies chaotically
  댓글 수: 1
Bo
Bo 2018년 6월 21일
Sorry for the late response. I had the same issue before. Check if the time on your window is slower than real time. If so, you need a faster computer.

댓글을 달려면 로그인하십시오.


Jason Wang
Jason Wang 2018년 6월 29일
For convenience. Just type rosgenmsg('mavros_msgs') and use this zip

카테고리

Help CenterFile Exchange에서 Custom Message Support에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by