Skip to content

Commit

Permalink
AP_Scripting: added 32 motor example
Browse files Browse the repository at this point in the history
  • Loading branch information
tridge committed Jul 20, 2024
1 parent 1647cdc commit 9dd9652
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions libraries/AP_Scripting/examples/MotorMatrix_32.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- This script is an example setting up a custom motor matrix mix

local NUM_BANKS = 8

-- duplicate a quad 8x for 32 motors
for i = 1, NUM_BANKS do
local base = (i-1)*4
gcs:send_text(0, string.format("Setting up motor bank %u at %u", i, base))
MotorsMatrix:add_motor_raw(base+0, -1, 1, 1, base+2)
MotorsMatrix:add_motor_raw(base+1, 1, -1, 1, base+4)
MotorsMatrix:add_motor_raw(base+2, 1, 1, -1, base+1)
MotorsMatrix:add_motor_raw(base+3, -1, -1, -1, base+3)
end

assert(MotorsMatrix:init(NUM_BANKS*4), "Failed to init MotorsMatrix")

motors:set_frame_string(string.format("Motors%u", NUM_BANKS*4))

0 comments on commit 9dd9652

Please sign in to comment.