Why am I getting a payload size mismatch error with ROS Toolbox in Simulink while subscribing to a PX4 topic?

8 ビュー (過去 30 日間)

I am simulating a UAV with PX4 flight simulation software and using the ROS Toolbox in Simulink. After setting up a PX4 topic subscriber and running the model, I am receiving the following error:

2024-01-26 19:24:18.782 [RTPS_READER_HISTORY Error] Change payload size of '196' bytes is larger than the history payload size of '191' bytes and cannot be resized. -> Function can_change_be_added_nts
What is causing the error?

採用された回答

MathWorks Support Team
MathWorks Support Team 2024 年 3 月 20 日
This issue you are facing seems to be related to an incorrect message version installed with the PX4-Autopilot, and is not an issue specifically with the ROS Toolbox. This may originate during PX4-Autopilot setup. For the full install instructions for PX4 Autopilot, please the documentation link here:
At that documentation page, you will find the following:
1)  "px4_msgs" downloaded are registered with MATLAB using "ros2genmsg" API:
These messages are of version v1.14.0.
2) The PX4 installed outside MATLAB is done by following instructions in "Install PX4" section of this documentation:
Note that as part of these instructions, there is the following command to clone the GitHub repo of the PX4-Autopilot package to the local PC:
git clone https://github.com/PX4/PX4-Autopilot.git --recursive
3) The above command clones the main branch present on that repo instead of the stable version. The official stable release is v1.14.0. The main branch has changes to the message definitions that are incompatible with the "px4_msgs" package downloaded for ROS 2. Please download the official stable version of PX4-Autopilot i.e., v1.14.0. This can be achieved by changing the above command as follows:
git clone https://github.com/PX4/PX4-Autopilot.git --recursive --branch v1.14.0
4) After this step, please follow the rest of the instructions to install PX4.
Now PX4 publisher running outside MATLAB should be able to communicate with ROS 2 subscribers running in Simulink on the same topic "/fmu/out/vehicle_local_position". 

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeROS 2 Network Access in Simulink についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by