Simulink Robotics System Toolbox
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Cam Salzberger
on 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.
-Cam
2 Comments
Cam Salzberger
on 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.
See Also
Categories
Find more on Specialized Messages in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!