How to send ROS messages with string URI designator from Simulink

2 Ansichten (letzte 30 Tage)
Janez Podobnik
Janez Podobnik am 15 Jun. 2015
Beantwortet: Janez Podobnik am 7 Jul. 2015
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

Antworten (1)

Janez Podobnik
Janez Podobnik am 7 Jul. 2015
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?

Kategorien

Mehr zu Specialized Messages finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by