This is a local php based display tool for mini rogallo data. Positions, altitudes and headings are relayed to natrium42's tracker. [[http://www.gjcp.net/~laurenceb/minirog.php|Demo with static logfile]] Launch#placeLaunch location was... at...absolute','FlightPath#track1absolute','PositionNow#placeCurrent Position is... at...absolute',''); $kml_file="/home/laurence/Documents/earth_viewer/every5.kml"; $update_time=5; //refresh every x seconds echo "Mini Rogallo"; $HTTP_SESSION_VARS ["time"]++; //we ran again $DataSet_headings = new pData; $DataSet_positions = new pData; $DataSet_voltage = new pData; $DataSet_temperature = new pData; $date_string=substr(str_replace("-","",date("c")),0,8); $callsign="UKHAS"; $logfile = "/home/laurence/.fldigi/fldigi".$date_string.".log"; $fh = fopen($logfile, "r") or die("Cant open the logfile"); $theData = fread($fh, filesize($logfile)); fclose($fh); $offset=0; $telemlenght=80; $firstpos=strpos($theData,$callsign); $gnd=''; $status="ascending"; $maxalt=0; $numberofpackets=0; $firstposition=1; while($firstpos) //we have found another header { $offset=$firstpos; $firstpos=strpos($theData,$callsign,$offset+1); $ourstring=substr($theData,$offset,$telemlenght); $substrings=split(",",$ourstring,13); $checksum=0; //zero this ready for our count $stringpasses=FALSE; //this will be set to true if all conditions met if($substrings[0]=="UKHAS>" or $substrings[0]=="UKHAS-") //the short lenght packet $thelenght=8; elseif($substrings[0]=="UKHAS<") { //the long packet $thelenght=12; if(count($substrings)>=6) { $up=floatval($substrings[5]); if($up<=200) $thelenght++; //the ground control status increases packet lenght } } else $thelenght=200; //nothing can run if we have a dodgy header if(count($substrings)>=$thelenght) //are there enough variables { for($n=1;$n<($thelenght-1);$n++) { for($m=0;$mAddPoint($north*6378-$takeoffnorth,"Serie1"); //North in KM $DataSet_positions->AddPoint($east*6378*cos($east)-$takeoffeast,"Serie2"); //East in Km $DataSet_positions->AddPoint($up,"Serie3"); //Altitude if($substrings[0]=="UKHAS<") { $status="descending"; $headings[]=floatval($substrings[5]); $targets[]=floatval($substrings[6]); $headingsf[]=floatval($substrings[7]); $rates[]=floatval($substrings[8]); if($up<200) { $DataSet_voltage->Addpoint(floatval($substrings[10]),"Serie1"); $DataSet_temperature->AddPoint(floatval($substrings[11]),"Serie1");//Bat voltage, Internal temperature $gnd=$substrings[9]; } else { $DataSet_voltage->AddPoint(floatval($substrings[9]),"Serie1"); $DataSet_temperature->AddPoint(floatval($substrings[10]),"Serie1"); } } else { $DataSet_voltage->Addpoint(floatval($substrings[5]),"Serie1"); if($substrings[6]!=="0") $DataSet_temperature->AddPoint(floatval($substrings[6]),"Serie1");//Bat voltage, Internal temperature if($status=="descending") $status="touchdown!"; } if(floatval($up)>$maxalt) $maxalt=floatval($up); $numberofpackets++; //we have got a new packet if($numberofpackets>$HTTP_SESSION_VARS ["packets"] ) { $HTTP_SESSION_VARS ["time"]=0; $HTTP_SESSION_VARS ["packets"]=$numberofpackets; $request = 'http://spacenear.us/tracker/track'; //send to natrium42 tracker $format = 'php'; // this can be xml, json, html, or php $args .= 'vehicle='.$callsign; $args .= '&time=0'; $args .= '&lat='.$north*57.29577951; $args .= '&lon='.$east*57.29577951; $args .= '&alt='.$up; if($substrings[0]=="UKHAS<") $args .= '&heading='.$substrings[10]; else $args .= '&heading=0'; $args .= '&speed=0'; $args .= '&pass='.$pass; // Get and config the curl session object $session = curl_init($request.'.'.$format.'?'.$args); curl_setopt($session, CURLOPT_HEADER, false); curl_setopt($session, CURLOPT_RETURNTRANSFER, true); //execute the request and close ob_start(); $response = curl_exec($session); ob_end_clean(); curl_close($session); unset($response); $newdata=TRUE; } else $newdata=FALSE; } } for($n=count($headings)-1;$n>count($headings)-21;$n--) //The last 20 seconds { $DataSet_headings->AddPoint($headings[$n]*57.295,"Serie1"); $DataSet_headings->AddPoint($headingsf[$n]*57.295,"Serie2"); $DataSet_headings->AddPoint($rates[$n]*57.295,"Serie3"); $DataSet_headings->AddPoint($targets[$n]*57.295,"Serie4"); } $link="View in Google maps"; if($newdata){ $DataSet_headings->AddAllSeries(); $DataSet_headings->SetAbsciseLabelSerie(); $DataSet_headings->SetSerieName("GPS","Serie1"); $DataSet_headings->SetSerieName("Filtered","Serie2"); $DataSet_headings->SetSerieName("Turn Rate","Serie3"); $DataSet_headings->SetSerieName("Target","Serie4"); // Initialise the graph $Test = new pChart(700,230); $Test->setFontProperties("php_includes/Fonts/tahoma.ttf",8); $Test->setGraphArea(70,30,680,200); $Test->drawGraphArea(213,217,221,FALSE); $Test->drawGraphAreaGradient(30,30,30,-50); $Test->setFixedScale(-180,180,6,0,$numberofpackets,20); $Test->drawScale($DataSet_headings->GetData(),$DataSet_headings->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2); $Test->drawGrid(4,TRUE,230,230,230,20); // Draw the 0 line $Test->setFontProperties("php_includes/Fonts/tahoma.ttf",6); $Test->drawTreshold(0,143,55,72,TRUE,TRUE); // Draw the line graph $Test->drawLineGraph($DataSet_headings->GetData(),$DataSet_headings->GetDataDescription()); $Test->clearShadow(); // Finish the graph $Test->setFontProperties("php_includes/Fonts/tahoma.ttf",8); $Test->drawLegend(75,35,$DataSet_headings->GetDataDescription(),255,255,255); $Test->setFontProperties("php_includes/Fonts/tahoma.ttf",10); $Test->drawTitle(60,22,"Heading - last 20 seconds",50,50,50,585); $Test->Render("Headings.png"); unset($Test); $DataSet_headings->RemoveSerie("Serie1","Serie2","Serie3"); //the position graph $DataSet_positions->AddSerie("Serie1","Serie2"); $DataSet_positions->SetSerieName("Position","Serie1"); $DataSet_positions->SetXAxisName("East (Km)"); $DataSet_positions->SetYAxisName("North (Km)"); // Initialise the graph $Test2 = new pChart(300,300); $Test2->drawGraphAreaGradient(0,0,0,-100,TARGET_BACKGROUND); // Prepare the graph area $Test2->setFontProperties("php_includes/Fonts/tahoma.ttf",8); $Test2->setGraphArea(55,30,270,230); $Test2->drawXYScale($DataSet_positions->GetData(),$DataSet_positions->GetDataDescription(),"Serie1","Serie2",213,217,221,TRUE,45); $Test2->drawGraphArea(213,217,221,FALSE); $Test2->drawGraphAreaGradient(30,30,30,-50); $Test2->drawGrid(4,TRUE,230,230,230,20); // Draw the chart $Test2->setShadowProperties(2,2,0,0,0,60,4); $Test2->drawXYGraph($DataSet_positions->GetData(),$DataSet_positions->GetDataDescription(),"Serie1","Serie2",0); $Test2->clearShadow(); // Draw the title $Title = "Rogallo position: "; $Title.= strval($north*57.29577951); $Title.= ","; $Title.= strval($east*57.29577951); $Test2->drawTextBox(0,280,300,300,$Title,0,255,255,255,ALIGN_LEFT,TRUE,0,0,0,30); //draw altitude box $title = "Altitude:"; $title.= strval(floatval($up)/1000); $title.= " Km, Max:"; $title.= strval(floatval($maxalt)/1000); $title.= " Km"; $Test2->drawTextBox(0,0,300,30,$title,0,255,255,255,ALIGN_CENTER,TRUE,0,0,0,30); // Draw the legend $Test2->setFontProperties("php_includes/Fonts/pf_arma_five.ttf",6); $Test2->drawLegend(5,260,$DataSet_positions->GetDataDescription(),0,0,0,0,0,0,255,255,255,FALSE); $Test2->Render("Positions.png"); $DataSet_positions->RemoveSerie("Serie1","Serie2"); //the data plots //the temperature $DataSet_temperature->AddSerie("Serie1"); $DataSet_temperature->SetAbsciseLabelSerie(); $DataSet_temperature->SetSerieName("Temperature (C)","Serie1"); // Initialise the graph $Test3 = new pChart(400,150); $Test3->setFontProperties("php_includes/Fonts/tahoma.ttf",8); $Test3->setGraphArea(30,10,390,130); $Test3->drawGraphArea(213,217,221,FALSE); $Test3->drawGraphAreaGradient(30,30,30,-50); $Test3->drawScale($DataSet_temperature->GetData(),$DataSet_temperature->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2,FALSE,120); //$Test3->drawGrid(1,TRUE,230,230,230,20); // Draw the 0 line $Test3->setFontProperties("php_includes/Fonts/tahoma.ttf",6); $Test3->drawTreshold(0,143,55,72,TRUE,TRUE); // Draw the line graph $Test3->drawLineGraph($DataSet_temperature->GetData(),$DataSet_temperature->GetDataDescription()); $Test3->clearShadow(); // Finish the graph $Test3->setFontProperties("php_includes/Fonts/tahoma.ttf",8); $Test3->drawLegend(35,14,$DataSet_temperature->GetDataDescription(),255,255,255); $Test3->setFontProperties("php_includes/Fonts/tahoma.ttf",10); $Test3->Render("Temperature.png"); unset($Test3); //voltage $DataSet_voltage->RemoveSerie("Serie2"); $DataSet_voltage->AddSerie("Serie1"); $DataSet_voltage->SetAbsciseLabelSerie(); $DataSet_voltage->SetSerieName("Battery voltage","Serie1"); // Initialise the graph $Test4 = new pChart(400,150); $Test4->setFontProperties("php_includes/Fonts/tahoma.ttf",8); $Test4->setGraphArea(30,10,390,130); $Test4->drawGraphArea(213,217,221,FALSE); $Test4->drawGraphAreaGradient(30,30,30,-50); $Test4->setFixedScale(5.5,8.5,6,0,$numberofpackets,20); $Test4->drawScale($DataSet_voltage->GetData(),$DataSet_voltage->GetDataDescription(),SCALE_START0,150,150,150,TRUE,0,2,FALSE,120); //$Test3->drawGrid(1,TRUE,230,230,230,20); // Draw the 0 line $Test4->setFontProperties("php_includes/Fonts/tahoma.ttf",6); $Test4->drawTreshold(0,143,55,72,TRUE,TRUE); // Draw the line graph $Test4->drawLineGraph($DataSet_voltage->GetData(),$DataSet_voltage->GetDataDescription()); $Test4->clearShadow(); // Finish the graph $Test4->setFontProperties("php_includes/Fonts/tahoma.ttf",8); $Test4->drawLegend(35,14,$DataSet_voltage->GetDataDescription(),255,255,255); $Test4->setFontProperties("php_includes/Fonts/tahoma.ttf",10); $Test4->Render("Voltage.png"); //now make the updated kml $fkml = fopen($kml_file, "w") or die("Cant open the kml file"); fprintf($fkml,"%s%f,%f,%f%s",$kml[0],$east_kml[0],$north_kml[0],$altitude_kml[0],$kml[1]); for($k=0;$k