Pixhawk to Simulink MavLink Communication (Real Time virtual Cockpit instruments and Gagues)

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • Pixhawk (Ardupilot or PX4) Communication with Simulink in real time using Mavlink and displaying the results in graphical standard instrumentation
    This project is using Simulink-MAVLink v2.0 by aditya00j to connect to a pixhawk board (PX4 or Ardupilot) and get mavlink data from either a UDP, TCP-IP/ Serial USB Cable or even telemetry receiver.
    After receiving data you can use data to create your own real time monitoring software based on Simulink or Matlab. I used Simulink Flying instruments from Aerospace Block set for visualization.
    Mathworks Direct Link Page:
    www.mathworks....
    GitHub Link to get the Source Code Project:
    github.com/ali...
    ----------------------------------------------------
    Useful Links:
    MavLink Documentation of PX4 Website : dev.px4.io/v1....
    Simulink-MAVLink v2.0 by aditya00j : github.com/adi...

Комментарии • 52

  • @anujregmi4582
    @anujregmi4582 3 года назад +1

    nice work bro

  • @husseinsleiman6119
    @husseinsleiman6119 10 месяцев назад

    Hello Thank you for sharing such knowledge. My apologies if this is not the right place to ask but I have a general question as it seems you are much familiar with PX4 and Matlab Simulink. I recently got a Pixhawk x6 flight controller and I was wondering if there is a way to upload or flash a Simulink model, a custom flight controller for an aerial vehicle, to pixhawk x6? I know that recently a UAV Matlab Toolbox is published for such use case; however, it did not work as it was supposed to with pixhawk 6x. Do you know anything that can help me achieve my goal in that aspect? Also I was wondering if there are any limitations to do such thing.. for example do you think there is a limitation in memory usage, since my model is really big? Thank you in advance.

    • @alirezaghaderi
      @alirezaghaderi  10 месяцев назад +1

      It's possible to deploy Simulink models to Pixhawk hardware using the UAV Toolbox Support Package for PX4 Autopilots available in MATLAB and Simulink. This package allows you to verify your controller design by deploying it on the Pixhawk hardware board,
      you should start by reading the doucemntaiotn of the lates px4 support package for simulink uav tool box and get to know different modules of px4 and concept of modules. you need to repalce your controller module.

  • @aryawilliam2683
    @aryawilliam2683 11 месяцев назад

    hi, i followed all your step, but in 6:21 the elements exist is different (time_usev, attitude_monotomic, and other attitude), how to fix that?

    • @aryawilliam2683
      @aryawilliam2683 11 месяцев назад

      in your tutorial in the bus selector show signals, but in my bus selector is elements

    • @alirezaghaderi
      @alirezaghaderi  11 месяцев назад

      @@aryawilliam2683 what do yuo mean by elements? have you clicked on refresh ? make sure you are using consisnte mavlink version and it uses common.xml dialect of mavlink

  • @hamidsk2573
    @hamidsk2573 2 года назад

    Thanks for the excellent content, I do have a question, which part or software can define a specific characteristic of flight dynamics of an airborne

  • @guynevo9427
    @guynevo9427 3 года назад

    Hello. I am trying to run the simulink model in desktop real-time, but I keep getting errors. Is this supported for desktop real-time?

    • @alirezaghaderi
      @alirezaghaderi  3 года назад

      Hi
      I havent tested that ... I am not sure

  • @amirhossainjarareh9792
    @amirhossainjarareh9792 2 года назад

    این چه تفاوتی با پکیج mavlink خود متلب داره ؟ چرا از اون استفاده نکردید ؟

    • @alirezaghaderi
      @alirezaghaderi  2 года назад

      By the time this video recorded, Native Mavlink Support in UAV Toolbox was just introduced and not a easy to use option. Its originally implanted for onboard codes. after 2020b , Mavlink Simulink blocks also introduced. Anyway, working with those needs a-little practice and knowledge of mavlink which make it hard for many people

  • @aliars2072
    @aliars2072 2 года назад

    Firstly thanks for that video.However, i have 2 question for you sir.How can i send the data i receive here to pixhawk by assigning a constant value and if i need to use encoder, how do i create it?
    For example i want to set the attitude to 10 by a constant value block and keep it that way.
    Secondly you mentioned about udp connection instead of com port how can i do that ?
    I would appreciate it if you could explain these two questions.

    • @alirezaghaderi
      @alirezaghaderi  2 года назад

      1- Sending command is another story. you should create your own mavlink commands or use MavSDK or DroneKit. (Maybe I didn't get what you mean)
      2- just simply change the serial in block to UDP Receive and use Mavproxy or Mavlink-Router to forward your telemetry from serial . just search mavproxy docs and your will find the guids.

    • @aliars2072
      @aliars2072 2 года назад

      For the first question you got me totally correct thanks.
      If we come to the second question, the main reason for wanting to use udp is that when I make the block in the video, I cannot see the data flowing here in the mission planner because I think the com port uses by simulink. How can I run both simulink and missionplanner at the same time? Is UDP necessary for this or can i do that via com port ? Thank you very much for your quick reply.

    • @alirezaghaderi
      @alirezaghaderi  Год назад

      sorry for late reply. if you havent find the solution yet, you can use mavproxy to duplicate mavlink streams

  • @madhushreevenkatarajappa9278
    @madhushreevenkatarajappa9278 4 года назад +1

    Hi,
    I have been using the same simulink package by aditya , can you please make a vedio to send custom data from Matlab to Pixhawk running ardusub/ardupilot

    • @alirezaghaderi
      @alirezaghaderi  4 года назад +3

      I haven't used that yet... If you had experience send me the resources and when I am done with my current project I will do that as well.

    • @ashhadrasheed4385
      @ashhadrasheed4385 4 года назад

      @@alirezaghaderi Great work ! I need your advice on the following :
      i'm looking to customize px4 firmware. The porcess of customizing and then building that firmware is very cumbersome. this is through windows based linux bash. i
      just found out the we can also build the firmware using Matlab enbedded coder if we have hardware support for px4.is it any good ?
      i would really like your comment on this.

    • @alirezaghaderi
      @alirezaghaderi  4 года назад +1

      @@ashhadrasheed4385 Hi
      Yes Simulink Support Package is an option. but it overrides some default px4 functionality... you have to build them from scratch... depends on you project it can be a good or bad choice... it all depends on your project... and as you said modifying PX4 core is a relatively advanced task and small group of people are familiar with all the topics and they need payment to work.

    • @ashhadrasheed4385
      @ashhadrasheed4385 4 года назад

      @@alirezaghaderi true, I'm looking to customize the codebase as it is part of my project. Will keep updating you as I progress.

  • @sinanaksu2765
    @sinanaksu2765 3 года назад +1

    hi,
    I try in this videos steps, and i success thank you,
    can i arm to motors at this method ?
    I want to use sfun_encode_mavlink.cpp but i dont know how can i generate it, can you show it ?

    • @alirezaghaderi
      @alirezaghaderi  3 года назад +1

      Sorry for late response , Yes you can send mavlink command

    • @sinanaksu2765
      @sinanaksu2765 3 года назад

      @@alirezaghaderi thx

  • @josglanbrito
    @josglanbrito 3 года назад

    can you do please the steps to send data using s functions too, because im having some problems

  • @travelwithak_
    @travelwithak_ 3 года назад

    Sir, the mavlink decoder isn't taking the input of the serial receiver. I have downloaded all necessary tool boxes. Could you please tell the solution for this problem?

    • @alirezaghaderi
      @alirezaghaderi  3 года назад

      Hi
      use a display port right after serial receive to make sure you are receiving serial packets or not.. .It must be the serial setting that causes the problem

    • @travelwithak_
      @travelwithak_ 3 года назад

      @@alirezaghaderi Sir, the display is receiving the values , but mavlink decoder is not working, and the values of the parameters are always zero.I have added the neccessary directories properly too..

    • @alirezaghaderi
      @alirezaghaderi  3 года назад

      @@travelwithak_ have you created the s-functions as described?

    • @travelwithak_
      @travelwithak_ 3 года назад

      @@alirezaghaderi Yes sir , I have done it. Could you please give me your email id,so that i can send you the brief demonstration of the problem that I'm facing?

    • @alirezaghaderi
      @alirezaghaderi  3 года назад

      p30planets@gmail.com

  • @niloofardavoodi1992
    @niloofardavoodi1992 4 года назад

    hi Mr ghaderi.
    I want to connect simulink and pixhawk v1 autopilot in external mode during serial communication. I use uorbread block from px4 library in my model. when I run the model uorbread
    Build process completed successfully but External Mode MEX-file 'ext_comm' error appear. serial port is open in simulink and the baudrate is 57600. can you please help me what can I do?

    • @alirezaghaderi
      @alirezaghaderi  4 года назад

      That is a totally different topic.. You are using Simulink embedded coder for PX4? if yes, You should use Serial transmit on PX4 Model and use serial receive on your Desktop Model. Its all manual data packing.... This tutorial is about using default mavlink packets without touching PX4 Firmware.

    • @niloofardavoodi1992
      @niloofardavoodi1992 4 года назад

      @@alirezaghaderi thank you Mr ghadery. yes I am using embedded coder but I haven't used any serial transmit block in my model. so I will study about it

    • @alirezaghaderi
      @alirezaghaderi  4 года назад

      Depends on your project and data you can use Serial transmit or using default mavlink messages.
      Good Luck

    • @ashhadrasheed4385
      @ashhadrasheed4385 4 года назад

      I have a question Ali Reza how can we modify this code to display flags ?

    • @ashhadrasheed4385
      @ashhadrasheed4385 4 года назад

      Niloofer may I know the scope of the project

  • @mohsenfazareh3384
    @mohsenfazareh3384 2 года назад

    Hello dear friend
    thank you for sharing such valuable tutorial
    I am working on it and I get an error

    • @mohsenfazareh3384
      @mohsenfazareh3384 2 года назад

      Error in S-function 'example_use_sfunctions/MAVLink Decoder': S-Function 'sfun_decode_mavlink' does not exist

    • @mohsenfazareh3384
      @mohsenfazareh3384 2 года назад

      This is the error and I dont know how to fix it.
      would you please help me on it?

    • @alirezaghaderi
      @alirezaghaderi  2 года назад

      Hi
      You should use sfun_create_sfunc
      after creating then you should use it.
      make sure they are in the same directory
      double-check it and follow the video step by step