c172p-team / c172p

A high detailed version of the Cessna 172P aircraft for FlightGear
GNU General Public License v2.0
82 stars 43 forks source link

Garmin 196 GPS option #392

Closed gilbertohasnofb closed 8 years ago

gilbertohasnofb commented 9 years ago

We could add the Garmin 196 GPS to our dashboard as an option (default off, to be activated via the menu). This GPS model is already located in fgdata, so it's very easy to add it to our plane. For my tests, I add the following lines to Models/c172p.xml:

<model>
    <path>Aircraft/Instruments-3d/garmin196/garmin196.xml</path>
    <offsets>
            <x-m>-0.4</x-m>
            <y-m>0.16</y-m>
            <z-m>0.205</z-m>
            <heading-deg>-12.0</heading-deg>
    </offsets>
</model>

And the following to the c172p-set.xml inside the <nasal> block:

<garmin196>
    <file>Aircraft/Instruments-3d/garmin196/garmin196.nas</file>
</garmin196>

This is the result, which is quite nice IMO:

image1

image2

image3

The good thing about directing to this GPS inside fgdata instead of copying it to our project is that any updates would also be automatically applied to our plane. For instance, I created a better texture for it but I couldn't make it work, and I reported it to the original creator.

gilbertohasnofb commented 9 years ago

Okay!

onox commented 9 years ago

Btw, could you test my PR that is currently open? :smile:

gilbertohasnofb commented 9 years ago

Yes, sorry for the delay, I will try to do it tonight as well! I am just so clueless about how those things are supposed to work that I have been hoping someone else would test and merge it before me :stuck_out_tongue_winking_eye:

onox commented 9 years ago

It's very simple, if EGT is high and cabin heat is open, it gets warmer. If you open cabin air, overhead vents, or windows/doors, you add air from outside. Adding humans will increase temperature a little and increase humidity.

I've been flying with the branch for a while now, and it all works. It's mainly some constants that could be tuned. The fog/frost appears not too fast. I'm not sure humans add enough heat. Maybe it's better to just merge the PR, so that we can later hear if people think fog needs to be appear quicker or not.

gilbertohasnofb commented 9 years ago

Sound all right, I will give it a go.

Maybe it's better to just merge the PR, so that we can later hear if people think fog needs to be appear quicker or not.

We can do that, but I promise you I will get at it still today. If you can wait a couple of hours I can test it and merge it myself. Is that all right?

onox commented 9 years ago

That's okay.

gilbertohasnofb commented 9 years ago

Move the old non-canvas device a bit to the right so I can compare it.

@onox, it seems that you already the non-Canvas device in that branch:

    <model>
        <path>Aircraft/Instruments-3d/garmin196/garmin196.xml</path>
        <offsets>
            <x-m>-0.4</x-m>
            <y-m>0.16</y-m>
            <z-m>0.205</z-m>
            <heading-deg>-12.0</heading-deg>
        </offsets>
    </model>

So basically if I do as you say and add my slightly modified Garmin, we will have two non-Canvas devices, one grey and one black, one remote and one local. Is that what you want?

fgfs-screen-001

onox commented 9 years ago

The new black one should just have an empty screen. Don't add every single file (like docs, etc.) as you did in gps. That's not really necessary because the empty screen (simple rectangle in Blender) will be painted by canvas eventually.

gilbertohasnofb commented 9 years ago

I see, so we will have a grey non-Canvas GPS and a black non working GPS. I will do it as you say.

onox commented 9 years ago

Yes. So just add the minimal amount of files to see the device itself. It shouldn't function until we add the actual canvas code later.

gilbertohasnofb commented 9 years ago

Ok.

gilbertohasnofb commented 9 years ago

Okay, I pushed it. Remember that I added the GUI option to show/hide the GPS, so the first time you load this branch you will have to activate it in the Aircraft Dialog. I created a .blend file and I deleted all the screens objects but one. The problem is that I get an error when I try to export the model as a .ac file, so could you or someone else with more Blender experience check what is going on? The file is located at /Models/Interior/Panel/garmin196. This means that the current .ac file is the default one with several screens one above the others, ok?

gilbertohasnofb commented 9 years ago

Also, branch gps should have been deleted.

onox commented 9 years ago

@gilbertohasnofb I have deleted the gps branch. Have you done more work on the bug-392 branch? I want to rebase it on top of latest master, because the branch is already quite old (1 month).

gilbertohasnofb commented 9 years ago

I have deleted the gps branch

Ops, I had deleted it only locally! Thanks then :smile:

Have you done more work on the bug-392 branch

Nope, just that single commit. Feel free to rebase it.

onox commented 9 years ago

@gilbertohasnofb Pushed. In the bug-392 branch you can reset to two commits ago with git reset --hard HEAD~2. After that use git pull.

gilbertohasnofb commented 9 years ago

Done :+1:

onox commented 9 years ago

Btw, to get rid of the screen objects, they should be removed in Blender, but in the mean time you could try to create a temporary select animation with a condition that is always false (<false/>) and then add all those (useless) screen objects.

onox commented 9 years ago

That way we also gather a list for whoever can properly export .ac files to know which objects can be safely deleted in Blender.

gilbertohasnofb commented 9 years ago

Btw, to get rid of the screen objects, they should be removed in Blender [...] That way we also gather a list for whoever can properly export .ac files to know which objects can be safely deleted in Blender.

Well I already did that, it was pretty obvious which objects could be deleted and so I did that. I am just having troubles exporting the .ac file, but I believe that .blend is ready to go. Could you give it a try maybe?

onox commented 9 years ago

Oh, it's already present, didn't notice the file. I'll check.

gilbertohasnofb commented 9 years ago

Thanks!

onox commented 9 years ago

I get an error too. It goes away when I delete the "screen" object.

gilbertohasnofb commented 9 years ago

Can you check if that object isn't set to any texture? That could be the issue. If not then would you be able to delete it and create a new rectangle object as a new screen?

onox commented 9 years ago

Maybe, but it's too late now. Need to sleep :wink: :sleeping:

gilbertohasnofb commented 9 years ago

No worries, we do it some other time. Here is also very late as well... have a good night, onox!

onox commented 8 years ago

@gilbertohasnofb Is this how it's supposed to look? The exported .ac file has different materials:

-MATERIAL "ac3dmat0" rgb 0 0 0  amb 0.2 0.2 0.2  emis 0 0 0  spec 0.2 0.2 0.2  shi 128  trans 0
-MATERIAL "ac3dmat1" rgb 1 1 1  amb 0.2 0.2 0.2  emis 0 0 0  spec 0.2 0.2 0.2  shi 128  trans 0
-MATERIAL "DefaultWhite" rgb 1 1 1  amb 1 1 1  emis 0 0 0  spec 1 1 1  shi 50  trans 0
+MATERIAL "DefaultWhite" rgb 1.0000 1.0000 1.0000  amb 0.2000 0.2000 0.2000  emis 0.0000 0.0000 0.0000  spec 0.5000 0.5000 0.5000  shi 10 trans 0.0000
+MATERIAL "DefaultWhite.002" rgb 1.0000 1.0000 1.0000  amb 1.0000 1.0000 1.0000  emis 1.0000 1.0000 1.0000  spec 0.5000 0.5000 0.5000  shi 12 trans 0.0000

fgfs-screen-405

onox commented 8 years ago

If I manually modify emis to zero then it looks alright (during day and night). Not sure about spec and shi though.

gilbertohasnofb commented 8 years ago

Is this how it's supposed to look?

Regarding what, exactly? Texture-wise? If so, then yes, it looks fine to me.

If I manually modify emis to zero then it looks alright (during day and night). Not sure about spec and shi though.

I am not familiar with these sort of properties as they are normally done in Blender :cry:

wlbragg commented 8 years ago

Anything I can do to help on this, let me know!

onox commented 8 years ago

On the forum/wiki you can find screenshots of an older Canvas implementation. It would be nice if you could find the code and the .svg files :smile:

onox commented 8 years ago

And delete the screens.png material from the screen object in Blender. If you then export the .ac file. Is it much different according to git diff?

wlbragg commented 8 years ago

I'm not the person to find things in our wiki or forum (or I am and nothing is ever there :smile: ) I found mostly what you already reference here. http://wiki.flightgear.org/Garmin_GPSMap_196 http://forum.flightgear.org/viewtopic.php?f=71&t=23047&hilit=gps&start=15 http://forum.flightgear.org/viewtopic.php?f=14&t=15433&p=253470#p253455 http://forum.flightgear.org/viewtopic.php?f=71&t=23644&hilit=gps

code and the .svg files

Look where? Is it in our c172p history?

Is it much different according to git diff?

Is this what you looking for? @ -1,13118 +1,12894 @@

onox commented 8 years ago

Is this what you looking for? @ -1,13118 +1,12894 @@

No, what I meant to ask is how many lines are added/deleted when you simply delete the material reference in the screen object.

onox commented 8 years ago

Look where? Is it in our c172p history?

No, but on the forum they said they made use of some colored SVG files.

onox commented 8 years ago

This is what I mean:

GPSmap196 with SVG images

I was hoping that we could still find the code that generates that picture somewhere on the internet.

wlbragg commented 8 years ago

Do you have any idea what plane that is in in the background?

wlbragg commented 8 years ago

That is what 1,13118 +1,12894 is

It went from 13118 to 12894 = 224 less lines.

onox commented 8 years ago

Ah, OK, didn't recognize it as diff stats. I thought it was the usual output from the .ac file. It still modifies over 10_000 lines it seems. I guess the .ac exporter plug-in finds that necessary.

Could you add the fixed Blender and .ac file? Make sure to set emis in the .ac file to 0 if it is 1. Here I always have to manually adjust it :confused:

onox commented 8 years ago

Do you have any idea what plane that is in in the background?

Don't know. Ask Hooray.

wlbragg commented 8 years ago

The one in this branch (Bug-392) is already had the material removed? Did you want me to take the one from "master" and edit it and then save it to this branch?

gilbertohasnofb commented 8 years ago

Do you have any idea what plane that is in in the background?

@wlbragg that's the dr400-dauphin

onox commented 8 years ago

@wlbragg No, just checkout bug-392, edit the Blender file, and export to the .ac file.

wlbragg commented 8 years ago

@wlbragg No, just checkout bug-392, edit the Blender file, and export to the .ac file.

Wow, I had jsut check and I'm telling you it did have the material removed. :open_mouth: I'll look again!

wlbragg commented 8 years ago

OK, you were right, it was still there. Done.

onox commented 8 years ago

@wlbragg What's the "test" commit?

I'll squash last two commits into one and force push.

Edit: done

wlbragg commented 8 years ago

Sorry, it was something I was was doing prior. I didn't realize it was still a part of my local branch.

Is this what your looking for? page-panel

wlbragg commented 8 years ago

No, that doesn't look like it.

onox commented 8 years ago

Ehh... I'm not sure why you come up with that picture? O_o That's not an SVG.

Could you perhaps just ask Hooray if he still has the code? I deleted my forum account.

wlbragg commented 8 years ago

I did ask Hooray on the Forum and that was .svg, I couldn't post it as .svg, I had to change it to jpg to post it here.