⇐ Back to Mantis X8 Airframe

Mantis X8 Firmware Setup

This step is no longer required if using the rolling build since the octorotor configuration is now included. Skip to the step 4 but set SYS_AUTOSTART to 8001 instead of 108.

To setup to octorotor, follow the instruction for Adding a New Platform in the Developer Tutorials. You should not have the propellors on yet for safety. Specificly, these are the steps I followed:

  1. In Eclipse, open Firmware–>ROMFS–>px4fmu_common–>init.d–>rcS and add the following code:
     	if param compare SYS_AUTOSTART 108
    	then
    		set MKBLCTRL_MODE no
    		set FRAME_GEOMETRY x
    		set MIXER /etc/mixers/FMU_octo_x.mix
    		sh /etc/init.d/108_io_octo_x8
    		set MODE custom
    	fi

    somewhere in with the other sysconfigs

  2. in Firmware–>ROMFS–>px4fmu_common–>init.d create a new source file called 108_io_octo_x8 and add the following code:
    #!nsh
    # X8 octorotor
    echo "[init] PX4FMU v1, v2 with IO on Octo"
    
    #
    # Load default params for this platform
    #
    if param compare SYS_AUTOCONFIG 1
    then
    	# Set all params here, then disable autoconfig
    	param set SYS_AUTOCONFIG 0
    
    	param set MC_ATTRATE_D 0.0001
    	param set MC_ATTRATE_I 0.0
    	param set MC_ATTRATE_P 0.1
    	param set MC_ATT_D 0.0
    	param set MC_ATT_I 0.0
    	param set MC_ATT_P 5.0
    	param set MC_YAWPOS_D 0.0
    	param set MC_YAWPOS_I 0.0
    	param set MC_YAWPOS_P 3.0
    	param set MC_YAWRATE_D 0.005
    	param set MC_YAWRATE_I 0.2
    	param set MC_YAWRATE_P 0.3
    	param set NAV_TAKEOFF_ALT 3.0
    	param set MPC_TILT_MAX 0.5
    	param set MPC_THR_MAX 0.7
    	param set MPC_THR_MIN 0.3
    	param set MPC_XY_D 0
    	param set MPC_XY_P 0.5
    	param set MPC_XY_VEL_D 0
    	param set MPC_XY_VEL_I 0
    	param set MPC_XY_VEL_MAX 3
    	param set MPC_XY_VEL_P 0.2
    	param set MPC_Z_D 0
    	param set MPC_Z_P 1
    	param set MPC_Z_VEL_D 0
    	param set MPC_Z_VEL_I 0.1
    	param set MPC_Z_VEL_MAX 2
    	param set MPC_Z_VEL_P 0.20
    	
    	param set BAT_N_CELLS 6
    	param set BAT_V_SCALE_IO 17015
    	
    	param save
    fi
     
    #
    # Force some key parameters to sane values
    # MAV_TYPE list: https://pixhawk.ethz.ch/mavlink/
    # 14 = octorotor
    #
    param set MAV_TYPE 14
    
    set EXIT_ON_END no
    
    #
    # Start and configure PX4IO or FMU interface
    #
    if px4io detect
    then
    	# Start MAVLink (depends on orb)
    	usleep 5000
    	mavlink start
    	commander start	
    	sh /etc/init.d/rc.io
    
    else
    	# Start MAVLink (on UART1 / ttyS0)
    	mavlink start -d /dev/ttyS0
    	usleep 5000
    	fmu mode_pwm
    	param set BAT_V_SCALING 0.004593
    	set EXIT_ON_END yes
    fi
    
    # Set PWM values for typical ESCs
    pwm disarmed -c 12345678 -p 900
    pwm min -c 12345678 -p 1200
    pwm max -c 12345678 -p 1900
    
    #
    # Load mixer
    #
    mixer load /dev/pwm_output $MIXER
    
    #
    # Set PWM output frequency to 400 Hz
    #
    pwm rate -r 400 -c 12345678
    
    #
    # Start common for all multirotors apps
    #
    sh /etc/init.d/rc.multirotor
    
    if [ $EXIT_ON_END == yes ]
    then
    	exit
    fi
  3. Double-click the upload px4fmu-v1_default and connect the fmu to the USB to program when prompted
  4. Start qgroundcontrol, set SYS_AUTOSTART to 108 and SYS_AUTOCONFIG to 1, write the values and restart the FMU

At this point you should be able to perform sensor and radio calibration and arm the craft (long-press the safety, then both stick pulled down and in). Check that all motors are spinning in the correct direction (should not have props on yet) and you hear them respond to both radio stick input and attitude changes.

The plotting feature in the Pro tab is very helpful. Scroll down to the eight servos and select them to display. Slow down the update to ~1 minute. Then push the stick forward and confirm that servos 2&4 increase while 1&5 decrease. 6&8 should increase to a lesser extent and similarly 3&7 should decrease to a lesser extent. Rotating the right stick in a circle to watch all the motors rise and fall in sequence like below.

Also, when right-yaw is applied, you should observe motors 3,4,5,&6 should increase while 1,2,7&8 decrease. Finally test the sign of the servo feedback. With all sticks centered, tilt the craft forward. 1&5 should increase. Tilting left should result in 6&7 increasing in speed. Once all the motors are confirmed to be responding correctly it is time to attach the props and begin PID tuning.

⇐ Back to Mantis X8 Airframe

Translations of this page:


Quick Links

QR Code: URL of current page