How to send ROS messages with string URI designator from Simulink
显示 更早的评论
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 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Specialized Messages 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!