Modelling the Arducopter Controller in Simulink

Hi guys

For my Bachelor thesis I am trying to model the JDrones hexa in MATLAB/Simulink. So far I finished modelling the multirotor itself. Now I would like to model the controller. And here my question arose: How does Arducopter calculate the angular speed of each single rotor from the output of the four PIDs (thrust, roll, pitch, yaw)? There are several different ways to do that, thought I am interested how Ardupilot does it to get a model close to reality. I had already a look into the code, but was not able to find hints so far.

You can find a PDF attached which provides you more information about the problem and the modelling.

Thanks for any help or hints!

Roman

Notes2.pdf

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • Hi Roman,

     

    I was impressed from your project. I am trying similar thing with my APM 2.5 to modelling t-rex 700e. But I know very little where to start.

    Shortly my aim is to create a model for t-rex 700 heli and test the apm code after modifying it. So it will reduce to crash possibility in real. Is it easy to find this kind of model that is designed in simulink? So that I can import and easily start to change my codes?

     

    Best regards.

    • Is it easy to find this kind of model that is designed in simulink? So that I can import and easily start to change my codes?

      I don't think you will find a finished model for a t-rex 700 so you can just import it. But if you have some knowlege in mechanics and control, you can build a model yourself. Just search a good paper or (PhD, master) thesis modelling a coax and learn how to do it. I have never modeled a coax heli, so I can't help you on that.

      Furthermore there exists some HIL (hardware in the loop) stuff for Ardupilot. I never tried this and therfore I don't know the quality of those programms. But may be worth a try.

      Best regards

      Roman

      • Hi Roman,

           Did you mean that I must use X-PC Target and similar programs as HIL for Ardupilot. In this case, I will use real APM card instead of Arduino Simulink Add-on in order to communicate with X-PC Target. Is it correct?

        If I understood right, I have some questions.

        How APM can receive GPS ans sensor data during sim flight?

        Is XPlane a kind of X-PC Target similar program?

        Thanks, Best Regards.

         

        • I have never used HIL and therefore I don't have any clue about it. I have just read on the web, that it exists. So unfortunately I can't help you with your questions.

          • Ok, thanks roman.

      • Honestly I dont have enough time to build it in time. Besides I dont have much mechanics and control experience. So I need to find an easy way to test my modified codes somehow in a Simulation before flying real. I will check out HIL. If you find a better way please let me know. Thanks for the answers.

        Best Regards.

  • Hi,

    I'm really interested in developing a dynamic model of the system. Did you manage to complete yours? And did you finally implement it on Simulink? I'd like to program ArduPilot 2.5 board through Simulink, but using a modern logic control. Any suggestion?
    Thank you

  • Hi

    After going through a lot of code I finaly found what I was looking for. The command that is sent to the motor can be found in AP_MotorsMatrix.cpp in the output_armed() function (around line 100). The factors (roll_factor, pitch_factor, yaw_factor) are built by the function add_Motor (around lline 267 in AP_MotorMatrix.cpp). This function for a hexa is called in the file AP_MotorsHexa.cpp.

    Details can be found in the attachment.

    Best Regards

    Roman

    Notes2.pdf

    https://storage.ning.com/topology/rest/1.0/file/get/3692654126?profile=original
This reply was deleted.

Activity

Neville Rodrigues liked Neville Rodrigues's profile
Jun 30
Santiago Perez liked Santiago Perez's profile
Jun 21
More…