#!/bin/sh
#
# @name UVify Draco
#
# @type Quadrotor x
# @class Copter
#
# @output MAIN1 motor 1
# @output MAIN2 motor 2
# @output MAIN3 motor 3
# @output MAIN4 motor 4
#
# @maintainer Hyon Lim <lim@uvify.com>
#
# @board px4_fmu-v2 exclude
# @board px4_fmu-v3 exclude
# @board px4_fmu-v4pro exclude
# @board px4_fmu-v5 exclude
# @board px4_fmu-v5x exclude
# @board bitcraze_crazyflie exclude
#

. ${R}etc/init.d/rc.mc_defaults

set MIXER quad_x
set PWM_OUT 1234


# use the Q attitude estimator, it works w/o mag or GPS.
param set-default SYS_MC_EST_GROUP 3
param set-default ATT_ACC_COMP 0
param set-default ATT_W_ACC 0.4
param set-default ATT_W_GYRO_BIAS 0
param set-default SYS_HAS_MAG 0

# Attitude & rate gains
param set-default MC_ROLL_P 8.0
param set-default MC_ROLLRATE_P 0.11
param set-default MC_ROLLRATE_I 0.3
param set-default MC_ROLLRATE_D 0.0015
param set-default MC_ROLLRATE_MAX 1600

param set-default MC_PITCH_P 8
param set-default MC_PITCHRATE_P 0.13
param set-default MC_PITCHRATE_I 0.35
param set-default MC_PITCHRATE_D 0.0015
param set-default MC_PITCHRATE_MAX 1600

param set-default MC_YAW_P 4
param set-default MC_YAWRATE_P 0.21
param set-default MC_YAWRATE_I 0.3
param set-default MC_YAWRATE_D 0.0
param set-default MC_YAW_FF 0.5
param set-default MC_YAWRATE_MAX 600

param set-default MC_ROLL_TC 0.19
param set-default MC_PITCH_TC 0.16
param set-default MC_AIRMODE 1

param set-default MPC_MAN_TILT_MAX 60
param set-default MPC_THR_CURVE 1
param set-default MPC_THR_HOVER 0.25

# Thrust curve (avoids the need for TPA)
param set-default THR_MDL_FAC 0.3

# System
param set-default PWM_MAIN_MAX 1950
param set-default PWM_MAIN_MIN 1180

# enable one-shot
param set-default PWM_MAIN_RATE 0

param set-default SENS_BOARD_ROT 2

param set-default BAT_SOURCE 0
param set-default CBRK_IO_SAFETY 22027
#param set COM_DISARM_LAND 3

# Filter settings
param set-default IMU_GYRO_CUTOFF 90
param set-default IMU_DGYRO_CUTOFF 100

# Don't try to be intelligent on RC loss: just cut the motors
#param set NAV_RCL_ACT 6

# enable to use high-rate logging for better rate tracking analysis
param set-default SDLOG_PROFILE 27

# TELEM1 ttyS1
#param set MAV_0_CONFIG 101
#param set MAV_0_MODE 2  # onboard
#param set MAV_0_RATE 20000
#param set SER_TEL1_BAUD 921600

# TELEM2 ttyS2
#param set MAV_1_CONFIG 0
