## Modelling a Quadrotor with Simmechanics

### Leonardo Araujo (view profile)

on 10 Dec 2013
Latest activity Commented on by Leonardo Araujo

on 14 Sep 2014

### ts (view profile)

Guys it's possible to model a plant of a quadrotor using simmechanics? For instance which kind of joint I can use to model the force(F1,F2,F3,F4) of the quadrotors

Or maybe I'm going on the wrong direction and for this the best would be the aerospace blockset?

Thanks

## Products

on 11 Dec 2013
Edited by ts

### ts (view profile)

on 11 Dec 2013

Seems like a neat application. Not having tried this before, my first approach might be to:

• Connect the rotors to the quad body using Revolute Joint blocks.
• Connect the quad body to the world frame using a 6-DOF Joint block. This gives the quad the full three translational and three rotational degrees of freedom that it should have.

The challenge would be to model the lift due to the spinning rotors. The Aerospace Toolbox may have some suitable blocks for this task.

You can try a feedback loop with the rotor angular velocities as inputs and the quad lift force as output (accounting for roll, pitch, and yaw).

Leonardo Araujo

### Leonardo Araujo (view profile)

on 11 Dec 2013

But Tony is possible to model the Quad with SimMechanics and use the rotors to generate lift with the Aerospace blockset together?

For instance I've created the Quadrotor with solidworks and exported to simmechanics here but to generate the lift could be an issue using only the actuators of simmechanics right?

Guy Rouleau

### Guy Rouleau (view profile)

on 11 Dec 2013

Using the "External Force and Torque" block in SimMechanics, you can apply forces and torque coming from the motors. I would set the block to apply the forces in the attached frame.

However your need to implement the relation yourself between the rotors motion and the lift force it generates. SimMechanics cannot do that for you. For that, sense the motion at the joints, do the math in Simulink and feed that back to the actuator.

Leonardo Araujo

### Leonardo Araujo (view profile)

on 11 Dec 2013

This is really cool Guy, so if I export the Solidworks model of my Brushless motor + Propeller and add the external force block on the frame of the propeller this could do the job (I mean this force will be applied always on the propeller frame "up" direction even if globally the quad is tilting with some angle?

### Ryan G (view profile)

on 10 Dec 2013

Depending on what you're looking to do, this can be done with either Aero Blks or SimMech. From scratch, aero blks is easier because you can simply create the force and moment on a moment arm assuming the CG is directly centered. However, if you have a CAD model, I would import it into SimMech 2G and generate the forces using simscape blocks.

### Leonardo Araujo (view profile)

on 11 Dec 2013

Guys this is the first test with the Assembly (Propeller + Motor) from solidworks to simmechanics with the External Force and Torque

Simulation Video

Just to confirm this is the idea???

on 11 Dec 2013
Edited by ts

### ts (view profile)

on 11 Dec 2013

You got that together pretty quick! Looking at your model snapshots, here are some thoughts:

• The Cylindrical Joint block is probably okay for a single rotor, assuming it only moves up and down. To include other degrees of freedom, you will need a different joint. This is especially true when you build this up to a full quad-rotor model, at which point you'll want to model things like 3-D translation plus roll, pitch, and yaw.
• In the snapshots, the External Force and Torque input seems to be independent of the rotor angular velocity. To me, this seems counterintuitive, as a faster spinning rotor will generate more lift and hence rise faster. You could sense the angular velocity at the Revolute Joint block, and then use the sensing output in the lift force computation.

Anyway, cool stuff!

Leonardo Araujo

### Leonardo Araujo (view profile)

on 13 Dec 2013

Hi guys here are the last results that I've got: Quadrotor still without control

Sean de Wolski

### Sean de Wolski (view profile)

on 13 Dec 2013

That was hilarious, thanks for the laugh!

Guy Rouleau

### Guy Rouleau (view profile)

on 14 Dec 2013

nice... that's what a quadrotor would do without control ;-)

### ts (view profile)

on 14 Dec 2013

Very cool. You should try uploading that model to matlab central once you get a control system in ;)

Leonardo Araujo

### Leonardo Araujo (view profile)

on 25 Dec 2013

Hi guys as mentioned here are the last results with a PID control for roll, pitch, yaw (Working now on the altitude...

I did the PID control for each attitude degree of freedom (One for Roll, Pitch and Yaw) by locking the others ...

Here is a zoom on the control box ...

Here is the list on what I would like to do ... 0) Add the Altitude to the loop 1) Try the control with LQR 2) The pieces in solidworks are already sent to the 3d printer so I would also like to use the System identification toolbox 3) Use the MPC to robust control (Test with real data and the model) 4) Put this guy to fly ;)

Here are the simulation videos Videos

Merry Christmas to you all!!

Leonardo Araujo

### Leonardo Araujo (view profile)

on 26 Dec 2013

The following video show the result with random noise

ts

### ts (view profile)

on 28 Dec 2013

That is fantastic. Do post a video of the real quadrotor once you get it to fly!

### Leonardo Araujo (view profile)

on 2 Jan 2014

on 13 Sep 2014

Hi Leonardo,

Do you have the XML file of the qudcopter (that can be imported by SimMechanics) that's exported from Solidworks? I would like to use it to design my controller?

Thank you.

Leonardo Araujo

### Leonardo Araujo (view profile)

on 14 Sep 2014

Hi Mohamed i've added this project on the filéexchange with the solidworks project included.