SlideShare a Scribd company logo
Aerospace Applications of Perl
Presented by Ian Kluft
Silicon Valley Perl
Santa Clara, California
March 3, 2016
Aerospace Applications of Perl
● Perl and its libraries on CPAN are versatile
● Aerospace applications cover lots of topics
– Navigation/mapping
– Aviation
– Satellites
– Astronomy
● Also some examples from my own projects
Introducing the presenter
● Hi! I'm Ian Kluft
● From San Jose and a native
of the Bay Area
● Software engineer
– Primarily Perl & C/C++ on
servers & embedded/IoT
– Perl is my favorite language
● Currently working on my MBA
● Aerospace enthusiast
– Commerical pilot & flight
instructor
– Co-founder of Stratofox
Aerospace Tracking Team
– Participated in world records for
amateur aerospace
● 1st amateur rocket launch to space
(CSXT 2004, Nevada)
● 1st transcontinental/transoceanic
Ham Radio balloon (CNSP 2011)
Navigation & Mapping
● I presented a year ago at SVPerl on Geographic Computation
● Quick overview here because positioning is integral to
aerospace
– Next 7 slides are a review from last year's presentation
● Then we'll move on to look at aviation, satellites & astronomy
Coordinate system
Latitude and longitude
● Any position on Earth has a coordinate
● 3-dimensional positioning uses 3 numbers
– Latitude (north/south)
– Longitude (east/west)
– Altitude (relative to mean sea level/MSL)
● Latitude & longitude are specified in degrees
● Altitude is specified in distance
Latitude and longitude
What kind of degrees?
● Not from a university
● Not related to temperature
● They are angles!
● More precisely, angles from the
center of the Earth
● Latitude = 0-90° up or down
● Longitude = 0-180° either way
around
7
Earth is not a perfect sphere
● Earth is an ellipsoid: bulges out at equator
– Centrifugal force from rotation causes this
● Geoid: mathematical models for Earth ellipsoid
– Good models come from satellite measurement
● Coordinates must use the same geographic reference system
– Otherwise comparing apples and oranges
– WGS84 most widely used coordinate system today
● Sea level and altitude are relative to this model
8
Lots of angles in Geospatial Data
● Many computations involve angles
– Latitude and longitude are angles
● Manipulations use trigonometric functions
● Trig functions use radians
– So numbers in degrees must be converted to and from radians
– One circle = 360 degrees = 2 * pi radians
– Radians derive 2 * pi from distance around circle relative to radius
● Math::Trig module on CPAN can do this for you
9
Great Circle Routes
● Great Circle: direct route over
Earth's surface
– Along a line that goes around
the sphere
– i.e. from San Jose to London
crosses Greenland
– Flat-projection maps distort
great circle routes to look like
curves
Map generated by the Great Circle Mapper
copyright © Karl L. Swartz. http://www.gcmap.com/
10
Great Circle Formulas
● See “Aviation Formulary” site
http://williams.best.vwh.net/avform.htm
● Distance between points
● Course between points
● Latitude of point on GC
● Lat/lon given radial & dist
● Intersection of 2 radials
● Max latitude of a GC
● GC crossing a parallel
● Intermediate points on a GC
● Cross track error
● Along track distance
● Point known offset from GC
Many of these are in Math::Trig
11
Example: Great Circle
Distance between points
● From scratch:
d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))
● In Perl:
use Math::Trig 'great_circle_distance';
$distance = great_circle_distance($lon1, $lat1, $lon2, $lat2, $radius);
● Convert angles to radians
● For the radius of the Earth, use 6366.71 km
– Don't forget to convert result from km to miles if needed
12
Navigation related Perl modules
● Net::GPSD3 – connect to GPSD v3 server so multiple
processes can use a single GPS on laptop, IoT, drone, etc
● Geo::Coder – use online search sites to look up address of
current location
● Geo::Cache – Look up geocaching sites nearby
● Ham::APRS::IS – receive Ham Radio APRS positioning data,
open-sourced by the APRS.FI Ham Radio tracking web site
● Many more
13
Aviation applications
● Adding to the navigation/planning capabilities…
● Geo::METAR – decode text from airport weather observations
● Geo::TAF – decode text from airport weather forecasts
● Geo::ICAO – encode/decode international airport codes
● And other variants of these
14
Aviation example:
METAR weather observation (1/5)
#!/usr/bin/perl
use strict;
use warnings;
use Getopt::Long;
use LWP::UserAgent;
use HTTP::Response;
use XML::Simple;
my $url = "http://www.aviationweather.noaa.gov/adds/dataserver_current/httpparam?
dataSource=metars&requestType=retrieve&format=xml&stationString=%s&hoursBeforeNow=4";
my @metar_fields = qw(observation_time temp_c dewpoint_c wind_dir_degrees
wind_speed_kt wind_gust_kt visibility_statute_mi altim_in_hg
sea_level_pressure_mb three_hr_pressure_tendency_mb wx_string
sky_condition vert_vis_ft maxT_c minT_c maxT24hr_c minT24hr_c precip_in
pcp3hr_in pcp6hr_in pcp24hr_in snow_in quality_control_flags
flight_category
);
my $ua = LWP::UserAgent->new();
15
Aviation example:
METAR weather observation (2/5)# convert temperature C to C & F
sub tempC2CF
{
my ( $tempc ) = @_;
my $tempf = int($tempc * 9 / 5 + 32 + .5); # .5 = round off
return sprintf "%dC/%dF", $tempc, $tempf;
}
# turn a sky condition structure into a string
sub sky2str
{
my ( $sky ) = @_;
if ( ref $sky eq "ARRAY" ) {
# handle arrays of cloud layers by recursive calls
my @result;
foreach my $layer ( @$sky ) {
push @result, sky2str( $layer );
}
return join " ", @result;
}
# report cloud layer
return $sky->{sky_cover}."@".$sky->{cloud_base_ft_agl};
}
16
Aviation example:
METAR weather observation (3/5)
# get_metar function - download METAR by airport code
sub get_metar
{
my ( $code ) = @_;
my $url_with_code = sprintf( $url, $code );
print $url_with_code."n";
my $response = $ua->get( $url_with_code );
if ( $response->is_error()) {
printf "%s failed: %sn", $code, $response-
>status_line;
} else {
my $content = $response->content();
my $metar_tree = XMLin( $content );
print "$code:n";
if ((!exists $metar_tree→{data})or (!exists
$metar_tree→})
or (!exists $metar_tree->{data}{METAR})) {
print "unrecognized data: $contentn";
} else {
my $metar_ref = $metar_tree->{data}{METAR};
foreach my $metar ( @$metar_ref ) {
foreach my $field ( @metar_fields ) {
if ( exists $metar->{$field}) {
if ( $field eq "observation_time" ) {
print $metar->{$field}." ";
} elsif ( $field eq "sky_condition" ) {
print "sky: ".sky2str($metar->{$field})." ";
} elsif ( $field =~ /^(.*)_c$/ ) {
my $name = $1;
print "$name:".tempC2CF($metar->{$field})." ";
} elsif ( $field =~ /^(.*)_(kt|statute_mi|in_hg|degrees)
$/ ) {
my $name = $1; my $unit = $2;
print "$name:".$metar->{$field}."$unit ";
} else {
print "$field:".$metar->{$field}." ";
}
}
}
print "n";
}
}
}
}
17
Aviation example:
METAR weather observation (4/5)
# main - get airport codes from command line,
loop through them and get METARs
my $arg;
foreach $arg ( @ARGV ) {
get_metar( $arg );
}
18
Aviation example:
METAR weather observation (5/5)
● Example usage: get_metar KRHV
krhv:
2016-03-04T01:51:00Z temp:19C/66F dewpoint:14C/57F wind_dir:320degrees
wind_speed:4kt visibility:10.0statute_mi altim:30.050198in_hg sky: OVC@5000
flight_category:VFR
2016-03-04T00:51:00Z temp:19C/66F dewpoint:14C/57F wind_dir:0degrees wind_speed:4kt
visibility:10.0statute_mi altim:30.050198in_hg sky: OVC@3500 flight_category:VFR
2016-03-03T23:53:00Z temp:21C/70F dewpoint:13C/55F wind_dir:320degrees
wind_speed:11kt visibility:10.0statute_mi altim:30.041338in_hg sky: BKN@4000
OVC@6000 flight_category:VFR
2016-03-03T22:53:00Z temp:22C/72F dewpoint:13C/55F wind_dir:0degrees wind_speed:4kt
visibility:10.0statute_mi altim:30.059055in_hg sky: BKN@4000 OVC@6000
flight_category:VFR
19
Satellite tracking
● Why would you want to track a satellite?
– See visible passes of International Space Station (or Iridium Flares),
nighttime only
– Ham Radio communication via OSCARs (Orbiting Satellite Carrying
Amateur Radio), day or night
– If you make a commercial or research satellite, you'll build your own
ground station, day or night
● Astro::SpaceTrack – downloads satellite orbital elements
● Astro::satpass – makes satellite pass predictions
● Astro::App::SatPass2 – makes satellite pass predictions
20
Astronomy
● Astro::Sunrise – compute sunrise/sunset for your location/date
● Astro::MoonPhase – compute phase of the moon for a date
● Astro::Telescope – for astronomers accessing remote
telescopes
● Various celestial database searches
21
Example: Missing rocket payload
at Black Rock Desert
Location: Black Rock Desert, Nevada
Problem: Rocket launched, payload missing
● Soka University (Japan) students needed data
● Payload was a “CanSat”, size of a soda can
● AeroPac club knew rocket landing coordinates
● Turned to Stratofox Aerospace Tracking Team
● Transmitter batteries died before they contacted us
● I wrote a Perl script to generate a grid search
22
Perl Script to Plot Search Grid
● Search area was 3x3 mile parallelogram
– Top/bottom side east-west for typical non-storm wind direction
– Right/left sides NNE/SSW for typical storm wind direction
● Each side divided into 10 sections, 1584' long
● 10x10 loop projects each computed waypoint
● Command-line controls output to text or GPX
● “gpsbabel” open source utility turns GPX into many formats
– Raw Garmin waypoint data for upload to GPS
– KML for display on Google Earth
23
Projecting Search Grid Waypoints
● Nested loop: i = 0-10 over, j = 0-10 up
● Over = 270° heading, up = 330° heading
● Convert lat/lon from degrees to radians
● Use Great Circle projection formula
– Compute intermediate point from i “over”
– Compute final point from j “up”
● Convert new lat/lon from radians to degrees
● Code available at slideshare.com with slides
24
Sample code
convert feet to radians
● Convert distance in feet to radians over Earth's surface
●
Radians are angles – this is a tiny angle from center of Earth
# conversion: distance in feet to radians
sub dist_ft2rad
{
my $ft = shift;
my $km = $ft / 3280.8399; # ft/km
return $km/6371.0; # divide by FAI standard Earth radius in km
}
25
Sample code
compute waypoint from course & distance
sub gc_waypoint
{
my $lat1 = shift; # latitude (radians)
my $lon1 = shift; # longitude (radians)
my $tc = shift; # true course (radians)
my $d = shift; # distance (radians)
my $lat = asin(sin($lat1)*cos($d)+cos($lat1)*sin($d)*cos($tc));
my $dlon = atan2(sin($tc)*sin($d)*cos($lat1),cos($d)-sin($lat1)*sin($lat));
my $lon=fmod($lon1-$dlon+pi,2*pi) - pi;
return ( $lat, $lon ); # lat/lon in radians
}
26
Example code
compute coordinates of search grid point
# project a waypoint in the search area
# shape of a parallelogram with sides at headings 030 (NNE) and 090 (east)
# sides are on heading 1 (030 degrees) and heading 2 (090 degrees)
# increments are 0-10
# each increment is 1584 ft so that 10 of them is 3 miles
sub project_waypoint
{
my $h1_inc = shift;
my $h2_inc = shift;
# compute intermediate point on the first side of parallelogram
my ( $lat_r1, $lon_r1 ) = gc_waypoint (
deg2rad( $point_start[0]), deg2rad( $point_start[1]),
$h1_heading, $rad_per_increment * $h1_inc );
27
Example code (continued)
compute coordinates of search grid point
# compute final projected waypoint in search area
my ( $lat_r2, $lon_r2 ) = gc_waypoint (
$lat_r1, $lon_r1,
$h2_heading, $rad_per_increment * $h2_inc );
# convert radians to degrees
my $lat = rad2deg( $lat_r2 );
my $lon = rad2deg( $lon_r2 );
return ( $lat, $lon );
}
28
Search Area Grid Map
Result of the script shown on Google Earth
29
Result: Success!!!
Expected to be worse than needle in a haystack
Payload found 2500' west of rocket landing site
30
Conclusions
● The sky is not the limit
● You can have fun and learn a lot solving problems like these
Q & A

More Related Content

What's hot

Sanny omar esa_presentation_no_video
Sanny omar esa_presentation_no_videoSanny omar esa_presentation_no_video
Sanny omar esa_presentation_no_video
Advanced-Concepts-Team
 
Ares V: Supporting Space Exploration from LEO to Beyond
Ares V: Supporting Space Exploration from LEO to BeyondAres V: Supporting Space Exploration from LEO to Beyond
Ares V: Supporting Space Exploration from LEO to Beyond
American Astronautical Society
 
TECHNOLOGY MISSIONS
TECHNOLOGY MISSIONSTECHNOLOGY MISSIONS
TECHNOLOGY MISSIONS
Shivanand Vanjire
 
Senior Design - Europa Mission Proposal
Senior Design - Europa Mission ProposalSenior Design - Europa Mission Proposal
Senior Design - Europa Mission ProposalMatt Bergman
 
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
Nepal Flying Labs
 
Senior Design - Europa Lander Mission Presentation
Senior Design - Europa Lander Mission PresentationSenior Design - Europa Lander Mission Presentation
Senior Design - Europa Lander Mission PresentationMatt Bergman
 
F and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
F and G Taylor Series Solutions to the Circular Restricted Three-Body ProblemF and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
F and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
Etienne Pellegrini
 
GNSS Satellite System Basics by ASIM khan GNSS-7
GNSS Satellite System Basics  by ASIM khan GNSS-7GNSS Satellite System Basics  by ASIM khan GNSS-7
GNSS Satellite System Basics by ASIM khan GNSS-7
AsimKhan367
 
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
Raphael Troncy
 
WE2.L10.4: OPERATION ICEBRIDGE: USING INSTRUMENTED AIRCRAFT TO BRIDGE THE OBS...
WE2.L10.4: OPERATION ICEBRIDGE: USING INSTRUMENTED AIRCRAFT TO BRIDGE THE OBS...WE2.L10.4: OPERATION ICEBRIDGE: USING INSTRUMENTED AIRCRAFT TO BRIDGE THE OBS...
WE2.L10.4: OPERATION ICEBRIDGE: USING INSTRUMENTED AIRCRAFT TO BRIDGE THE OBS...grssieee
 
2005-04-01 Combined Aerosol Trajectory Tool, CATT:Status Report on Tools Deve...
2005-04-01 Combined Aerosol Trajectory Tool, CATT:Status Report on Tools Deve...2005-04-01 Combined Aerosol Trajectory Tool, CATT:Status Report on Tools Deve...
2005-04-01 Combined Aerosol Trajectory Tool, CATT:Status Report on Tools Deve...Rudolf Husar
 
0412 Catt Report
0412 Catt Report0412 Catt Report
0412 Catt Report
Rudolf Husar
 
Design and Evaluation of an Active Space Debris Removal Mission with Chemical...
Design and Evaluation of an Active Space Debris Removal Mission with Chemical...Design and Evaluation of an Active Space Debris Removal Mission with Chemical...
Design and Evaluation of an Active Space Debris Removal Mission with Chemical...
Space Generation Advisory Council - Space Safety and Sustainability Project Group
 
Spacecraft Formation Flying Navigation via a Novel Wireless Final
Spacecraft Formation Flying Navigation via a Novel Wireless FinalSpacecraft Formation Flying Navigation via a Novel Wireless Final
Spacecraft Formation Flying Navigation via a Novel Wireless FinalShu Ting Goh
 
Myscience High Altitude Balloon Project
Myscience High Altitude Balloon ProjectMyscience High Altitude Balloon Project
Myscience High Altitude Balloon Project
SLCS-online
 
Surveying Areas in Developing Regions Through Context Aware Drone Mobility
Surveying Areas in Developing Regions Through Context Aware Drone MobilitySurveying Areas in Developing Regions Through Context Aware Drone Mobility
Surveying Areas in Developing Regions Through Context Aware Drone Mobility
Alessandro Montanari
 

What's hot (18)

Sanny omar esa_presentation_no_video
Sanny omar esa_presentation_no_videoSanny omar esa_presentation_no_video
Sanny omar esa_presentation_no_video
 
Ares V: Supporting Space Exploration from LEO to Beyond
Ares V: Supporting Space Exploration from LEO to BeyondAres V: Supporting Space Exploration from LEO to Beyond
Ares V: Supporting Space Exploration from LEO to Beyond
 
Archer trac module_1_-_intro_v1
Archer trac module_1_-_intro_v1Archer trac module_1_-_intro_v1
Archer trac module_1_-_intro_v1
 
TECHNOLOGY MISSIONS
TECHNOLOGY MISSIONSTECHNOLOGY MISSIONS
TECHNOLOGY MISSIONS
 
Senior Design - Europa Mission Proposal
Senior Design - Europa Mission ProposalSenior Design - Europa Mission Proposal
Senior Design - Europa Mission Proposal
 
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
MEASUREMENT OF SURFACE TEMPERATURE OF A GLACIER USING AN UNMANNED AERIAL VEHI...
 
Senior Design - Europa Lander Mission Presentation
Senior Design - Europa Lander Mission PresentationSenior Design - Europa Lander Mission Presentation
Senior Design - Europa Lander Mission Presentation
 
F and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
F and G Taylor Series Solutions to the Circular Restricted Three-Body ProblemF and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
F and G Taylor Series Solutions to the Circular Restricted Three-Body Problem
 
GNSS Satellite System Basics by ASIM khan GNSS-7
GNSS Satellite System Basics  by ASIM khan GNSS-7GNSS Satellite System Basics  by ASIM khan GNSS-7
GNSS Satellite System Basics by ASIM khan GNSS-7
 
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
Modeling Geometry and Reference Systems on the Web of Data - LGD 2014
 
WE2.L10.4: OPERATION ICEBRIDGE: USING INSTRUMENTED AIRCRAFT TO BRIDGE THE OBS...
WE2.L10.4: OPERATION ICEBRIDGE: USING INSTRUMENTED AIRCRAFT TO BRIDGE THE OBS...WE2.L10.4: OPERATION ICEBRIDGE: USING INSTRUMENTED AIRCRAFT TO BRIDGE THE OBS...
WE2.L10.4: OPERATION ICEBRIDGE: USING INSTRUMENTED AIRCRAFT TO BRIDGE THE OBS...
 
2005-04-01 Combined Aerosol Trajectory Tool, CATT:Status Report on Tools Deve...
2005-04-01 Combined Aerosol Trajectory Tool, CATT:Status Report on Tools Deve...2005-04-01 Combined Aerosol Trajectory Tool, CATT:Status Report on Tools Deve...
2005-04-01 Combined Aerosol Trajectory Tool, CATT:Status Report on Tools Deve...
 
0412 Catt Report
0412 Catt Report0412 Catt Report
0412 Catt Report
 
Design and Evaluation of an Active Space Debris Removal Mission with Chemical...
Design and Evaluation of an Active Space Debris Removal Mission with Chemical...Design and Evaluation of an Active Space Debris Removal Mission with Chemical...
Design and Evaluation of an Active Space Debris Removal Mission with Chemical...
 
Spacecraft Formation Flying Navigation via a Novel Wireless Final
Spacecraft Formation Flying Navigation via a Novel Wireless FinalSpacecraft Formation Flying Navigation via a Novel Wireless Final
Spacecraft Formation Flying Navigation via a Novel Wireless Final
 
Myscience High Altitude Balloon Project
Myscience High Altitude Balloon ProjectMyscience High Altitude Balloon Project
Myscience High Altitude Balloon Project
 
FLARE Final Report
FLARE Final ReportFLARE Final Report
FLARE Final Report
 
Surveying Areas in Developing Regions Through Context Aware Drone Mobility
Surveying Areas in Developing Regions Through Context Aware Drone MobilitySurveying Areas in Developing Regions Through Context Aware Drone Mobility
Surveying Areas in Developing Regions Through Context Aware Drone Mobility
 

Similar to Aerospace applications of Perl

intro_gps.ppt
intro_gps.pptintro_gps.ppt
intro_gps.ppt
AtanuGhosh77
 
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
Chester Chen
 
Lecture 8: IoT System Models and Applications
Lecture 8: IoT System Models and ApplicationsLecture 8: IoT System Models and Applications
Lecture 8: IoT System Models and Applications
PayamBarnaghi
 
Using PostgreSQL for Flight Planning
Using PostgreSQL for Flight PlanningUsing PostgreSQL for Flight Planning
Using PostgreSQL for Flight Planning
Blake Crosby
 
Unifying Space Mission Knowledge with NLP & Knowledge Graph
Unifying Space Mission Knowledge with NLP & Knowledge GraphUnifying Space Mission Knowledge with NLP & Knowledge Graph
Unifying Space Mission Knowledge with NLP & Knowledge Graph
Vaticle
 
Modeling & Simulation of CubeSat-based Missions'Concept of Operations
Modeling & Simulation of CubeSat-based Missions'Concept of OperationsModeling & Simulation of CubeSat-based Missions'Concept of Operations
Modeling & Simulation of CubeSat-based Missions'Concept of Operations
Obeo
 
A Lightweight Infrastructure for Graph Analytics
A Lightweight Infrastructure for Graph AnalyticsA Lightweight Infrastructure for Graph Analytics
A Lightweight Infrastructure for Graph Analytics
Donald Nguyen
 
GPS introduction
GPS introductionGPS introduction
GPS introduction
Jayantha Samarasinghe
 
18-748 The Fleet - Initial Presentation
18-748 The Fleet - Initial Presentation18-748 The Fleet - Initial Presentation
18-748 The Fleet - Initial Presentation
Hsueh-Hung Cheng
 
Midterm Progress Report (Dynamic Sparse A-Star)
Midterm Progress Report (Dynamic Sparse A-Star)Midterm Progress Report (Dynamic Sparse A-Star)
Midterm Progress Report (Dynamic Sparse A-Star)
s3cur3
 
Day 6 - PostGIS
Day 6 - PostGISDay 6 - PostGIS
Day 6 - PostGIS
Barry Jones
 
480 GPS Tech presentaation.ppt
480 GPS Tech presentaation.ppt480 GPS Tech presentaation.ppt
480 GPS Tech presentaation.ppt
ssuser23e4af
 

Similar to Aerospace applications of Perl (20)

GPS.pdf
GPS.pdfGPS.pdf
GPS.pdf
 
intro_gps.ppt
intro_gps.pptintro_gps.ppt
intro_gps.ppt
 
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
SF Big Analytics 20191112: How to performance-tune Spark applications in larg...
 
Lecture 8: IoT System Models and Applications
Lecture 8: IoT System Models and ApplicationsLecture 8: IoT System Models and Applications
Lecture 8: IoT System Models and Applications
 
Using PostgreSQL for Flight Planning
Using PostgreSQL for Flight PlanningUsing PostgreSQL for Flight Planning
Using PostgreSQL for Flight Planning
 
Unifying Space Mission Knowledge with NLP & Knowledge Graph
Unifying Space Mission Knowledge with NLP & Knowledge GraphUnifying Space Mission Knowledge with NLP & Knowledge Graph
Unifying Space Mission Knowledge with NLP & Knowledge Graph
 
Modeling & Simulation of CubeSat-based Missions'Concept of Operations
Modeling & Simulation of CubeSat-based Missions'Concept of OperationsModeling & Simulation of CubeSat-based Missions'Concept of Operations
Modeling & Simulation of CubeSat-based Missions'Concept of Operations
 
Andrew Fage presentation
Andrew Fage   presentationAndrew Fage   presentation
Andrew Fage presentation
 
A Lightweight Infrastructure for Graph Analytics
A Lightweight Infrastructure for Graph AnalyticsA Lightweight Infrastructure for Graph Analytics
A Lightweight Infrastructure for Graph Analytics
 
GPS introduction
GPS introductionGPS introduction
GPS introduction
 
Presentation
PresentationPresentation
Presentation
 
Presentation
PresentationPresentation
Presentation
 
Presentation
PresentationPresentation
Presentation
 
Presentation
PresentationPresentation
Presentation
 
18-748 The Fleet - Initial Presentation
18-748 The Fleet - Initial Presentation18-748 The Fleet - Initial Presentation
18-748 The Fleet - Initial Presentation
 
Horizons doc
Horizons docHorizons doc
Horizons doc
 
SAADATMAND_PYTHON
SAADATMAND_PYTHONSAADATMAND_PYTHON
SAADATMAND_PYTHON
 
Midterm Progress Report (Dynamic Sparse A-Star)
Midterm Progress Report (Dynamic Sparse A-Star)Midterm Progress Report (Dynamic Sparse A-Star)
Midterm Progress Report (Dynamic Sparse A-Star)
 
Day 6 - PostGIS
Day 6 - PostGISDay 6 - PostGIS
Day 6 - PostGIS
 
480 GPS Tech presentaation.ppt
480 GPS Tech presentaation.ppt480 GPS Tech presentaation.ppt
480 GPS Tech presentaation.ppt
 

More from Ian Kluft

"#AprilFools Hijinks" at SVPerl April 2021 meeting
"#AprilFools Hijinks" at SVPerl April 2021 meeting"#AprilFools Hijinks" at SVPerl April 2021 meeting
"#AprilFools Hijinks" at SVPerl April 2021 meeting
Ian Kluft
 
Secure Coding in Perl
Secure Coding in PerlSecure Coding in Perl
Secure Coding in Perl
Ian Kluft
 
New Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentationNew Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentation
Ian Kluft
 
Securing a Raspberry Pi and other DIY IoT devices
Securing a Raspberry Pi and other DIY IoT devicesSecuring a Raspberry Pi and other DIY IoT devices
Securing a Raspberry Pi and other DIY IoT devices
Ian Kluft
 
Best Practices for Recovering Rocket & Balloon Payloads
Best Practices for Recovering Rocket & Balloon PayloadsBest Practices for Recovering Rocket & Balloon Payloads
Best Practices for Recovering Rocket & Balloon Payloads
Ian Kluft
 
PiFlash: Linux utility to flash SD cards for Raspberry Pi computers
PiFlash: Linux utility to flash SD cards for Raspberry Pi computersPiFlash: Linux utility to flash SD cards for Raspberry Pi computers
PiFlash: Linux utility to flash SD cards for Raspberry Pi computers
Ian Kluft
 
Code Generation in Perl
Code Generation in PerlCode Generation in Perl
Code Generation in Perl
Ian Kluft
 
Command Line Arguments with Getopt::Long
Command Line Arguments with Getopt::LongCommand Line Arguments with Getopt::Long
Command Line Arguments with Getopt::Long
Ian Kluft
 
Black Rock Desert Impact Theory
Black Rock Desert Impact TheoryBlack Rock Desert Impact Theory
Black Rock Desert Impact Theory
Ian Kluft
 
Exception Handling in Perl
Exception Handling in PerlException Handling in Perl
Exception Handling in Perl
Ian Kluft
 
Stratofox Aerospace Tracking Team presentation at Space Access 2013
Stratofox Aerospace Tracking Team presentation at Space Access 2013Stratofox Aerospace Tracking Team presentation at Space Access 2013
Stratofox Aerospace Tracking Team presentation at Space Access 2013
Ian Kluft
 
Pacificon 200905
Pacificon 200905Pacificon 200905
Pacificon 200905
Ian Kluft
 

More from Ian Kluft (12)

"#AprilFools Hijinks" at SVPerl April 2021 meeting
"#AprilFools Hijinks" at SVPerl April 2021 meeting"#AprilFools Hijinks" at SVPerl April 2021 meeting
"#AprilFools Hijinks" at SVPerl April 2021 meeting
 
Secure Coding in Perl
Secure Coding in PerlSecure Coding in Perl
Secure Coding in Perl
 
New Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentationNew Perl module Container::Buildah - SVPerl presentation
New Perl module Container::Buildah - SVPerl presentation
 
Securing a Raspberry Pi and other DIY IoT devices
Securing a Raspberry Pi and other DIY IoT devicesSecuring a Raspberry Pi and other DIY IoT devices
Securing a Raspberry Pi and other DIY IoT devices
 
Best Practices for Recovering Rocket & Balloon Payloads
Best Practices for Recovering Rocket & Balloon PayloadsBest Practices for Recovering Rocket & Balloon Payloads
Best Practices for Recovering Rocket & Balloon Payloads
 
PiFlash: Linux utility to flash SD cards for Raspberry Pi computers
PiFlash: Linux utility to flash SD cards for Raspberry Pi computersPiFlash: Linux utility to flash SD cards for Raspberry Pi computers
PiFlash: Linux utility to flash SD cards for Raspberry Pi computers
 
Code Generation in Perl
Code Generation in PerlCode Generation in Perl
Code Generation in Perl
 
Command Line Arguments with Getopt::Long
Command Line Arguments with Getopt::LongCommand Line Arguments with Getopt::Long
Command Line Arguments with Getopt::Long
 
Black Rock Desert Impact Theory
Black Rock Desert Impact TheoryBlack Rock Desert Impact Theory
Black Rock Desert Impact Theory
 
Exception Handling in Perl
Exception Handling in PerlException Handling in Perl
Exception Handling in Perl
 
Stratofox Aerospace Tracking Team presentation at Space Access 2013
Stratofox Aerospace Tracking Team presentation at Space Access 2013Stratofox Aerospace Tracking Team presentation at Space Access 2013
Stratofox Aerospace Tracking Team presentation at Space Access 2013
 
Pacificon 200905
Pacificon 200905Pacificon 200905
Pacificon 200905
 

Recently uploaded

Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
dxobcob
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
An Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering TechniquesAn Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering Techniques
ambekarshweta25
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
camseq
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
drwaing
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
ChristineTorrepenida1
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
Dr Ramhari Poudyal
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 

Recently uploaded (20)

Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
一比一原版(Otago毕业证)奥塔哥大学毕业证成绩单如何办理
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
An Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering TechniquesAn Approach to Detecting Writing Styles Based on Clustering Techniques
An Approach to Detecting Writing Styles Based on Clustering Techniques
 
Modelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdfModelagem de um CSTR com reação endotermica.pdf
Modelagem de um CSTR com reação endotermica.pdf
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
digital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdfdigital fundamental by Thomas L.floydl.pdf
digital fundamental by Thomas L.floydl.pdf
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
Unbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptxUnbalanced Three Phase Systems and circuits.pptx
Unbalanced Three Phase Systems and circuits.pptx
 
Literature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptxLiterature Review Basics and Understanding Reference Management.pptx
Literature Review Basics and Understanding Reference Management.pptx
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 

Aerospace applications of Perl

  • 1. Aerospace Applications of Perl Presented by Ian Kluft Silicon Valley Perl Santa Clara, California March 3, 2016
  • 2. Aerospace Applications of Perl ● Perl and its libraries on CPAN are versatile ● Aerospace applications cover lots of topics – Navigation/mapping – Aviation – Satellites – Astronomy ● Also some examples from my own projects
  • 3. Introducing the presenter ● Hi! I'm Ian Kluft ● From San Jose and a native of the Bay Area ● Software engineer – Primarily Perl & C/C++ on servers & embedded/IoT – Perl is my favorite language ● Currently working on my MBA ● Aerospace enthusiast – Commerical pilot & flight instructor – Co-founder of Stratofox Aerospace Tracking Team – Participated in world records for amateur aerospace ● 1st amateur rocket launch to space (CSXT 2004, Nevada) ● 1st transcontinental/transoceanic Ham Radio balloon (CNSP 2011)
  • 4. Navigation & Mapping ● I presented a year ago at SVPerl on Geographic Computation ● Quick overview here because positioning is integral to aerospace – Next 7 slides are a review from last year's presentation ● Then we'll move on to look at aviation, satellites & astronomy
  • 5. Coordinate system Latitude and longitude ● Any position on Earth has a coordinate ● 3-dimensional positioning uses 3 numbers – Latitude (north/south) – Longitude (east/west) – Altitude (relative to mean sea level/MSL) ● Latitude & longitude are specified in degrees ● Altitude is specified in distance
  • 6. Latitude and longitude What kind of degrees? ● Not from a university ● Not related to temperature ● They are angles! ● More precisely, angles from the center of the Earth ● Latitude = 0-90° up or down ● Longitude = 0-180° either way around
  • 7. 7 Earth is not a perfect sphere ● Earth is an ellipsoid: bulges out at equator – Centrifugal force from rotation causes this ● Geoid: mathematical models for Earth ellipsoid – Good models come from satellite measurement ● Coordinates must use the same geographic reference system – Otherwise comparing apples and oranges – WGS84 most widely used coordinate system today ● Sea level and altitude are relative to this model
  • 8. 8 Lots of angles in Geospatial Data ● Many computations involve angles – Latitude and longitude are angles ● Manipulations use trigonometric functions ● Trig functions use radians – So numbers in degrees must be converted to and from radians – One circle = 360 degrees = 2 * pi radians – Radians derive 2 * pi from distance around circle relative to radius ● Math::Trig module on CPAN can do this for you
  • 9. 9 Great Circle Routes ● Great Circle: direct route over Earth's surface – Along a line that goes around the sphere – i.e. from San Jose to London crosses Greenland – Flat-projection maps distort great circle routes to look like curves Map generated by the Great Circle Mapper copyright © Karl L. Swartz. http://www.gcmap.com/
  • 10. 10 Great Circle Formulas ● See “Aviation Formulary” site http://williams.best.vwh.net/avform.htm ● Distance between points ● Course between points ● Latitude of point on GC ● Lat/lon given radial & dist ● Intersection of 2 radials ● Max latitude of a GC ● GC crossing a parallel ● Intermediate points on a GC ● Cross track error ● Along track distance ● Point known offset from GC Many of these are in Math::Trig
  • 11. 11 Example: Great Circle Distance between points ● From scratch: d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2)) ● In Perl: use Math::Trig 'great_circle_distance'; $distance = great_circle_distance($lon1, $lat1, $lon2, $lat2, $radius); ● Convert angles to radians ● For the radius of the Earth, use 6366.71 km – Don't forget to convert result from km to miles if needed
  • 12. 12 Navigation related Perl modules ● Net::GPSD3 – connect to GPSD v3 server so multiple processes can use a single GPS on laptop, IoT, drone, etc ● Geo::Coder – use online search sites to look up address of current location ● Geo::Cache – Look up geocaching sites nearby ● Ham::APRS::IS – receive Ham Radio APRS positioning data, open-sourced by the APRS.FI Ham Radio tracking web site ● Many more
  • 13. 13 Aviation applications ● Adding to the navigation/planning capabilities… ● Geo::METAR – decode text from airport weather observations ● Geo::TAF – decode text from airport weather forecasts ● Geo::ICAO – encode/decode international airport codes ● And other variants of these
  • 14. 14 Aviation example: METAR weather observation (1/5) #!/usr/bin/perl use strict; use warnings; use Getopt::Long; use LWP::UserAgent; use HTTP::Response; use XML::Simple; my $url = "http://www.aviationweather.noaa.gov/adds/dataserver_current/httpparam? dataSource=metars&requestType=retrieve&format=xml&stationString=%s&hoursBeforeNow=4"; my @metar_fields = qw(observation_time temp_c dewpoint_c wind_dir_degrees wind_speed_kt wind_gust_kt visibility_statute_mi altim_in_hg sea_level_pressure_mb three_hr_pressure_tendency_mb wx_string sky_condition vert_vis_ft maxT_c minT_c maxT24hr_c minT24hr_c precip_in pcp3hr_in pcp6hr_in pcp24hr_in snow_in quality_control_flags flight_category ); my $ua = LWP::UserAgent->new();
  • 15. 15 Aviation example: METAR weather observation (2/5)# convert temperature C to C & F sub tempC2CF { my ( $tempc ) = @_; my $tempf = int($tempc * 9 / 5 + 32 + .5); # .5 = round off return sprintf "%dC/%dF", $tempc, $tempf; } # turn a sky condition structure into a string sub sky2str { my ( $sky ) = @_; if ( ref $sky eq "ARRAY" ) { # handle arrays of cloud layers by recursive calls my @result; foreach my $layer ( @$sky ) { push @result, sky2str( $layer ); } return join " ", @result; } # report cloud layer return $sky->{sky_cover}."@".$sky->{cloud_base_ft_agl}; }
  • 16. 16 Aviation example: METAR weather observation (3/5) # get_metar function - download METAR by airport code sub get_metar { my ( $code ) = @_; my $url_with_code = sprintf( $url, $code ); print $url_with_code."n"; my $response = $ua->get( $url_with_code ); if ( $response->is_error()) { printf "%s failed: %sn", $code, $response- >status_line; } else { my $content = $response->content(); my $metar_tree = XMLin( $content ); print "$code:n"; if ((!exists $metar_tree→{data})or (!exists $metar_tree→}) or (!exists $metar_tree->{data}{METAR})) { print "unrecognized data: $contentn"; } else { my $metar_ref = $metar_tree->{data}{METAR}; foreach my $metar ( @$metar_ref ) { foreach my $field ( @metar_fields ) { if ( exists $metar->{$field}) { if ( $field eq "observation_time" ) { print $metar->{$field}." "; } elsif ( $field eq "sky_condition" ) { print "sky: ".sky2str($metar->{$field})." "; } elsif ( $field =~ /^(.*)_c$/ ) { my $name = $1; print "$name:".tempC2CF($metar->{$field})." "; } elsif ( $field =~ /^(.*)_(kt|statute_mi|in_hg|degrees) $/ ) { my $name = $1; my $unit = $2; print "$name:".$metar->{$field}."$unit "; } else { print "$field:".$metar->{$field}." "; } } } print "n"; } } } }
  • 17. 17 Aviation example: METAR weather observation (4/5) # main - get airport codes from command line, loop through them and get METARs my $arg; foreach $arg ( @ARGV ) { get_metar( $arg ); }
  • 18. 18 Aviation example: METAR weather observation (5/5) ● Example usage: get_metar KRHV krhv: 2016-03-04T01:51:00Z temp:19C/66F dewpoint:14C/57F wind_dir:320degrees wind_speed:4kt visibility:10.0statute_mi altim:30.050198in_hg sky: OVC@5000 flight_category:VFR 2016-03-04T00:51:00Z temp:19C/66F dewpoint:14C/57F wind_dir:0degrees wind_speed:4kt visibility:10.0statute_mi altim:30.050198in_hg sky: OVC@3500 flight_category:VFR 2016-03-03T23:53:00Z temp:21C/70F dewpoint:13C/55F wind_dir:320degrees wind_speed:11kt visibility:10.0statute_mi altim:30.041338in_hg sky: BKN@4000 OVC@6000 flight_category:VFR 2016-03-03T22:53:00Z temp:22C/72F dewpoint:13C/55F wind_dir:0degrees wind_speed:4kt visibility:10.0statute_mi altim:30.059055in_hg sky: BKN@4000 OVC@6000 flight_category:VFR
  • 19. 19 Satellite tracking ● Why would you want to track a satellite? – See visible passes of International Space Station (or Iridium Flares), nighttime only – Ham Radio communication via OSCARs (Orbiting Satellite Carrying Amateur Radio), day or night – If you make a commercial or research satellite, you'll build your own ground station, day or night ● Astro::SpaceTrack – downloads satellite orbital elements ● Astro::satpass – makes satellite pass predictions ● Astro::App::SatPass2 – makes satellite pass predictions
  • 20. 20 Astronomy ● Astro::Sunrise – compute sunrise/sunset for your location/date ● Astro::MoonPhase – compute phase of the moon for a date ● Astro::Telescope – for astronomers accessing remote telescopes ● Various celestial database searches
  • 21. 21 Example: Missing rocket payload at Black Rock Desert Location: Black Rock Desert, Nevada Problem: Rocket launched, payload missing ● Soka University (Japan) students needed data ● Payload was a “CanSat”, size of a soda can ● AeroPac club knew rocket landing coordinates ● Turned to Stratofox Aerospace Tracking Team ● Transmitter batteries died before they contacted us ● I wrote a Perl script to generate a grid search
  • 22. 22 Perl Script to Plot Search Grid ● Search area was 3x3 mile parallelogram – Top/bottom side east-west for typical non-storm wind direction – Right/left sides NNE/SSW for typical storm wind direction ● Each side divided into 10 sections, 1584' long ● 10x10 loop projects each computed waypoint ● Command-line controls output to text or GPX ● “gpsbabel” open source utility turns GPX into many formats – Raw Garmin waypoint data for upload to GPS – KML for display on Google Earth
  • 23. 23 Projecting Search Grid Waypoints ● Nested loop: i = 0-10 over, j = 0-10 up ● Over = 270° heading, up = 330° heading ● Convert lat/lon from degrees to radians ● Use Great Circle projection formula – Compute intermediate point from i “over” – Compute final point from j “up” ● Convert new lat/lon from radians to degrees ● Code available at slideshare.com with slides
  • 24. 24 Sample code convert feet to radians ● Convert distance in feet to radians over Earth's surface ● Radians are angles – this is a tiny angle from center of Earth # conversion: distance in feet to radians sub dist_ft2rad { my $ft = shift; my $km = $ft / 3280.8399; # ft/km return $km/6371.0; # divide by FAI standard Earth radius in km }
  • 25. 25 Sample code compute waypoint from course & distance sub gc_waypoint { my $lat1 = shift; # latitude (radians) my $lon1 = shift; # longitude (radians) my $tc = shift; # true course (radians) my $d = shift; # distance (radians) my $lat = asin(sin($lat1)*cos($d)+cos($lat1)*sin($d)*cos($tc)); my $dlon = atan2(sin($tc)*sin($d)*cos($lat1),cos($d)-sin($lat1)*sin($lat)); my $lon=fmod($lon1-$dlon+pi,2*pi) - pi; return ( $lat, $lon ); # lat/lon in radians }
  • 26. 26 Example code compute coordinates of search grid point # project a waypoint in the search area # shape of a parallelogram with sides at headings 030 (NNE) and 090 (east) # sides are on heading 1 (030 degrees) and heading 2 (090 degrees) # increments are 0-10 # each increment is 1584 ft so that 10 of them is 3 miles sub project_waypoint { my $h1_inc = shift; my $h2_inc = shift; # compute intermediate point on the first side of parallelogram my ( $lat_r1, $lon_r1 ) = gc_waypoint ( deg2rad( $point_start[0]), deg2rad( $point_start[1]), $h1_heading, $rad_per_increment * $h1_inc );
  • 27. 27 Example code (continued) compute coordinates of search grid point # compute final projected waypoint in search area my ( $lat_r2, $lon_r2 ) = gc_waypoint ( $lat_r1, $lon_r1, $h2_heading, $rad_per_increment * $h2_inc ); # convert radians to degrees my $lat = rad2deg( $lat_r2 ); my $lon = rad2deg( $lon_r2 ); return ( $lat, $lon ); }
  • 28. 28 Search Area Grid Map Result of the script shown on Google Earth
  • 29. 29 Result: Success!!! Expected to be worse than needle in a haystack Payload found 2500' west of rocket landing site
  • 30. 30 Conclusions ● The sky is not the limit ● You can have fun and learn a lot solving problems like these Q & A