Can't publish message from Simulink to ROS

조회 수: 5(최근 30일)
Ben Locke
Ben Locke 2021년 7월 5일
댓글: Ben Locke 2021년 7월 7일
I am having trouble sending a message from Simulink to a ROS. The ROS master is running on a separate laptop which runs ROS kinetic on Ubuntu 16.04. When I echo the ROS topic on this laptop the message appears empty. The simulink model and empty message is attached below. Any help is much appreciated.

채택된 답변

Abhijeet Gadkari
Abhijeet Gadkari 2021년 7월 6일
편집: Abhijeet Gadkari 2021년 7월 6일
Hello Ben,
sensor_msgs/Joy is a ROS message that contains variable sized sub-messages.
As shown in the Modify maximum Size of Variable-length Array section of that example, you need to set the correct array-size of the Axes and Buttons fields for sensors_msgs/Joy.
Variable size sensor_msgs/Joy
In above snapshot, I've updated the Simulink model with 'Probe Width' blocks and assigned the width to CurrentLength field. In PuTTy window, echo of /joy topic shows message published from MATLAB.
  댓글 수: 1
Ben Locke
Ben Locke 2021년 7월 7일
Hi Abhijeet
Thank you for your response, the model now works.
Best regards

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by