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

DIY Robocars via Twitter
RT @_JonMyer: 🚨Attention DeepRacer's including #UndergroundDeepRacer🚨 Check our our LIVE stream that including @IAM_dbro Take a few moments…
Wednesday
DIY Drones via Twitter
RT @MarvelmindMaxim: Extreme precision for 60 swarming robots. #marvelmind #autonomousrobotics #robotics #swarmrobotics #rtls #ips #indoor…
Monday
DIY Drones via Twitter
RT @MarvelmindMaxim: Precise (±2cm) tracking for racing boats and autonomous boats. Works outdoor and indoor. #autonomous #AutonomousVehic…
Monday
DIY Drones via Twitter
RT @MarvelmindMaxim: Helping PixHawk folks to fly autonomous quadcopters using PX4 and ArduPilot. https://marvelmind.com/drones/ Equally suitab…
Monday
DIY Robocars via Twitter
RT @chr1sa: The @DIYRobocars @donkey_car virtual AI car race is starting in 15 minutes! Watch it live on Twitch https://www.twitch.tv/mossmann3333 htt…
Aug 1
DIY Robocars via Twitter
RT @chr1sa: Don't miss our monthly @DIYRobocars @donkey_car virtual AI car race tomorrow at 10:00am PT live on Twitch. Head-to-head racing…
Jul 31
DIY Robocars via Twitter
RT @sparkfun: Our completed tutorial on building an @NVIDIA Jetson Nano-powered @Sphero RVR gets your bot up and running via teleoperation…
Jul 30
DIY Robocars via Twitter
RT @SmallpixelCar: Freeway test https://t.co/4V5tV9lhIP
Jul 29
DIY Robocars via Twitter
Very small autonomous cars racing, thanks to an overhead camera: https://control.ee.ethz.ch/research/team-projects/autonomous-rc-car-racing.html
Jul 29
DIY Robocars via Twitter
Jul 29
DIY Robocars via Twitter
Jul 29
DIY Robocars via Twitter
RT @chr1sa: Don't miss our virtual AI car race this Saturday! Real developers + virtual cars =🏎️🏎️🏎️ Head-to-head battles with thrills, sp…
Jul 28
DIY Robocars via Twitter
Jul 27
DIY Robocars via Twitter
RT @usashirou1: Jetson nano by Isaac Kaya #jetson https://t.co/Mu1N0CyQkN
Jul 23
DIY Robocars via Twitter
RT @GPUsolution: JetRacer mady by Iflytek company #JetsonNANO #Nvidia https://t.co/MimTymIwge
Jul 23
DIY Robocars via Twitter
RT @openmvcam: I love this: Mega or Mini? Image Classification on the 1MB OpenMV Cam H7 by Ish Ot Jr. in OpenMV, Edge Impulse, Internet of…
Jul 23
More…