DC-10 Air Tanker Version: 1.0.2, 2018 Nov 21 (Development for Flightgear)

in #utopian-io5 years ago

Repository

https://github.com/HerbyW/DC-10-Air-Tanker

Introduction

FlightGear (http://www.flightgear.org) is an open source flight simulator that is even used in flight schools to train basic maneuvers, radio communication and navigation tasks. It is available for windows, mac and linux.

In this article I want to go through the latest 3 commits I made to further improve my new development of the McDonnell Douglas DC-10-30 Air Tanker, this version is used for fire fighting with water or retardant.

New Features

Adding the new instruments for retardant control with all animations

https://github.com/HerbyW/DC-10-Air-Tanker/commit/0c271a92cc47a997a73cc3c0829236d66538797f

Finally I found 2 videos on youtube with the instruments in the cockpit used for firefighting. There is one at the engineers panel and one in the middle of the cockpit. Watching them carefully and putting the information together I was able to decide what switches I need and what they do.

Screenshot_20181118_170728.png

Screenshot_20181118_164933.png

With Blender I made the 3D models, with scribus the liveries and in xml-files I wrote the animation descriptions for each switch and button.
retardant2-Seite001.png

retardant-drop2-Seite001.png

This is the final result, the model implemented in the cockpit:
fgfs-screen-021k.png

You see 3 open property browsers with the properties of all switches and buttons, and they are showing what is set in the cockpit by clicking with the mouse. As example one more picture with different positions of switches and therefore different property values.

fgfs-screen-023k.png

I am very happy with the result! As there is no engineers panel in the model I put them both in the middle console of the cockpit, so it is easy to handle them from the pilot seat.

Implementation of Multiplayer firefighting action, more cleaning code

https://github.com/HerbyW/DC-10-Air-Tanker/commit/4beee5fa0d2b7e6525a8bdc222c353a0d4601d09

The next step was to go again into detail to the FDM (flight dynamic model)and change some values of fuselage elements, also to add the water tank as a element of producing drag during flight.

(html comment removed:  water tank )
<fuselage ax="12.90" ay="0.0" az="1.42" bx="10.90" by="0.0" bz="1.42" width="1.96" taper="0.5" midpoint="1" />
<fuselage ax="10.90" ay="0.0" az="1.42" bx="-4.12" by="0.0" bz="1.42" width="1.96" taper="1.0" midpoint="0.5" />
<fuselage ax="-4.12" ay="0.0" az="1.42" bx="-6.12" by="0.0" bz="1.42" width="1.96" taper="0.5" midpoint="0" />

As more information was gathered about the aircraft I found out that both of the center tanks are not used in this variant, so I set them to 100 lbs to let them be here but without any usage.

The code of the main-set.xml file was going to be unreadable due to all-in writing and as in all of my aircraft I split it up in different files for help, views, keyboard, flightrecorder and menu.

The last step was the basic implementation of multiplayer functionality for fire fighting action:
Shift+Strg+MouseClick in the scenery will now set up a fire, you may make as much as you want, but be aware that they are spreading depending on the surface and you have to fight very bravely to hold them in control. This part is done with nasal scripting like this:

# make fire with Strg+Shift+MouseClick
setlistener("/sim/signals/click", func {
  if (__kbd.shift.getBoolValue()) {
    if (__kbd.ctrl.getBoolValue()) {
      var click_pos = geo.click_position();
      wildfire.ignite(click_pos);
      setprop("/sim/messages/copilot", "Wildfire in new spot detected!");
    }
  }
});

Deleting fire, or setting ground to incombustible is done with this code:

# Retardant system control for deleting fires, MP-retardant will be active 4.5 seconds after start, so it looks like real!
# create timer with 2 second interval
var retardant = maketimer(2, func
{ 
    if (getprop("/sim/model/dc10/retardant") > 0)
  {
          var drop_pos = geo.aircraft_position();
          settimer( func { wildfire.resolve_retardant_drop(drop_pos, 40, 1); }, 4.5);          
  }     
  }
);
# start the timer (with 2 second interval)
retardant.start();
Retardant computer programming ready for test! All functions to set in the cockpit!

https://github.com/HerbyW/DC-10-Air-Tanker/commit/c135a13516f3ea131fb3b004000d10daa24fba8d

The final result is visible here:
fgfs-screen-024k.png

After setting the values for quantity (from 25-100% of the overall amount of retardant available) and coverage level (thickness or density of retardant which reaches the ground) manually for each of the 3 water tanks and then pressing the release button it makes what it should! A message is coming up to confirm the action.

Programming a computer is tricky, but after some hours the logic became clear and then the coding was not to difficult.
You may look into the code, I try to make it clear to understand with lots of comments. Some bugs are still there and need further thinking but the basics are working very well now.
https://github.com/HerbyW/DC-10-Air-Tanker/blob/master/Nasal/firefighting.nas

Roadmap

Next will be the further improvement of fire fighting action like retardant coverage on ground depending on the coverage level and animation of refilling on ground with some vehicles.

How to contribute?

Pull request to my github repository or direct contact via Mumble FlightGear Chat.

GitHub Account

https://github.com/HerbyW
It contains my real name, my git username, my steemit username and my callsign in the multiplayer.

Sort:  
  • Very good post, pictures, videos and code!
  • Might it be possible to bundle commits into a pull request next time?
  • What type of code editor do you use?

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Thanks for reviewing.
I do not understand what you mean by "into a pull request", it is my repository and I am the developer, so why should I ask myself for a pull request?
Editing is done with Kate.
Good coding means for me to put commits not to big, so in case something went wrong it is easier to go back.

Hello @schamangerbert70, I agree that it is a good coding practice to keep commits to a small size and also to related issues.

I've seen in other projects, multiple commits of the same file, where changes are reverted, re-implemented or refactored. Pull request makes it easier for reviewers like me and prospective contributors as well. We can see the final result in a logical package.

Doing pull requests on your own repo also sets up the stage for others to contribute and that's the spirit of open source.

Keep up the good work.

Thank you for your review, @helo! Keep up the good work!

Very good work @schamangerbert you did an excellent and extra ordinary work, I may not understand much more about this but it really wonderful mia looking at it.

Many mat understand more about it and need to appreciate your work..

Thanks for share..

Re-steemed

I am not a expert in this programming and other language but good to see it that development are well going and finally come with good presentation.

Excellent review, my friend and I immediately understand that this simulator is a very interesting thing! Thank you @schamangerbert

I am waiting fir you to develop an alien’s flying disc!! The UFO!

Posted using Partiko iOS

You got a 11.80% upvote from @ocdb courtesy of @schamangerbert!

@ocdb is a non-profit bidbot for whitelisted Steemians, current max bid is 20 SBD and the respective amount in Steem.
Check our website https://thegoodwhales.io/ for the whitelist, queue and delegation info. Join our Discord channel for more information.

If you like what @ocd does, consider voting for ocd-witness through SteemConnect or on the Steemit Witnesses page. :)

Hi @schamangerbert!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @schamangerbert!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 64455.55
ETH 3147.84
USDT 1.00
SBD 3.94