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

조회 수: 29 (최근 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?

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by