• No results found

Quadrotor open-source avionics software

3.6 Ground Station

3.7.1 Quadrotor open-source avionics software

The software architecture of the avionics system is described in Figure 3.18. It should be noted that in the implementation of the controllers, given the nature of quater- nions, there is a separate structure for manual and autonomous flights. This is be- cause in manual mode, the pilot controls yaw rate ˙ψd as opposed to ψd or q3d. The

manual control inputs areTd,φd,θd, ˙ψdwhich correspond to RC channel assignments

described in Table 3.8. In manual control mode, Euler angles are used to conform to the standard current manual mode control of quadrotors. The following is a descrip- tion of the various applications that were added or modified on the PX4 Firmware.

av_estimator This application implements the velocity aided attitude observer pre- sented in Section 6.2. The output of the application are 200Hz estimates of attitude and body-fixed frame and inertial frame velocities of the vehicle. The coupling be- tween the body-fixed and inertial frame filters enable the the coupled filters to output an estimate of the wind velocity.

commander This is a PX4 application that has the avionics system’s finite state ma- chine (for example autonomous mode, manual mode) and runs the calibration of various sensors and RC signals. The application has the calibration process for re- moving the magnetic effect of electric current from the magnetometer reading.

§3.7 Open-Source Software 65

precise tracking of trajectories developed in Section 6.4. The controller is set up such that in manual control mode, the feedforward terms go to zero and are only used during autonomous trajectory tracking control. This makes the control gains (2 KP,

2 K and 1KI) easy to tune compared to the default attitude controllers on the PX4.

The inputs to the controller are qd,Ωd, ˙Ωd,Td from the position/trajectory controller

of Section 6.5.1 or φd,θd,Td, ˙ψd from the RC. The RC inputs are then converted to a

desired quaternionqd withψd=0 (that is qd(φd,θd, 0)),Tdand ˙ψd.

mc_quat_vel_control This application is similar to mc_quat_control and operates both in manual and autonomous modes. In manual mode, when there is no mea- sured or estimated linear velocities, the RC signals are converted toφd,θd,Td, ˙ψ. The

desired attitude is then converted to quaternions in a similar manner to mc_quat_control. However, when measured or estimated linear velocities are available, the RC signals are converted to vdx,vdy,Td, ˙ψd and vdz = 0 where v ∈ R3 ∈ {C}. {C} has its~e1 di-

rection rotated by the heading (yaw) of the vehicle in {A}. Based on the attitude of the vehicle, this velocity is then converted to the body-fixed frame desired velocity

Vd R3. In autonomous mode, V

d is also obtained from vd through the vehicle

attitudeR. With the desired velocities, this application implements the velocity con- troller in Section 6.5.2 to obtain the desired attitude setpoint in quaternions qd. The

application runs internally the attitude controller of Section 6.4. The attitude con- troller in this case ignores the feedforward termsΩd, ˙Ωd in the controller.

mc_quat_pos_controlThis implements the position and trajectory controller of Sec- tion 6.5.1 with outputs in quaternions and angular velocities and acceleration. It uses either Vicon position estimates or 200Hz of position estimates from the global positioning system (GPS) measurements of position and velocity to generate desired attitude in quaternions (qd), desired angular velocity (Ωd) and angular acceleration

( ˙Ωd). The rate at which the controller is run depends on whether there is Vicon or

GPS data. With Vicon, it runs at 40Hz while with GPS, it runs at the 200Hz estimated velocity from the 5Hz GPS measurements. Though this controller is bound to have some steady state error when used to do position control, it however has good tra- jectory tracking as demonstrated in Figure 6.8 of Section 6.7.1. This application also generates the measured inertial frame velocities ¯vwhen Vicon or GPS measurements are available. These velocities are used as measurements in the velocity aided atti- tude estimation.

mkblctrlAs the name implies, mkblctrl is the I2C application written for the Mikrokopter brushless direct current ESCs. It has been modified to read the states (current and RPM) of the ESCs (slaves) at 20Hz while enabling the avionics’ I2C master to send desired thrust commands at 50Hz.

attitude_estimator_SO3 This runs the SO(3) quaternion based attitude filter that produces the known double cover problem associated with quaternions. These quater- nions are also converted to rotation matrices and Euler angles for used by none

quaternion based applications. The major advantage of this filter over the PX4 de- fault extended Kalman filters (EKF) is its less computational cost. The theory of the filter is presented in Appendix C.

sdlog2 This application logs the flight data on the micro-SD card plugged into the PX4FMU or Pixhawk board at a specified rate with a maximum rate of 150Hz. Un- like any of the quadrotors mentioned in Section 2.2, the logged data includes vehicle position, estimated attitude and velocities and status of all four ESCs.