Board index FlightGear Development Spaceflight

Space Shuttle

Discussion about development and usage of spacecraft

Re: Space Shuttle

Postby wlbragg » Sat Feb 20, 2016 2:39 pm

Richard wrote in Sat Feb 20, 2016 2:24 pm:All of the links I used are here: https://sourceforge.net/p/fgspaceshuttl ... -links.txt

I just noticed those links.

Thorsten wrote in Sat Feb 20, 2016 8:11 am: the photographer Jon Brack is the same who kindly agreed to let us use his pictures for the panel textures :-)

Where are those pictures?
I hope http://www.jonbrack.com/#/panoramas/ isn't the source your referring to. It appears to be broken?
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7586
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Space Shuttle

Postby Richard » Sat Feb 20, 2016 5:13 pm

wlbragg wrote in Sat Feb 20, 2016 2:39 pm:Where are those pictures?
I hope http://www.jonbrack.com/#/panoramas/ isn't the source your referring to. It appears to be broken?


It works fine for me; maybe some sort of browser issue. try http://www.jonbrack360.com/endeavour_fd_down/ or http://www.jonbrack360.com/endeavour_fd_up/

The pictures / textures are taken directly from the panoramas. All the pictures are in the ArtWork directory on github. Take a panorama at closest zoom and then fiddle about with the geometry to make it square and then turn it into a texture. This took me anything from 10 minutes to a few hours per 'picture'.
Richard
 
Posts: 810
Joined: Sun Nov 02, 2014 11:17 pm
Version: Git
OS: Win10

Re: Space Shuttle

Postby Thorsten » Sat Feb 20, 2016 5:17 pm

Some work on the MEDS layer (doing this, I realize canvas is really neat - we build the displays just like the real Shuttle does it, aka we render the DPS part right into the MEDS structure - so changing the MEDS layer just changes it everywhere without a fuss...).

Now the colors are closer to real. The DPS screens get a little square to show which IDP is responsible for the display, and a bar according to which keyboard currently talks to the MDU (so you don't have to guess what is affected by your typing...). The currently selected option of a submenu changes color.

And I've managed to insert the first of the MEDS layers GIjs did a while ago - looks pretty, and I can make the numbers update already - if I just could figure out how to animate the damn bars...

Image
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Space Shuttle

Postby Hooray » Sat Feb 20, 2016 5:28 pm

Thorsten wrote in Sat Feb 20, 2016 5:17 pm: if I just could figure out how to animate the damn bars...


Usually, it's a .translate()/.transform() call to update these things in a callback invoked via maketimer() - i.e. the SVG image will typically provide an ID for the corresponding element, which you can then operate on using the APIs available in $FG_ROOT/Nasal/canvas/api.nas - note that SVG images are internally converted to Canvas properties using ShivaVG (openVG paths) - thus, all the Canvas/Path APIs are available: http://wiki.flightgear.org/Canvas_Path

In addition, each Canvas::Path is a child-class inherited from Canvas::Element, which is where all the common functionality resides, so that you can call arbitrary Canvas::Element methods, too: http://wiki.flightgear.org/Canvas_Element


If you could post a link to the corresponding SVG/Nasal files, I can provide more specific advice.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Space Shuttle

Postby Thorsten » Sat Feb 20, 2016 7:31 pm

I suppose it's a question of how Gijs intended this to work... I'm sure it must be a some_element.setSomething() technique but I can't figure out which element and which technique easily.

Here's the display SVG (the MEDS is the last group - I've already identified the updatable text elements, named them and set them for proof of concept from the Nasal):

https://sourceforge.net/p/fgspaceshuttl ... FD/PFD.svg

Here's the display page management file:

https://sourceforge.net/p/fgspaceshuttl ... ms_mps.nas
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Space Shuttle

Postby wlbragg » Sat Feb 20, 2016 7:40 pm

http://www.jonbrack.com/#/panoramas/ is working for me now, must have been a temporary outage.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7586
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Space Shuttle

Postby Hooray » Sat Feb 20, 2016 7:43 pm

I have only looked at the SVG/XML markup, so the following may be off, but I assume that Gijs treated such bars as rectangles that need an identifier to be individually addressed, thus, I would look for <rect> elements with ids, e.g. "MI_0_frame", "MI_1_frame" etc - I would then invoke one of the methods I mentioned above to fill the rectangle and animate/transform it using a timer.

The worst thing that can happen is that it will transform some unrelated elements (like I said, I didn't open the svg file in inkscape - I specifically looked for rectangles with a lookup ID, because that is what I would expect a "bar" to be - and Gijs has done quite a bit of PFD/ND work, so he's likely to use a straightforward approach like that)

To be really, you would want to open the whole thing in a Inkscape to see what the implementation, and lookup ID, of those bars really is.
But from then on, you can directly get a handle to them and use that handle to animate things.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Space Shuttle

Postby wkitty42 » Sun Feb 21, 2016 12:18 am

have you got your "bob" switch all dressed out? ;)
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9146
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Space Shuttle

Postby Thorsten » Sun Feb 21, 2016 7:49 am

I have only looked at the SVG/XML markup, so the following may be off, but I assume that Gijs treated such bars as rectangles that need an identifier to be individually addressed, thus, I would look for <rect> elements with ids, e.g. "MI_0_frame", "MI_1_frame" etc - I would then invoke one of the methods I mentioned above to fill the rectangle and animate/transform it using a timer.


Well, yeah - as I said, I figured out that much myself... The elements are unfortunately all IDd (it seems Inkscape does this automatically) and there's none with a descriptive otherwise special ID.

Also, Richard mentioned something about adjusting clipping zones, but I have no idea how that's supposed to work in canvas.

It'd need some way of specifically dragging the upper part of the rectangle to a location without touching the lower part. Well - a combination of scale and translation can achieve the same I guess...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Space Shuttle

Postby Richard » Sun Feb 21, 2016 1:17 pm

Thorsten wrote in Sun Feb 21, 2016 7:49 am:
I have only looked at the SVG/XML markup, so the following may be off, but I assume that Gijs treated such bars as rectangles that need an identifier to be individually addressed, thus, I would look for <rect> elements with ids, e.g. "MI_0_frame", "MI_1_frame" etc - I would then invoke one of the methods I mentioned above to fill the rectangle and animate/transform it using a timer.


Also, Richard mentioned something about adjusting clipping zones, but I have no idea how that's supposed to work in canvas.


The SVG contains empty rectangles for these areas. I don't think we can part fill so what I'm figuring out is whether we need to add an SVG element for the bar that gets filled in proportionately or whether I can do something similar to the way I handle clipping rectangles in the F-15 HUD by using a naming convention (in that case _clip on an object name will cause a clipping rectangle to be created).

So if we take the autonamed rect6437 and call it instead p_meds_oms_mps_He_Tk_left_vscalebar the loader can recognise this and create an element that can simply have its filled amount adjusted. I suspect the easiest way to do this is to create a rectangle that fits within the bounds (and underneath) and simply adjust the clipping rectangle. However it might turn out that scaling X/Y will do a better job. This will result in something like

Code: Select all
    p_meds_oms_mps.He_Tk_left = device.getScaleBar("p_meds_oms_mps_He_Tk_left");


This will locate the appropriate scale bar, do any necessary processing or secondary lookup of SVG elements so that to us it you can simply do

Code: Select all
    p_meds_oms_mps.setScale(0.5)
Richard
 
Posts: 810
Joined: Sun Nov 02, 2014 11:17 pm
Version: Git
OS: Win10

Re: Space Shuttle

Postby Thorsten » Sun Feb 21, 2016 1:24 pm

I don't know about canvas -internal efficiency, but placing a colored rectangle inside the frame and using scale/translate on that (and color it accordingly) seems to do the trick fine - I've managed to hook up the SSME and OMS Pc meters to this already.

Thanks to everyone who tried to help out here!
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Space Shuttle

Postby Hooray » Sun Feb 21, 2016 1:51 pm

regarding clipping, there's some info available on the wiki - Gijs used it for his PFD/ND work.
For details, I would suggest to refer to api.nas and look for "clip" and/or "rect" - IIRC, you need to set up a clipping rectangle by setting some kind of "clip" property and setting it to a rect value in the form of rect(...)

I used that to reuse the MapStructure/ND code on a dialog:
Image

For details, see the clipping example at: http://wiki.flightgear.org/Canvas_Nasal_API#set_2
Code: Select all
my_grp.set("clip", "rect(62px, 587px, 262px, 437px)"); # top,right,bottom,left

And: http://wiki.flightgear.org/Canvas_Element#clip.28.29

If you have a minute or two, it would be great to come up with a simple clipping example that we can add to the Canvas Snippets article at: http://wiki.flightgear.org/Canvas_Snippets

My suggestion would be to adapt the raster image example by adding that to a group with clipping enabled.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Space Shuttle

Postby Vladimir Akimov » Sun Feb 21, 2016 4:47 pm

I putted you page here


I think you need more attention :D
You know me from youtube :)
I'm VladFlyer, take a look :

https://www.youtube.com/channel/UCBOvOg ... yNsYKuAxbw
User avatar
Vladimir Akimov
 
Posts: 630
Joined: Tue Oct 22, 2013 8:05 pm
Callsign: VladFlyer
Version: 3.2.0
OS: Win 8.1

Re: Space Shuttle

Postby Hooray » Sun Feb 21, 2016 7:18 pm

Thorsten wrote in Sun Feb 21, 2016 1:24 pm:I don't know about canvas -internal efficiency


Honestly, as far as I am aware, there really isn't any "better" or more "efficient" way to do this.

The thing is, Canvas still does not have any way of "instancing" support for OSG-level data structures - this would be the main thing that would help with reducing the rendering related workload. Aside from that, it's the update/animation logic that is typically implemented via Nasal timers/listeners that will add up, and show up over time.

Thus, the only advice/suggestion I have to make is to encapsulate the logic you are using - not necessarily in form of a classs/OOP, but even just by using a helper function in the form of a makeBar = func (canvas, group, config, updateCallback) helper that can help you encapsulate all updating semantics.

The config parameter would then be a hash holding values for dimensions, colors to be used etc.

The main reason for doing that is to ensure that you can easily adopt more native primitives if/when they become available - for instance, the lack of a dedicated animation-handling element at the Canvas::Element level is one of the most obvious issues, because it links rendering related OSG code to Nasal space callbacks that are running within the FlightGear main loop.

And one of the most logical optimizations would be to look up suitable OSG-level data structures and expose those as Canvas::Elements that we can then reuse to implement such animations/updates without going necessarily through Nasal space - there are quite a few osg classes that could help with that, some of which we are currently re-implementing via Nasal to animate PFD/ND logic.

Looking specifically at some of the most complex Canvas-based avionics we have in FlightGear, things like Avidyne Entegra R9 will be difficult to update easily once such a dedicated element becomes available - but people can easily make that possible by using a single helper function/class that handles the update/animation semantics, and which isolates the remaining code from any internals - so that things like an animated bar can be easily delegated to OSG/C++ code as soon as the corresponding OSG classes are mapped to a dedicated Canvas element: http://wiki.flightgear.org/Canvas_Sandb ... sAnimation
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Space Shuttle

Postby TheTom » Sun Feb 21, 2016 11:44 pm

Hooray wrote in Sun Feb 21, 2016 7:18 pm:
Thorsten wrote in Sun Feb 21, 2016 1:24 pm:I don't know about canvas -internal efficiency


Honestly, as far as I am aware, there really isn't any "better" or more "efficient" way to do this.


Scaling or any other type of transformation or changing the coordinates of individual points is definitely more efficient than clipping (which requires to change the OpenGL clip planes for every rendered object with a different clipping rectangle).
TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

PreviousNext

Return to Spaceflight

Who is online

Users browsing this forum: No registered users and 1 guest