Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.

Commit

Permalink
wire origin fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gliptal committed Mar 6, 2017
1 parent afcfaf5 commit ddb73e3
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@
+ wire angle fix
+ heading fix
+ declutter option

#### 0.9.0-beta3

+ wire origin fix
+ aim-off distance option
+ heading fix
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ CLI
| YES | --releasealt | -ra | SLED's *release* MSL altitude | ft | |
| YES | --abortalt | -aa | SLED's *abort* MSL altitude | ft | |
| YES | --minalt | -ma | SLED's *mimimum* MSL altitude | ft | |
| YES | --aimdist | -ad | aim-off distance | ft | |
| | --filename | -fn | name of the generated `.xml` file | | "sled" |
| | --leewayalt | -la | available +/- leeway for the SLED's *base*, *track*, and *release* altitudes | ft | 200ft |
| | --leewayhdg | -lh | available +/- leeway for the range's attack heading at the SLED's *base* altitude | ° | 10° |
Expand Down
Binary file modified dist/taser.exe
Binary file not shown.
6 changes: 6 additions & 0 deletions source/args.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
RELEASE_ALT = None
ABORT_ALT = None
MIN_ALT = None
AIM_DIST = None

def parse():
global RANGE
Expand All @@ -32,6 +33,7 @@ def parse():
global RELEASE_ALT
global ABORT_ALT
global MIN_ALT
global AIM_DIST

parser = argparse.ArgumentParser(description="generate .xml files to visually render SLED attack profiles in the Tacview 3D environment version: 0.6.0-beta1", formatter_class=lambda prog: argparse.HelpFormatter(prog, max_help_position=30))
parser.add_argument("-v", "--version", action="version", version="0.8.0-beta2")
Expand All @@ -53,6 +55,7 @@ def parse():
required_options.add_argument("-ra", "--releasealt", type=_positive_float, help="release altitude (in feet MSL)", metavar="ft", required=True)
required_options.add_argument("-aa", "--abortalt", type=_positive_float, help="abort altitude (in feet MSL)", metavar="ft", required=True)
required_options.add_argument("-ma", "--minalt", type=_positive_float, help="minimum altitude (in feet MSL)", metavar="ft", required=True)
required_options.add_argument("-ad", "--aimdist", type=_positive_float, help="aim-off distance (in feet)", metavar="ft", required=True)

args = parser.parse_args()

Expand All @@ -69,6 +72,7 @@ def parse():
RELEASE_ALT = args.releasealt
ABORT_ALT = args.abortalt
MIN_ALT = args.minalt
AIM_DIST = args.aimdist

def check_range():
global RANGE
Expand Down Expand Up @@ -111,6 +115,7 @@ def convert():
global RELEASE_ALT
global ABORT_ALT
global MIN_ALT
global AIM_DIST

LEEWAY_ALT = calc.ft_to_m(LEEWAY_ALT)
if ATTACK_HDG is not None:
Expand All @@ -121,6 +126,7 @@ def convert():
RELEASE_ALT = calc.ft_to_m(RELEASE_ALT)
ABORT_ALT = calc.ft_to_m(ABORT_ALT)
MIN_ALT = calc.ft_to_m(MIN_ALT)
AIM_DIST = calc.ft_to_m(AIM_DIST)

def _positive_int(value):
number = int(value)
Expand Down
8 changes: 4 additions & 4 deletions source/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def ft_to_m(ft):
return ft*0.3048

def thdg_to_mhdg(thdg):
return thdg+19
return thdg+11

def reverse_heading(hdg):
return (hdg+180) % 360
Expand All @@ -24,9 +24,9 @@ def sin_cathetus_from_angle(l, a):
def cos_cathetus_from_angle(h, a):
return h/math.tan(math.radians(a))

def shift_coords(coords, dist, hdg):
lat = _dms_to_dd(coords["latitude"])
lon = _dms_to_dd(coords["longitude"])
def shift_coords(lat, lon, dist, hdg):
lat = _dms_to_dd(lat)
lon = _dms_to_dd(lon)

origin = geopy.Point(lat, lon)
destination = geopy.distance.VincentyDistance(kilometers=dist/1000).destination(origin, hdg)
Expand Down
11 changes: 6 additions & 5 deletions source/tacview.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ def generate():
attack_heading = calc.reverse_heading(calc.thdg_to_mhdg(args.TARGET["heading"]))
else:
attack_heading = calc.reverse_heading(args.ATTACK_HDG)
aimdist_lat, aimdist_lon = calc.shift_coords(args.TARGET["position"]["latitude"], args.TARGET["position"]["longitude"], args.AIM_DIST, -calc.reverse_heading(attack_heading))

wire_length = calc.hypotenuse_from_catheti(args.BASE_DIST, base_altitude)
wire_angle = calc.angle_from_catheti(base_altitude, args.BASE_DIST)
wire_entry_width = calc.sin_cathetus_from_angle(wire_length, args.LEEWAY_HDG)
wire_height = args.LEEWAY_ALT*2

min_lat, min_lon = calc.shift_coords(args.TARGET["position"], args.BASE_DIST*0.3, -attack_heading)
min_lat, min_lon = calc.shift_coords(aimdist_lat, aimdist_lon, args.BASE_DIST*0.3, -attack_heading)
abort_lat, abort_lon = min_lat, min_lon
release_lat, release_lon = calc.shift_coords(args.TARGET["position"], calc.cos_cathetus_from_angle(args.RELEASE_ALT-target_altitude, wire_angle), -attack_heading)
track_lat, track_lon = calc.shift_coords(args.TARGET["position"], calc.cos_cathetus_from_angle(args.TRACK_ALT-target_altitude, wire_angle), -attack_heading)
release_lat, release_lon = calc.shift_coords(aimdist_lat, aimdist_lon, calc.cos_cathetus_from_angle(args.RELEASE_ALT-target_altitude, wire_angle), -attack_heading)
track_lat, track_lon = calc.shift_coords(aimdist_lat, aimdist_lon, calc.cos_cathetus_from_angle(args.TRACK_ALT-target_altitude, wire_angle), -attack_heading)

if args.DECLUTTER:
min_altitude = args.MIN_ALT
Expand Down Expand Up @@ -55,8 +56,8 @@ def generate():
release_height = args.LEEWAY_ALT*2
track_height = args.LEEWAY_ALT*2

template[0]["Position"]["Latitude"] = args.TARGET["position"]["latitude"]
template[0]["Position"]["Longitude"] = args.TARGET["position"]["longitude"]
template[0]["Position"]["Latitude"] = aimdist_lat
template[0]["Position"]["Longitude"] = aimdist_lon
template[0]["Position"]["Altitude"] = target_altitude
template[0]["Orientation"]["Pitch"] = wire_angle
template[0]["Orientation"]["Yaw"] = attack_heading
Expand Down

0 comments on commit ddb73e3

Please sign in to comment.