simuling to ros float64multiarray publish layout problem

조회 수: 26 (최근 30일)
Emre Gür
Emre Gür 2020년 8월 30일
답변: Tohru Kikawada 2021년 4월 24일
Hi,
I am trying to publish 1x4 float64multiarray type message (exact message= [50, -50, 50, -50]) from simulink to ros topic. Although I followed regular procedure to do so; and did not feed in anything for layout at first, I am encountering this error from ros/gazebo simulation:
[ERROR] [1598824459.302691869, 6043.341000000]: Dimension of command (0) does not match number of joints (4)! Not executing!
I managed the array sizes for ROS message as 4 (which it is for [50, -50, 50, -50]). Thus, I think I have problem with layout. How can I resolve this problem? Which layout data shall I feed in for bus assignment?
Further details can be found from picture.
Best regards.
EG
(from terminal simulation runs if I write " rostopic pub -l /***/joint_motor_controller/command std_msgs/Float64MultiArray "data: [50, -50, 50]" ")
  댓글 수: 1
Ali Aflakian
Ali Aflakian 2021년 2월 22일
Hi,
I have exactly the same proplem. Could I possible ask, did you managed to solve that and how?
Regards,
Ali

댓글을 달려면 로그인하십시오.

답변 (1개)

Tohru Kikawada
Tohru Kikawada 2021년 4월 24일
In your case, you'll need to use MATLAB Function block for the nested message type, so it's a bit complicated. I've attached an example to assign an array to std_msgs/Float64MultiArray. Pleasse refer Work with Nested Arrays of Messages section in the following documentation for details.

카테고리

Help CenterFile Exchange에서 Publishers and Subscribers에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by