error in the rosmatlab application: Undefined variable "rosmatlab" or class "rosmatlab.node....

Dear all,
I created a publisher in ROS which publishes messages successfully. I want to receive these messages by Matlab. This my code in Matlab (Ubuntu 12.04 64bit, ROS Hydro, Matlab2015a):
function test_ros
import rosmatlab.*
roscore = rosmatlab.roscore(11311);
node = rosmatlab.node('NODE', [], 11311);
subscriber = rosmatlab.subscriber(....
.
.
end
but Matlab gives me these errors:
Undefined variable "rosmatlab" or class "rosmatlab.roscore".
Error in test_ros (line 13)
roscore = rosmatlab.roscore(11311);
or
Undefined variable "rosmatlab" or class "rosmatlab.node".
Error in test_ros (line 17)
node = rosmatlab.node('NODE', [], 11311);
Dose anyone have any idea what the problem is? Thanks,

 採用された回答

Starting with R2015a, there is an official Robotics System Toolbox that replaces an older ROS I/O support package. The syntax you are referring to is related to that older package.
Do you have Robotics System Toolbox? You can check by typing "ver" in MATLAB and seeing if the product shows up.
If you do, the code is somewhat simpler, in that MATLAB automatically creates a global node with the default settings starting you up in localhost, port 11311.
>> rosinit
>> subscriber = rossubscriber('/topicname');
- Sebastian

1 件のコメント

Alireza Mohseni
Alireza Mohseni 2015 年 7 月 7 日
編集済み: Alireza Mohseni 2015 年 7 月 7 日
Dear Sebastian, These codes have already worked. I did not know version the older version has different syntax. I think in the website it must be noticed. At first it is not clear who is who. Anyway, thanks. Now I am in the correct path...

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

その他の回答 (0 件)

カテゴリ

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by