kopia lustrzana https://github.com/projecthorus/chasemapper
Summary bar working and tested on live data
rodzic
5f9dc077ab
commit
907c983140
|
@ -109,6 +109,8 @@ function add_new_balloon(data){
|
|||
}
|
||||
|
||||
function updateSummaryDisplay(){
|
||||
|
||||
if (chase_config['unitselection'] == "imperial1") {updateSummaryDisplayImperial1() ; return ; } // else do everything in metric
|
||||
// Update the 'Payload Summary' display.
|
||||
var _summary_update = {id:1};
|
||||
// See if there is any payload data.
|
||||
|
@ -151,6 +153,54 @@ function updateSummaryDisplay(){
|
|||
$("#summary_table").tabulator("redraw", true);
|
||||
}
|
||||
}
|
||||
function updateSummaryDisplayImperial1(){
|
||||
|
||||
// Update the 'Payload Summary' display.
|
||||
var _summary_update = {id:1};
|
||||
// See if there is any payload data.
|
||||
if (balloon_positions.hasOwnProperty(balloon_currently_following) == true){
|
||||
// There is balloon data!
|
||||
var _latest_telem = balloon_positions[balloon_currently_following].latest_data;
|
||||
|
||||
_summary_update.alt = (_latest_telem.position[2]*chase_config['m_to_ft']).toFixed(0) + "ft (" + (_latest_telem.max_alt*chase_config['m_to_ft']).toFixed(0) + "ft)";
|
||||
var _speed = _latest_telem.speed*3.6 ;
|
||||
_summary_update.speed = (_speed*chase_config['km_to_miles']).toFixed(0) + " mph";
|
||||
_summary_update.vel_v = (_latest_telem.vel_v*chase_config['m_to_ft']/chase_config['secs_to_mins']).toFixed(0) + " ft/min";
|
||||
|
||||
|
||||
if (chase_car_position.latest_data.length == 3){
|
||||
// We have a chase car position! Calculate relative position.
|
||||
var _bal = {lat:_latest_telem.position[0], lon:_latest_telem.position[1], alt:_latest_telem.position[2]};
|
||||
var _car = {lat:chase_car_position.latest_data[0], lon:chase_car_position.latest_data[1], alt:chase_car_position.latest_data[2]};
|
||||
|
||||
var _look_angles = calculate_lookangles(_car, _bal);
|
||||
|
||||
_summary_update.elevation = _look_angles.elevation.toFixed(0) + "°";
|
||||
_summary_update.azimuth = _look_angles.azimuth.toFixed(0) + "°";
|
||||
if (_look_angles.range > chase_config['switch_miles_feet']) {
|
||||
_summary_update.range = (_look_angles.range*chase_config['km_to_miles']/1000).toFixed(1) + "miles";
|
||||
} else {
|
||||
_summary_update.range = (_look_angles.range*chase_config['m_to_ft']).toFixed(1) + "ft";
|
||||
}
|
||||
}else{
|
||||
// No Chase car position data - insert dummy values
|
||||
_summary_update.azimuth = "---°";
|
||||
_summary_update.elevation = "--°";
|
||||
_summary_update.range = "----m";
|
||||
}
|
||||
|
||||
}else{
|
||||
// No balloon data!
|
||||
_summary_update = {id: 1, alt:'-----m', speed:'---kph', vel_v:'-.-m/s', azimuth:'---°', elevation:'--°', range:'----m'}
|
||||
}
|
||||
// Update table
|
||||
$("#summary_table").tabulator("setData", [_summary_update]);
|
||||
if (summary_enlarged == true){
|
||||
var row = $("#summary_table").tabulator("getRow", 1);
|
||||
row.getElement().addClass("largeTableRow");
|
||||
$("#summary_table").tabulator("redraw", true);
|
||||
}
|
||||
}
|
||||
|
||||
function handleTelemetry(data){
|
||||
// Telemetry Event messages contain a dictionary of position data.
|
||||
|
@ -345,4 +395,4 @@ function showBalloon(callsign){
|
|||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,9 +145,11 @@ function telemetryTableDialog(e, row){
|
|||
divObj.dialog('open');
|
||||
}
|
||||
|
||||
|
||||
// Initialise tables
|
||||
function initTables(){
|
||||
// Telemetry data table
|
||||
if (chase_config['unitselection'] == "imperial1") {initTablesImperial1() ; return ; } // else do everything in metric
|
||||
$("#telem_table").tabulator({
|
||||
layout:"fitData",
|
||||
layoutColumnsOnNewData:true,
|
||||
|
@ -203,10 +205,68 @@ function initTables(){
|
|||
$("#bearing_table").hide();
|
||||
}
|
||||
|
||||
// Initialise tables in Imperial1 - Vertical velocity feet/min, Horizontal velocity Miles/hr, Range Miles then feet for Range < config setting
|
||||
function initTablesImperial1(){
|
||||
// Telemetry data table
|
||||
$("#telem_table").tabulator({
|
||||
layout:"fitData",
|
||||
layoutColumnsOnNewData:true,
|
||||
//selectable:1, // TODO...
|
||||
columns:[ //Define Table Columns
|
||||
{title:"Callsign", field:"callsign", headerSort:false},
|
||||
{title:"Time (Z)", field:"short_time", headerSort:false},
|
||||
{title:"Latitude", field:"lat", headerSort:false},
|
||||
{title:"Longitude", field:"lon", headerSort:false},
|
||||
{title:"Alt (ft)", field:"alt", headerSort:false},
|
||||
{title:"V_rate (ft/min)", field:"vel_v", headerSort:false},
|
||||
{title:"SNR", field:'snr', headerSort:false, visible:false},
|
||||
{title:"Aux", field:'aux', headerSort:false, visible:false}
|
||||
],
|
||||
rowClick:function(e, row){telemetryTableDialog(e, row);},
|
||||
rowTap:function(e, row){telemetryTableDialog(e, row);}
|
||||
|
||||
});
|
||||
|
||||
$("#summary_table").tabulator({
|
||||
layout:"fitData",
|
||||
layoutColumnsOnNewData:true,
|
||||
columns:[ //Define Table Columns
|
||||
{title:"Alt (ft)", field:"alt", headerSort:false},
|
||||
{title:"Speed (mph)", field:"speed", headerSort:false},
|
||||
{title:"Asc Rate (ft/min)", field:"vel_v", headerSort:false},
|
||||
{title:"Azimuth", field:"azimuth", headerSort:false},
|
||||
{title:"Elevation", field:"elevation", headerSort:false},
|
||||
{title:"Range", field:"range", headerSort:false},
|
||||
],
|
||||
data:[{id: 1, alt:'-----ft', speed:'---mph', vel_v:'---ft/min', azimuth:'---°', elevation:'--°', range:'----miles'}],
|
||||
rowClick:function(e, row){
|
||||
toggleSummarySize();
|
||||
},
|
||||
rowTap:function(e, row){
|
||||
toggleSummarySize();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$("#bearing_table").tabulator({
|
||||
layout:"fitData",
|
||||
layoutColumnsOnNewData:true,
|
||||
//selectable:1, // TODO...
|
||||
columns:[ //Define Table Columns
|
||||
{title:"Bearing", field:"bearing", headerSort:false},
|
||||
{title:"Score", field:'confidence', headerSort:false},
|
||||
{title:"Power", field:'power', headerSort:false}
|
||||
],
|
||||
data:[{id: 1, bearing:0.0, confidence:0.0}]
|
||||
});
|
||||
|
||||
$("#bearing_table").hide();
|
||||
}
|
||||
|
||||
|
||||
function updateTelemetryTable(){
|
||||
var telem_data = [];
|
||||
|
||||
if (chase_config['unitselection'] == "imperial1") {initTablesImperial1() ; return ; } // else do everything in metric
|
||||
if (jQuery.isEmptyObject(balloon_positions)){
|
||||
telem_data = [{callsign:'None'}];
|
||||
}else{
|
||||
|
@ -244,4 +304,46 @@ function updateTelemetryTable(){
|
|||
}
|
||||
|
||||
$("#telem_table").tabulator("setData", telem_data);
|
||||
}
|
||||
}
|
||||
|
||||
function updateTelemetryTableImperial1(){
|
||||
var telem_data = [];
|
||||
if (chase_config['unitselection'] == "imperial1") {initTablesImperial1() ; return ; } // else do everything in metric
|
||||
if (jQuery.isEmptyObject(balloon_positions)){
|
||||
telem_data = [{callsign:'None'}];
|
||||
}else{
|
||||
for (balloon_call in balloon_positions){
|
||||
var balloon_call_data = Object.assign({},balloon_positions[balloon_call].latest_data);
|
||||
var balloon_call_age = balloon_positions[balloon_call].age;
|
||||
|
||||
// Modify some of the fields to fixed point values.
|
||||
balloon_call_data.lat = balloon_call_data.position[0].toFixed(5);
|
||||
balloon_call_data.lon = balloon_call_data.position[1].toFixed(5);
|
||||
balloon_call_data.alt = (balloon_call_data.position[2]*chase_config['m_to_ft']).toFixed(1) + " (" + (balloon_call_data.max_alt*chase_config['m_to_ft']).toFixed(0) + ")" ;
|
||||
balloon_call_data.vel_v = (balloon_call_data.vel_v*chase_config['m_to_ft']/chase_config['secs_to_mins']).toFixed(1);
|
||||
|
||||
// Add in any extra data to the aux field.
|
||||
balloon_call_data.aux = "";
|
||||
balloon_call_data.snr = "";
|
||||
|
||||
if (balloon_call_data.hasOwnProperty('bt')){
|
||||
if ((balloon_call_data.bt >= 0) && (balloon_call_data.bt < 65535)) {
|
||||
balloon_call_data.aux += "BT " + new Date(balloon_call_data.bt*1000).toISOString().substr(11, 8) + " ";
|
||||
$("#telem_table").tabulator("showColumn", "aux");
|
||||
}
|
||||
}
|
||||
|
||||
if (balloon_positions[balloon_call].hasOwnProperty('snr')){
|
||||
if (balloon_positions[balloon_call].snr > -255.0){
|
||||
balloon_call_data.snr = balloon_positions[balloon_call].snr.toFixed(1);
|
||||
$("#telem_table").tabulator("showColumn", "snr");
|
||||
}
|
||||
}
|
||||
|
||||
// Update table
|
||||
telem_data.push(balloon_call_data);
|
||||
}
|
||||
}
|
||||
|
||||
$("#telem_table").tabulator("setData", telem_data);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue