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 @SahikaGenc: AWS DeepRacer & Hot Wheels Track https://youtu.be/4H0Ei07RdR4 via @YouTube
Monday
DIY Robocars via Twitter
Sep 8
DIY Robocars via Twitter
RT @davsca1: We are releasing the code of our Fisher Information Field, the first dedicated map for perception-aware planning that is >10x…
Sep 8
DIY Robocars via Twitter
RT @SmallpixelCar: How this works: 1)object detection to find cones in single camera image, 30 frames/sec on @NVIDIAEmbedded Xavier. 2)comp…
Sep 8
DIY Robocars via Twitter
RT @SmallpixelCar: Use two color cones to guide the robocar. No map needed, on onsite training needed. Just place the cones and it will fol…
Sep 7
DIY Robocars via Twitter
Sep 7
DIY Robocars via Twitter
RT @roboton_io: Great to see http://roboton.io running at 60fps on the cheapest #chromebook we could find! #edtech #robotics #educat…
Sep 3
DIY Robocars via Twitter
RT @openmvcam: Crazy in-depth article about using the OpenMV Cam for Astrophotography: https://github.com/frank26080115/OpemMV-Astrophotography-Gear https://t.co/BPoK9QDEwS
Sep 3
DIY Robocars via Twitter
RT @openmvcam: Hi folks, it's finally here! Our first draft of our Arduino Interface Library is out! It works over SoftwareSerial, Hardware…
Sep 3
DIY Robocars via Twitter
RT @chr1sa: Please let them have an open API. This would be perfect for @DIYRobocars races https://twitter.com/NintendoAmerica/status/1301513099707658246
Sep 3
DIY Robocars via Twitter
RT @SmallpixelCar: Lanenet pretty much used all my GPU power on @NVIDIAEmbedded Xavier since I optimized with tensorRT. I need to run anoth…
Sep 3
xemone liked Max Gilson's profile
Aug 31
DIY Robocars via Twitter
RT @LyftLevel5: Our @kaggle competition on Motion Prediction for Autonomous Vehicles is now live! Experiment with the largest-ever self-dri…
Aug 24
DIY Robocars via Twitter
RT @chr1sa: Our next @DIYRobocars virtual AI car race will be on Sept 26th. Sign up here https://www.meetup.com/DIYRobocars/events/272786977/ https://t.co/UENKGSOWO8
Aug 24
DIY Robocars via Twitter
New ready-to-run @NVIDIAEmbedded JetRacer car from Waveshare. Perfect for the next @diyrobocars race as soon as we… https://twitter.com/i/web/status/1297960223013867520
Aug 24
DIY Drones via Twitter
RT @chr1sa: The US government just approved 5 US-made drones for purchase, all based on the @Dronecode @PX4Autopilot standard. Great news f…
Aug 20
More…