How can I change my ROS custom message after it's generated.

7 ビュー (過去 30 日間)
Jaehyeon Im
Jaehyeon Im 2019 年 7 月 4 日
コメント済み: Jaehyeon Im 2019 年 7 月 9 日
Hi, mathworks team.
I'm using ROS Toolbox and I have a question.
I created some custom messages refer to the below document.
I successfully made the custom messages and was able to use them with ROS Toolbox.
But, here's the problems.
When I want to modify my created custom message package (e.g. Want to add some variables in that message), I'm not sure what I need to do.
Do I have to just follow the same steps that I created the custom msg pkg? ( rosgenmsg() -> addpath & savepath -> restart MATLAB / this doesn't work well for me... )
And also I wonder how can I delete the generated files clearly to get back as before I create them.
Thank you !

採用された回答

Cam Salzberger
Cam Salzberger 2019 年 7 月 8 日
Hello Jaehyeon,
The ROS custom messages supported by MATLAB are designed to be overwritten. So if you have gone through all of the usual steps to generate the messages (rosgenmsg, update Java class path, update MATLAB path), you can simply change your message definition files and run rosgenmsg and restart again. Since you are updating everything in the same location, the Java class path and MATLAB path should still point to the correct folders. The restart is necessary to get the new Java files (and it also kicks off a rehash for the MATLAB files).
If you want to remove all custom messages, you should be able to effectively make them unusable to MATLAB by removing the Java class path and MATLAB path that you added previously. You can also delete the generated folder if you want.
-Cam
  1 件のコメント
Jaehyeon Im
Jaehyeon Im 2019 年 7 月 9 日
Cam, thank you for the reply.
I have one more question. Is it possible that I can change the data type name of generated ROS msgs?
For example, I already have a simulink algorithm model (it has one input bus object and one output bus obeject). And I want to use that model with ROS so I need to generate ROS Msgs refer to the busobjects in buseditor.
But when I generated msg which data type is 'Bus: Vel_Info' , generated ROS msg has the type 'Bus: SL_Bus_ROS_TestModel_Testmsgs_Vel_Info'. In Simulink, those bus objects handled as different data type and I can't directly connect them. So I always have to make connection parts .
Can you give me an advice ? Thanks !

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCustom Message Support についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by