MATLAB Answers

Custom ROS msg type does not get added to rosmsg list even after MATLAB restart

조회 수: 37(최근 30일)
An Nguyen
An Nguyen 19 Mar 2019
댓글: An Nguyen 19 Mar 2019
I'm following this guide to create a custom ROS message type (
This is the structure of my msg
path_planning_msgs FOLDER
--- path_planning_msgs FOLDER
--- package.xml (copied from guide, replace w <name>path_planning_msgs</name>
--- Path.msg
Contents of package.xml
Contents of Path.msg
Header header
path_planning_msgs/VehicleState[] states
Then I executed these commands and everything seemed to work (I'm on Ubuntu 16.04 LTS)
Screenshot from 2019-03-18 19-58-40.png
Then I edited javaclasspath.txt to add the line
Screenshot from 2019-03-18 19-59-11.png
Then I ran the addpath and savepath
Screenshot from 2019-03-18 19-59-36.png
Then I closed MATLAB to restart it.
Then I checked rosmsg list but the path_planning_msgs/Path type is nowhere to be found.
Screenshot from 2019-03-18 20-06-42.png
Thank you in advance.

  댓글 수: 0

Sign in to comment.

채택된 답변

Sebastian Castro
Sebastian Castro 19 Mar 2019
편집: Sebastian Castro 19 Mar 2019
Hi An,
Pretty sure the ROS package requires your .msg file to be inside a subfolder called msg.
So your folder structure should be as follows:
path_planning_msgs FOLDER
--- package.xml
--- msg FOLDER
--- Path.msg
Try that and let us know if it works!
- Sebastian

  댓글 수: 6

표시 이전 댓글 수: 3
An Nguyen
An Nguyen 19 Mar 2019
Great observation. Following the steps above, I have successfully created a custom message type for VehicleState.msg as shown in the picture below.
Screenshot from 2019-03-18 22-38-52.png
However, I am running into a different issue when replicating those steps to build Path.msg.
Screenshot from 2019-03-18 22-41-35.png
I am going to search around for a solution and will keep you updated with my progress. Thank you!
Sebastian Castro
Sebastian Castro 19 Mar 2019
That latest error is exactly because you don't have a VehicleState.msg file defined! If you look at the error text it will show you it's pointing at an undefined symbol "VehicleState".
By the way, in future it would be much more useful instead of screenshots to copy-paste the error message text. This makes the question searchable if others have similar errors!
- Sebastian
An Nguyen
An Nguyen 19 Mar 2019
I am sorry for not getting back to you sooner. My team and I were trying to get it to work this morning and have finally succeeded after many trials. We finally got our ROS node!
We were not aware that the Path.msg and VehicleState.msg are supposed to be kept together under folder msg to be generated in one run. Initially we placed VehicleState.msg under its own directory thinking that we would need to define it first before moving on to Path.msg.
In case people search for this issue later, our final structure is
path_planning_msgs FOLDER
--- package.xml (add a build_depend line for VehicleState)
--- msg FOLDER
--- Path.msg
--- VehicleState.msg
We had been on the issue for days and would not have been able to solve it this fast without your feedback! Thank you very much for your help.

Sign in to comment.

추가 답변(0개)

Translated by