Board index FlightGear Support Interfacing

Webpanel design questions

Connecting two computers, using generic protocol, connecting with Matlab?

Webpanel design questions

Postby Chesterfield » Mon Nov 04, 2019 3:39 am

I am intending to use multiple outdated Android devices to use as a panel. I decided to start with HSI. Many parts are working but now I just can't find answers by searching this forum, wiki and the internet. I don't even know if webpanel is what I want since I haven't seen a working example that does everything I would like to do. A lot of the documentation I've read seems to be outdated for 2019.1.

My programming knowledge is limited so if there is more than one answer the easiest to implement would be best.

I see mobile touchscreen is included in some of the files I use as a guide but I haven't seen examples of knobs, buttons and switches being used. Is this possible? If not, is there a different alternative I should be looking in to for that part?

I am also having issues finding correct paths to plug in to "properties". How do I find these and if an existing one works by "alias" in an XML file, how do I write the path for that line?

Also, is there a repository with SVGs of instruments I can use instead of designing my own? At this time I have only seen the SVGs for C172 and Seneca.

I know I'll have more questions but answers to this will go a long way.

So far this link has been the greatest help in my attempts http://wiki.flightgear.org/Howto:Create ... instrument
Chesterfield
 
Posts: 3
Joined: Mon Nov 04, 2019 3:14 am

Re: Webpanel design questions

Postby Chesterfield » Sun Nov 10, 2019 5:10 pm

I wrote that when tired and frustrated. Not enough info.

I am trying to create a 2d panel for the HSI on the Citation II. I figure if I can get that complex instrument working others will be easier to do.

At the moment where I am stuck is in 2 places.

As a temporary measure I altered the table in the radio stack located in /Phi/examples/ to get 2 boxes, one with course and one with distance to VOR then overlaying that table on the .instrument I am using from the Seneca with and absolute value. Ugly, but I'm learning and I will use this knowledge later to make it better. The property I am using for distance comes from internal properties/instrumentation but returns a number that needs to be converted by multiplying it by 0.0000539956803 (not sure why). I have no clue how to do this. at the moment this is the js file
Code: Select all
$(document).ready(
    function() {

      var rp = new Array();
      rp["#selcrs"] = "/instrumentation/hsi/inputs/radials/selected-deg";
      rp["#dist"] = "/instrumentation/hsi/inputs/nav-distance";

      $("#selcrs").change(function(o) {
        fgCommand.propertyAssign(rp["#selcrs"], $("#selcrs").val());
      });
      $("#dist").change(function(o) {
        fgCommand.propertyAssign(rp["#dist"], $("#dist").val());
      });


      PropertyChangeListener(function() {
        SetListener( rp["#selcrs"], function(n) {
          $("#selcrs").val( n.value );
        });
        SetListener( rp["#dist"], function(n) {
          $("#dist").val( n.value );
        });

      });
});


It would seem I need to write in an "if" value to check if the VOR is in range and then convert the raw number to nautical miles if it is in range. Again, I don't know how to proceed from here and a few hours of searching for something to point me in the right direction is not yielding results. Edit - Oh and I think I need to include either a truncated or round to display only to the tenth (0.1).

Second issue - hiding the NAV flag when in range returns true. Can this be done in json values as they currently are and how? If not, can someone give me a clue?

Javascript is harder than writing my own gtk3.0 theme from scratch using css.
Chesterfield
 
Posts: 3
Joined: Mon Nov 04, 2019 3:14 am

Re: Webpanel design questions

Postby WoodSTokk » Sun Nov 10, 2019 11:37 pm

Chesterfield wrote in Sun Nov 10, 2019 5:10 pm:The property I am using for distance comes from internal properties/instrumentation but returns a number that needs to be converted by multiplying it by 0.0000539956803 (not sure why).


The distance under '/instrumentation/nav[n]/nav-distance' is in meters.
DME express the distance in NM. One NM is equal 1852m.
To convert from meter to NM, you can divide by 1852 or multiply by 0.000539956803456 (that is 1/1852).
The HSI on the Citation II take also the distance from /instrumentation/nav[n]/ insteed of /instrumentation/dme[n]/.
This is a ugly hack to have allways a distance. The DME hasn't the same broadcast range as the VOR has.
You can receive the VOR signal but not the DME signal.
There hack has also a big disadvantage. On a ILS the HSI show wrong distance, but the DME shows right.
The DME messure to the DME station (located at the aim point beside the GS antenna).
The NAV radio to the selected station and in the case of a ILS it is the localizer (at the end of the runway).
If you turn on the DME while approaching an ILS, you will see the difference between HSI and DME reading.
If you want it correct, check '/instrumentation/dme[n]/in-range' and if its true use '/instrumentation/dme[n]/indicated-distance-nm'.
Also for the VOR, if '/instrumentation/nav[n]/in-range' is true, use the numbers.
If not, all output numbers have no meaning and the deviation needle move to center and the NAV flag will be shown.
WoodSTokk
 
Posts: 543
Joined: Tue Oct 17, 2017 2:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: OE-WST
IRC name: WoodSTokk
Version: 2020.3.0
OS: Debian Buster

Re: Webpanel design questions

Postby Chesterfield » Sat Nov 16, 2019 12:27 am

Thanks for the reply WoodSTokk.

If I can get this all the way I want I intend to share it since, as I said, I haven't seen a fully functional webpanel. Seeing how it is done can easily be translated even for people with limited programming knowledge like myself and if I can help the community myself, well that is what open source is all about.

Where I am now is a need to find how to use a button on the browser to execute commands in FG. I am thinking 2 hidden buttons over the knob (in this case the course or radial adjustment) one for increase and one for decrease. I don't even know if a function in javascript will trigger nasal to do this and even if it does I don't know how to tell it the proper step increment.

WoodSTokk wrote in Sun Nov 10, 2019 11:37 pm:This is a ugly hack to have allways a distance. The DME hasn't the same broadcast range as the VOR has.
You can receive the VOR signal but not the DME signal.
There hack has also a big disadvantage. On a ILS the HSI show wrong distance, but the DME shows right.


I see why you would say it is ugly but does this equipment in the real world get better reliability than FG gets with DME. About half the vor-dmes don't deliver a distance for me. If the real world reflects the DME results I've seen then I can put aside my desire to get the same results I see from the 3d panel on the simulator.

I need to figure out how to get a function I found for converting meters to NMiles to see the output value as a number and responding to continuous input if I want to use the nav value instead of dme.

If you want it correct, check '/instrumentation/dme[n]/in-range' and if its true use '/instrumentation/dme[n]/indicated-distance-nm'.
Also for the VOR, if '/instrumentation/nav[n]/in-range' is true, use the numbers.
If not, all output numbers have no meaning and the deviation needle move to center and the NAV flag will be shown.

After I leave a VOR the number remains at last known until I enter a new VOR on the same NAV. When I wrote the previous comment I also wasn't getting the flags (NAV and HDG) to go away when they should and wanted to combine issues. I have since discovered the svg had NAV as the inkscape:label but not on ID line in xml editor. Once I changed the ID to NAV in the SVG the json entry I already had in place worked to move that node to the left and off screen. I haven't figured out the if line yet to tell it to enter "----" in the digital distance display when out of range but admittedly I haven't even tried yet. I think I can figure it out.

As said at the beginning, I have no clue how to get buttons (actually knob, switches and buttons but on the browser end I at the moment intend to use buttons). This is the biggest factor on why I want to use webpanel or another way to use the instruments on a phone or tablet. Using a cursor to find the exact right spot on a panel I can barely see to begin with is annoying. Maybe I should create a new thread to ask that specifically.
Chesterfield
 
Posts: 3
Joined: Mon Nov 04, 2019 3:14 am

Re: Webpanel design questions

Postby WoodSTokk » Sat Nov 16, 2019 2:02 am

Chesterfield wrote in Sat Nov 16, 2019 12:27 am:I see why you would say it is ugly but does this equipment in the real world get better reliability than FG gets with DME. About half the vor-dmes don't deliver a distance for me. If the real world reflects the DME results I've seen then I can put aside my desire to get the same results I see from the 3d panel on the simulator.

DME has bad reception on low altitude. Climb to 5000 feet above ground and you get better results.
Chesterfield wrote in Sat Nov 16, 2019 12:27 am:I need to figure out how to get a function I found for converting meters to NMiles to see the output value as a number and responding to continuous input if I want to use the nav value instead of dme.

Meter devide by 1852 is NM.
Chesterfield wrote in Sat Nov 16, 2019 12:27 am:After I leave a VOR the number remains at last known until I enter a new VOR on the same NAV.

Yes, but as long as the 'in-range' property is 'false' the values have no meaning (invalid).
Chesterfield wrote in Sat Nov 16, 2019 12:27 am:When I wrote the previous comment I also wasn't getting the flags (NAV and HDG) to go away when they should and wanted to combine issues.

The NAV flag should be visible if the NAV radio has no reception. (instrumentation/nav[n]/in-range = 'false')
The HDG flag should be visible if the gyro spins to slow. (instrumentation/heading-indicator[n]/spin < '0.8')

Sorry, i can't help at HTML, JavaScript, Json, etc.
WoodSTokk
 
Posts: 543
Joined: Tue Oct 17, 2017 2:30 pm
Location: Milky Way/Sol/Earth/Europe
Callsign: OE-WST
IRC name: WoodSTokk
Version: 2020.3.0
OS: Debian Buster


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 1 guest