필터 지우기
필터 지우기

How to send ROS messages with string URI designator from Simulink

조회 수: 2 (최근 30일)
Janez Podobnik
Janez Podobnik 2015년 6월 15일
답변: Janez Podobnik 2015년 7월 7일
I was trying to implement Kuka Youbot control using the new simulink blocks from Robotics System Toolbox in Matlab 2015a. Mostly it works, but as it turns out I could not control the youbot arm from simulink, because simulink does not support char datatype and I would need to set the URI of the ROS message so that ROS can identify for each joint I am sending the command. For the arm control it is necessary to write the joint designation into the JointValue.
In matlab command window this is done simplify by writing
pubArm1Pos = rospublisher('/arm_1/arm_controller/position_command','brics_actuator/JointPositions');
msgArm1Pos = rosmessage(pubArm1Pos);
msgArm1Pos.Positions(1).Unit = 'rad';
msgArm1Pos.Positions(1).JointUri = 'arm_joint_1';
msgArm1Pos.Positions(1).Value = 3.0;
% similar code for the rest 4 joints
send(pubArm1Pos, msgArm1Pos);
However in simulink I was not able to move the arm. I tried to cast the string 'arm_joint_1' into uint8 type, but it does not work. Is there a solution how to include proper designations for joints, so that the ROS would properly recognize the message for all the joints.
Best regards

답변 (1개)

Janez Podobnik
Janez Podobnik 2015년 7월 7일
I have written an s-function instead of m-function, but the problem is that the bus cannot store the string format. And even though I send the string in uint8, the ROS listener on youbot does not recognize it as a char. Would it be possible to write a custom publisher for simulink based on the publisher availible in Robotics toolbox?

카테고리

Help CenterFile Exchange에서 Specialized Messages에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by