AP_Scripting: add Split-S, Upline-45 and Downline-45

This commit is contained in:
Andrew Tridgell 2022-10-27 10:08:11 +11:00
parent 8873f95e52
commit f31fa6daf2
2 changed files with 61 additions and 18 deletions

View File

@ -11,23 +11,26 @@ The following table gives the available manoeuvres. Each manoeuvre has
an ID number which is used in the AUTO mission or in the TRIKn_ID
parameters (described below).
| ID | Name | Arg1 | Arg2 | Arg3 | Arg4 | Turnaround |
| -- | ------------------------ | ------ | ---------- | ------- | ---------- | ---------- |
| 1 | Figure Eight | radius | bank angle | | | No |
| 2 | Loop | radius | bank angle | num loops | | No |
| 3 | Horizontal Rectangle | length | width | radius | bank angle | No |
| 4 | Climbing Circle | radius | height | | | No |
| 5 | vertical Box | length | height | radius | | No |
| 6 | Banked Circle | radius | bank angle | height | | No |
| 7 | Straight Roll | length | num rolls | | | No |
| 8 | Rolling Circle | radius | num rolls | | | No |
| 9 | Half Cuban Eight | radius | | | | Yes |
| 10 | Half Reverse Cuban Eight | radius | | | | Yes |
| 11 | Cuban Eight | radius | | | | No |
| 12 | Humpty Bump | radius | height | | | Yes |
| 13 | Straight Flight | length | bank angle | | | No |
| 14 | Scale Figure Eight | radius | bank angle | | | No |
| 15 | Immelmann Turn | radius | roll rate | | | Yes |
| ID | Name | Arg1 | Arg2 | Arg3 | Arg4 | Turnaround |
| -- | ------------------------ | ------ | ---------- | ------- | ---------- | ---------- |
| 1 | Figure Eight | radius | bank angle | | | No |
| 2 | Loop | radius | bank angle | num loops | | No |
| 3 | Horizontal Rectangle | length | width | radius | bank angle | No |
| 4 | Climbing Circle | radius | height | | | No |
| 5 | vertical Box | length | height | radius | | No |
| 6 | Banked Circle | radius | bank angle | height | | No |
| 7 | Straight Roll | length | num rolls | | | No |
| 8 | Rolling Circle | radius | num rolls | | | No |
| 9 | Half Cuban Eight | radius | | | | Yes |
| 10 | Half Reverse Cuban Eight | radius | | | | Yes |
| 11 | Cuban Eight | radius | | | | No |
| 12 | Humpty Bump | radius | height | | | Yes |
| 13 | Straight Flight | length | bank angle | | | No |
| 14 | Scale Figure Eight | radius | bank angle | | | No |
| 15 | Immelmann Turn | radius | roll rate | | | Yes |
| 16 | Split-S | radius | roll rate | | | Yes |
| 17 | Upline-45 | radius | height gain | | | No |
| 17 | Downline-45 | radius | height loss | | | No |
The "Turnaround" column indicates if the manoeuvre results in a course
reversal, which impacts how it is used in AUTO missions.

View File

@ -704,7 +704,44 @@ function humpty_bump(t, r, h, arg3, arg4)
return path_var.composer.run(t)
end
---------------------------------------------------
function split_s(t, r, roll_rate, arg3, arg4)
if t == 0 then
local speed = path_var.target_speed
path_var.composer = path_composer({
{ path_straight(speed*180.0/roll_rate), roll_angle(180) },
{ path_vertical_arc(-r, 180), roll_angle(0) },
})
end
return path_var.composer.run(t)
end
function upline_45(t, r, height_gain, arg3, arg4)
if t == 0 then
local h = height_gain - 2*r*math.sin(math.rad(45))
assert(h >= 0)
path_var.composer = path_composer({
{ path_vertical_arc(r, 45), roll_angle(0) },
{ path_straight(h), roll_angle(0) },
{ path_vertical_arc(-r, 45), roll_angle(0) },
})
end
return path_var.composer.run(t)
end
function downline_45(t, r, height_loss, arg3, arg4)
if t == 0 then
local h = height_loss - 2*r*math.sin(math.rad(45))
assert(h >= 0)
path_var.composer = path_composer({
{ path_vertical_arc(-r, 45), roll_angle(0) },
{ path_straight(h), roll_angle(0) },
{ path_vertical_arc(r, 45), roll_angle(0) },
})
end
return path_var.composer.run(t)
end
---------------------------------------------------
--[[
target speed is taken as max of target airspeed and current 3D
@ -1130,6 +1167,9 @@ command_table[12]= PathFunction(humpty_bump, "Humpty Bump")
command_table[13]= PathFunction(straight_flight, "Straight Flight")
command_table[14]= PathFunction(scale_figure_eight, "Scale Figure Eight")
command_table[15]= PathFunction(immelmann_turn, "Immelmann Turn")
command_table[16]= PathFunction(split_s, "Split-S")
command_table[17]= PathFunction(upline_45, "Upline-45")
command_table[18]= PathFunction(downline_45, "Downline-45")
-- get a location structure from a waypoint number
function get_location(i)