How to send ROS messages with string URI designator from Simulink [closed]

asked 2015-06-15 07:40:26 -0500

Janez gravatar image

updated 2015-07-07 05:59:46 -0500

gvdhoorn gravatar image

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


Edit: 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?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2019-01-31 13:33:28.333030

Comments

I've turned your answer into an edit of your original questions. Contrary to a forum, we don't normally use additional posts to provide more information, we use edits for that. This will still bump your question, just as posting an answer would.

gvdhoorn gravatar imagegvdhoorn ( 2015-07-07 06:01:10 -0500 )edit