main content

quadcopter project -凯发k8网页登录

this example shows how to use simulink® to model a quadcopter, based on the parrot® series of mini-drones.

  • to manage the model and source files, it uses project management.

  • to show the quadcopter in a three-dimensional environment, it uses simulink 3d animation.

  • for the collaborative development of a flight simulation application, it provides an implementation of the flight simulation application template.

this example works with the .

note: to successfully run this example you must have a c/c compiler installed.

open the quadcopter project

run the following command to create and open a working copy of the project files for this example:

quadcopter physical characteristics

the following schematic shows the quadcopter physical characteristics:

  • axis

  • mass and inertia

  • rotors

axis

the quadcopter body axis is centered in the center of gravity.

  • the x-axis starts at the center of gravity and points in the direction along the nose of the quadcopter.

  • the y-axis starts at the center of gravity and points to the right of the quadcopter.

  • the z-axis starts at the center of gravity and points downward from the quadcopter, following the right-hand rule.

mass and inertia

we assume that the whole body works as a particle. the file vehiclevars contains the values for the inertia and mass.

rotors

  • rotor #1 rotates positively with respect to the z-axis. it is located parallel to the xy-plane, -45 degrees from the x-axis.

  • rotor #2 rotates negatively with respect to the body's z-axis. it is located parallel to the xy-plane, 455 degrees from the x-axis.

  • rotor #3 has the same rotation direction as rotor #1. it is located parallel to the xy-plane, 135 degrees from the x-axis.

  • rotor #4 has the same rotation direction as rotor #2. it is located parallel to the xy-plane, -135 degrees from the x-axis.

this example uses the multirotor block in the aerospace blockset. the block is based on the approach defined by prouty[1] and adapted to a heavy-lift quadcopter by pounds et al[2].

control

for control, the quadcopter uses a complementary filter to estimate attitude, and kalman filters to estimate position and velocity. the example implements:

  • a pid controller for pitch/roll control

  • a pd controller for yaw

  • a pd controller for position control in north-east-down coordinates

the controllervars file contains variables pertinent to the controller. the estimatorvars file contains variables pertinent to the estimator.

the example implements the controller and estimators as model subsystems, enabling several combinations of estimators and controllers to be evaluated for design.

to provide inputs to the quadcopter (in pitch, roll, yaw, north (x), east (y), down (z) coordinates ), use one of the following and change the vss_command variable in the workspace:

  • a signal editor block

  • a joystick

  • previously saved data

  • spreadsheet data

sensors

the example uses a set of sensors to determine its states:

  • an inertial measurement unit (imu) to measure the angular rates and translational accelerations.

  • a camera for optical flow estimation.

  • a sonar for altitude measurement.

the example stores the characteristics for the sensors in the file sensorvars. to include sensor dynamics with these measurements, you can change the vss_sensors variable in the workspace.

environment

the models implement several aerospace blockset™ environment blocks, including those for atmosphere and gravity models. to include these models, you can change the vss_environment variable in the workspace to toggle between variable and fixed environment models.

linearization

the model uses the trimlinearizeoppoint to linearize the nonlinear model of the quadcopter using simulink control design (r).

testing

to make sure that the trajectory generation tool works properly, the example implements a test in the trajectorytest file. for more information on how to do this, see the simulink control design get started with simulink control design (simulink control design)).

visualization

you can visualize the variables for the quadcopter in one of the following ways:

  • using simulation data inspector.

  • using the flight instrument blocks.

  • toggling between the different visualization variant subsystems. you can toggle between the different variant subsystems by changing the vss_visualization variable. note that one of these variants is a flightgear animation. to use this animation, you must add a flightgear compatible model of the quadcopter to the project. the software does not include this model.

trajectory generation

a trajectory generation tool, using the dubin method, creates a set of navigational waypoints. to create a trajectory with a set of waypoints this method uses a set of poses defined by position, heading, turn curvature, and turn direction.

to start the tool, ensure that the project is open and run:

the following interface displays:

the interface has several panels:

waypoints

this panel describes the poses the trajectory tool requires. to define these poses, the panel uses text boxes:

  • north and east (position in meters)

  • heading (degrees from north)

  • curvature (turning curvature in meters^-1)

  • turn (direction clockwise or counter-clockwise)

a list of poses appears in the waypoint list to the right of the text boxes.

to add a waypoint, enter pose values in the edit boxes and click add. the new waypoint appears in the waypoint list in the same panel.

to edit the characteristics of a waypoint, select the waypoint in the list and click edit. the characteristics of the waypoints display in the edit boxes. edit the characteristics as desired, then click ok. to cancel the changes click cancel.

to delete a waypoint, in the waypoint list, select the waypoint and click delete.

no-fly zone

the panel defines the location and characteristics of the no-fly zones. to define the no-fly zone, the panel uses text boxes:

  • north and east (position in meters)

  • radius (distance in meters)

  • margin (safety margin in meters)

use the add, delete, edit, ok, and cancel buttons in the same way as for the waypoints panel.

mapped trajectory

this panel plots the trajectory over the apple hill campus aerial schematic based on the waypoints and no-fly zone characteristics.

to generate the trajectory, add the waypoint and no-fly zone characteristics to the respective panels, then click generate trajectory.

to save the trajectory that is currently in your panel, click the save button. this button only saves your last trajectory.

to load the last saved trajectory, click load.

to load the default trajectory, press the load default button.

to clear the values in the waypoint and no-fly zone panel, click clear.

the default data contains poses for specific locations at which the toy quadcopter uses its cameras so the pilot on the ground can estimate the height of the snow on the roof. three no-fly zones were defined for each of the auxiliary power generators, so in case there is a failure in the quadcopter, it does not cause any damage to the campus infrastructure.

when the example generates the trajectory for the default data, the plot should appear as follows:

the red line represents the trajectory, black x markers determine either a change in the trajectory or a specific pose. blue lines that represent the heading for that specific waypoint accompany specific poses. no-fly zones are represented as green circles.

if you have a simulink 3d animation license, you can also view the trajectory in a 3-d representation of the apple hill campus:

note: for visualization reasons the 3d representation of the quadcopter is not at the same scale as the environment and the rotor speeds have been lowered to removing aliasing.

references

[1] prouty, r. helicopter performance, stability, and control. pws publishers, 2005.

[2] pounds, p., mahony, r., corke, p. modelling and control of a large quadrotor robot. control engineering practice. 2010.

related topics

    网站地图