MATLAB Answers

problems of baxter_cor​e_msgs/Joi​ntCommand in simulink

5 views (last 30 days)
peidong on 1 Jul 2015
Answered: Darsana Thulasi on 9 Jul 2015
Hi All,
I tried to control baxter robot using simulink, but I find there may be some problem of creating topic. 1, there is no names(data type, string[]) for baxter_core_msgs/JointCommand; 2, the Msg.command input port requires 128X1 elements of array, while actually we only need 7X1 array to publish the topic e.g. '/robot/limb/left/joint_command'. what's the 128X1 elements of array composed of? it works in matlab manuscripts,as follows, pub=rospublisher('/robot/limb/left/joint_command','baxter_core_msgs/JointCommand'); Msg=rosmessage('baxter_core_msgs/JointCommand');
command=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0];% here we can see it's 7X1, not 128X1 declared in simulink. names=[{'left_w0'}, {'left_w1'}, {'left_w2'}, {'left_e0'}, {'left_e1'}, {'left_s0'}, {'left_s1'}]; mode=1; Msg.Command=int64(command);
Msg.Mode=int32(1); Msg.Names=(names); send(pub,Msg); Looking forward to your answers! Thanks,

Answers (1)

Darsana Thulasi
Darsana Thulasi on 9 Jul 2015
128X1 is the default size. You can change this by going to Tools>>Robot Operating System and set the value in Manage Size Arrays. Please see this doc link for more information:


Community Treasure Hunt

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

Start Hunting!