Move Vtail hexa from betaflight to arducopter

I would like to migrate my small Vtail hexa from betaflight to Arducopter.

Currently this aircraft use Runcam protocol to control the split camera and smartaudio for the VTX.

AFAIK Runcam protocol will be introduced with AC 4.1 and smartaudio can be emulated with LUA script.

The only big limitation for me is the motor table in order to control correctly the hexa Vtail.

I have very very limited experience in code. How I can correctly configure it? Can someone edit the motor table for me? I would like to be ready for AC 4.1 installing AC 4.0.6 and do PID and notch integration.
This is the custom motor mix used successfully in betaflight :
mixer CUSTOM
mmix 0 1.000 -0.570 -0.700 -1.000
mmix 1 1.000 0.570 -0.700 1.000
mmix 2 1.000 -1.000 0.260 0.000
mmix 3 1.000 1.000 0.260 0.000
mmix 4 1.000 0.000 1.000 -1.000
mmix 5 1.000 0.000 1.000 1.000

If you have scripting on your flight controller you can now do custom mixers on 4.1.dev (as of Monday), You will need to set FRAME_CLASS to 15

This is a example for a quad,

I would guess the betaflight one would just translate across, the format is:

Motor number, roll, pitch, yaw, testing order

If the betalfight mixer is (I guessed, plaese check):

motor number, throttle, roll, pitch yaw

AP is always a 1 for the throttle, so you would end-up with something like:
MotorsMatrix:add_motor_raw(0, -0.570, -0.700, -1, 1)
ect

assert(MotorsMatrix:init(6), "Failed to init MotorsMatrix")

thanks @iampete. how about LED control and buzzer control? how I can check if my FC support this two feature on arducopter?

@iampete I just realized that Kakute has only 1mb of flash so can’t use script. Any way we can implement Vtail hex into code?

Add in here: https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Motors/AP_MotorsMatrix.cpp
Find a previous pr to get the pattern though: you’ll need to add it to the params and enums in a couple of places

1 Like

Hi James,

Could you please check that the motor mix make sense? I use as base the hexacopter X and apply correction in order to make the Vtail hexa. Actually I call it Penta6 because like the Vtail quad has a shape of a tricopter, in order to have correct weight distribution, the vtail hexa had to be based on a pentagon with 2 motors on the back.

MotorsMatrix:add_motor_raw(0, -1.000,  0.260,  0, 2)
MotorsMatrix:add_motor_raw(1,  1.000,  0.260,  0, 5)
MotorsMatrix:add_motor_raw(2,  0.570, -0.700,  1, 6) 
MotorsMatrix:add_motor_raw(3,  0.000,  1.000, -1, 2)
MotorsMatrix:add_motor_raw(4, -0.570, -0.700, -1, 1)
MotorsMatrix:add_motor_raw(5,  0.000,  1.000,  1, 4)

@james_pattison could you please help me to integrate this motor mix into code?

Can you make a PR, then we can work to fix it up?

Thanks @james_pattison, following @rmackay9 suggestion I opened a new issue in github, regarding less it is almost 10 years that I use arducopter with great success, coding is not my cup of tea.

Ok, no worries. I’m a little time poor unfortunately :slight_smile:

1 Like

@james_pattison do you think you can do something in the near future?

After changing FC to Matek h743 with AC 4.1 beta 4 I was able to use script and I port the penta6 configuration to arducopter. I will post updated and correct script here later on. Maybe we can integrate the configuration in the code

attached the lua script for the Vtail hexaMotorMatrix_setup.lua (482 Bytes)

Hello, I know its quite old post but i am facing similar situation as yours.

i have custom motor location for Tilt rotor Quadplane.

I have created the lua script as mentioned by you and above comments.

I have question for the next step.

Should this lua script be added directly on the pixhawk in ‘config → MAVFtp → APM → scripts’?

Are there any additional steps or parameters need to be corrected or changed before running this script?

Custom_motormatrix_odo.lua (725 Bytes)

Hello,

I’m unable to reply about the quad plane but on my hexa VTOL I simply loaded the script in the folder on board the flight controller and then select lua script for the motor configuration.

How did you select lua script for motor configuration?
i have already uploaded my file to flight controller in the mentioned folder.

Yes, from the motor configuration choices one is lua script. At next reboot, upon connecting, check the messages for confirmation that your motor configuration is lua script

Ok, just to be sure. motor configuration choices means the following parameter with the mentioned value,

https://ardupilot.org/copter/docs/parameters.html

FRAME_CLASS: 15 (Scripting Matrix).

Yes confirmed. Sorry for not being precise before

Thanks. this would help a lot.