フィルターのクリア

Ros2subscriber/receive Subscriber did not receive any messages and timed out.

28 ビュー (過去 30 日間)
Hello,
I am attempting to subcribe nodes on matlab to PX4 Autopilot topics. I am running PX4 software in the loop flying a simulated quadcopter, I can echo the ROS2 topics in linux terminal, so there is data being published. However when I attempt to subscribe using MATLAB I do not recieve any data. I am not sure what the issue is as I have almost completely followed examples where /chatter is the topic.
rosinit;
setenv("ROS_DOMAIN_ID","101");%I need this to not conflict with other ROS2
%networks/shouldn't be a problem because matlab can see the topics with ros2 topic list
node1 = ros2node('matlab');
node2 = ros2subscriber(node1,'/fmu/out/sensor_combined');
msg = receive(node2,10)
>> ros2sub
Error using ros2subscriber/receive
Subscriber did not receive any messages and timed out.
Error in ros2sub (line 7)
msg = receive(node2,10)
  2 件のコメント
Sravan Pentlavelly
Sravan Pentlavelly 2023 年 6 月 9 日
Hi Isaiah Garcia-Romaine,
Can you please try the following items and let me know if it works.
  1. Make sure that PX4 simulator is publishing messages with the same DomainID that you are using in MATLAB.
  2. Make sure that simulator and the host machine where you are launching the MATLAB are in same subnet. Otherwise you may need to use DEFAULT_FASTRTPS.xml file to establish communication at both ends. Refer to ROS Communication Outside Subnet for more details.
  3. You don't need 'rosinit' in your script as it is required launch the ROS master in ROS1 and it is not related to ROS2.
  4. Make sure that publisher is publishing messages regularly. You can use "ros2 topic echo /fmu/out/sensor_combined' on your simulator to know the data being published by the publisher.
Thanks,
Sravan Pentlavelly.
Isaiah Garcia-Romaine
Isaiah Garcia-Romaine 2023 年 6 月 9 日
Hi Sravan Pentlavelly,
Thank you for your response. It turns out that the issue is that default ROS subscribers are incompatible with PX4 publishers due to their different QoS settings. To fix the problem I used this MATLAB documentation: https://www.mathworks.com/help/ros/ug/manage-quality-of-service-policies-in-ros2.html

サインインしてコメントする。

採用された回答

Jagadeesh Konakalla
Jagadeesh Konakalla 2023 年 6 月 12 日
It turns out that the issue is that default ROS subscribers are incompatible with PX4 publishers due to their different QoS settings. To fix the problem I used this MATLAB documentation: https://www.mathworks.com/help/ros/ug/manage-quality-of-service-policies-in-ros2.html

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with ROS Toolbox についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by