How to use rosgenmsg with a filepath on a separate computer?

1 view (last 30 days)
My Setup:
I have created a custom service (.srv in the srv folder of the desired package) on my main machine (Ubuntu 16.04/ ROS Kinetic/ ROS master on this one). I have Matlab on another computer (Windows 10). The windows computer has full connectivity with ros on the linux computer (Matlab can publish and subscribe to topics and call services through the robotics system toolbox).
My Question:
How do I have Matlab call the rosgenmsg(), a function that generates a Matlab object file from .srv or .msg files, with a file path to a package on a separate computer?

Answers (1)

Cam Salzberger
Cam Salzberger on 15 Apr 2019
Hey Theodore,
Barring odd situations where you have other computer systems accessible through network paths ro the like, rosgenmsg is designed to work only on the computer from which you run it. It does not actually communicate over or with ROS at all, it simply uses the tools in MATLAB to build the custom messages into MATLAB and Java files necessary to use them with MATLAB. So you would need to get the message packages off of your Linux machine and put them local to your Windows machine in order to run rosgenmsg.
As a side note, if you have multiple machines that have MATLAB on them, you can just build the libraries once, and share them between machines. See the instructions here.
-Cam
  3 Comments
Ami
Ami on 6 Oct 2020
Hello. If I copy my custom messages package from my linux machine to my Windows 10 PC, will I need to do any other additional steps? Or just supply the package path to rosgenmsg and it would be enough?
Cam Salzberger
Cam Salzberger on 13 Oct 2020
There shouldn't be any platform-specific changes to the message packages, so there should be no need to change anything between platforms. If it worked with rosgenmsg in MATLAB on one platform, it should work on the other.
If you are talking about copying from a downloaded ROS package that wasn't tested with MATLAB, then there may be some changes necessary. Up through R2020a, rosgenmsg depends on the package.xml being in a specific format. In R2020b, you no longer need anything but the correct folder structure and the msg/srv files.
-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!