MATLAB Answers

Simulink Robotics System Toolbox

조회 수: 7(최근 30일)
shundai miyawaki
shundai miyawaki 8 Jun 2019
댓글: Cam Salzberger 12 Jun 2019
I would like to deploy the code on Ubuntu 16.02 + ROS which prepared the CAN communication model created on simulink separately using the code which uses the CANUSB device made by Lawicel in the URL below and is made available on the following URL. If I select "/ canrx" as the topic of the Subscribe block in the procedure in, and then select the Subscribe block again, an error such as an image will occur.
1. Place the ROS Subscribe block
2. Double click on it
3. Select "Select from ROS network"
4. Select the topic "/ canrx" on another PC's ROS network from "Select" on the right side of Topic:
5. Message type is automatically set to "canusb / CAN", apply, and press OK.
Of course "Configure ROS Network Addresses" can be connected to the ROS network of another PC without any problem, and the configuration parameters "Run hardware", "Target hardware resources", "Build option" "Edit" "Test" There is no error and the connection with the ROS network is good.

  댓글 수: 0

Sign in to comment.


Cam Salzberger
Cam Salzberger 10 Jun 2019
Hey Shundai,
Have you gone through the custom message support workflow to add that message type to MATLAB? It is selectable, because the ROS network exists, but if MATLAB doesn't recognize the message type, it can't make use of it.
If you're not sure, enter "rosmsg list" in the Command Window. If you see "canusb/CAN" in that list, then it has already been added.

  댓글 수: 2

shundai miyawaki
shundai miyawaki 10 Jun 2019
Thank you for reply.
I tryed to typying the command "rosmsg list" , but it does not display in the window. under picture.
I readed "ros custom message work flow".
I did not understand how to apply to what I want do.
Could you tell me how to have recognized MATLAB my custom message type ?
Cam Salzberger
Cam Salzberger 12 Jun 2019
The basic idea is that you provide your message definition package to MATLAB, and MATLAB will be able to recognize your custom message. First install the Robotics Systems Toolbox Interface for ROS Custom Messages. Make sure you have the correct message definition package in a good location (needs the ".msg" definition files, as well as the package.xml file that defines the ROS package). Then follow the steps in this link, using rosgenmsg to point MATLAB to the custom message package folder, and adjusting the Java and MATLAB paths as instructed. Restart MATLAB, and you should be able to use the new custom messages.

Sign in to comment.

Translated by