AP_Scripting: Added side_step maneuver

This commit is contained in:
MatthewHampsey 2022-11-17 19:44:06 +11:00 committed by Andrew Tridgell
parent 3fd212063c
commit 97bcc11f68
1 changed files with 18 additions and 2 deletions

View File

@ -1045,6 +1045,20 @@ function barrel_roll(radius, length, num_spirals, arg4)
})
end
function side_step(displacement, length, arg3, arg4)
local speed = target_groundspeed()
local radius = (displacement*displacement + length*length)/(4*displacement)
local angle = math.deg(2*math.atan(displacement, length))
local sign = sgn(displacement)
local bank = math.deg(math.atan((speed*speed) / (radius * GRAVITY_MSS)))
displacement = math.abs(displacement)
return make_paths("side_step",{
{path_horizontal_arc(sign*radius, angle, 0), roll_angle_entry_exit(sign*bank)},
{path_horizontal_arc(-sign*radius, angle, 0) , roll_angle_entry_exit(-sign*bank)},
})
end
function straight_flight(length, bank_angle, arg3, arg4)
return make_paths("straight_flight", {
{ path_straight(length), roll_angle_entry_exit(bank_angle) },
@ -2318,6 +2332,7 @@ command_table[28] = PathFunction(partial_circle, "Partial Circle")
command_table[29]= PathFunction(four_point_roll, "Four Point Roll")
command_table[30]= PathFunction(eight_point_roll, "Eight Point Roll")
command_table[31]= PathFunction(multi_point_roll, "Multi Point Roll")
command_table[32]= PathFunction(side_step, "Side Step")
command_table[200] = PathFunction(test_all_paths, "Test Suite")
command_table[201] = PathFunction(nz_clubman, "NZ Clubman")
command_table[202] = PathFunction(f3a_p23_l_r, "FAI F3A P23 L to R")
@ -2361,6 +2376,7 @@ load_table["barrel_roll"] = barrel_roll
load_table["straight_hold"] = straight_hold
load_table["partial_circle"] = partial_circle
load_table["multi_point_roll"] = multi_point_roll
load_table["side_step"] = side_step
load_table["p23_1a"] = p23_1a
load_table["p23_1"] = p23_1
load_table["p23_13a"] = p23_13a