How to performe simulation SITL with Gazebo using PX4 Autopilots Support from UAV Toolbox? ERROR displayed

30 ビュー (過去 30 日間)
First of all I'm on Ubuntu 20.04.6 LTS and MATLAB 2023a. I've installed the PX4 Autopilot Support from UAV toolbox.I'm trying to performe a SITL with the PX4 Autopilots Support from UAV Toolbox with Gazebo . I created a Simulink blank project, I added a PX4 accelerometer and I've connected it to scopes in order to see if the I/O connection is working. In the settings the only simulator available is jMAVsim there's no Gazebo, but nevermind I've tried the same to launch an I/O connection in SITL(PX4 Host target) with jMAVSIM to check if everything is working.The setup of the PX4 toolbox is the Design Flight Controller Algorithm in Simulink.
When I try to launch the I/O connection (SITL) an error is displayed:
MATLAB System block 'accelerometer_PX4/Accelerometer/PX4 uORB Read/SourceBlock' error occurred when invoking 'setupImpl' method of 'px4.internal.block.Subscriber'. The error was thrown from '
'/home/matteo/Documents/MATLAB/SupportPackages/R2023a/toolbox/target/supportpackages/px4/+px4/+internal/+block/Subscriber.p' at line 196
'/home/matteo/MATLAB/toolbox/target/codertarget/sltoolstrip/m/+codertarget/+internal/+sltoolstrip/ConnectedIOHandler.m' at line 106
'/home/matteo/MATLAB/toolbox/target/codertarget/sltoolstrip/m/+codertarget/+sltoolstrip/EmbeddedHardwareBoardContext.m' at line 493'.
Caused by:
Cannot create a communication link with the remote server. Please check the input arguments(ADDRESS and PORT) and make sure the server is running.
Additional Information: Connection refused [system:111]
How can I fix this problem?
I'm devoloping my master thesis and I have to design a costum controller and implement it on a quadcopter using PX4 Autopilot. Before doing this I have to do the SITL on Gazebo and then flash the controller on a PixHawk controller.

採用された回答

Arun Mathamkode
Arun Mathamkode 2023 年 4 月 28 日
Can you verify that the SITL and jMAVSim are launched without any errors on your machine? We have seen Java dependency issues with jMAVSim on Ubuntu and you might need to resolve those before going ahead with Simulink. Since anyway you want to continue in the future with Gazebo, I would suggest you to give it a try with Gazebo. Yeah, I agree there are no options given for Gazebo, but you can choose the option Simulink plant and proceed with the SITL simulation from Simulink. Before you are running the Controller model make sure you have manually started the gazebo environment and that it is ready for simulation.
  3 件のコメント
Salvatore Matteo Mennea
Salvatore Matteo Mennea 2023 年 5 月 2 日
I launched the gazebo simulation from the px4 firmware but when the simulation starts I have this error on the terminal:
ERROR [simulator] poll timeout 0, 22
How can I fix it?
Arun Mathamkode
Arun Mathamkode 2023 年 5 月 3 日
Try starting the controller first and then running the plant

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by