Outerra forum

User mods, screenshots & videos => Aircraft => Topic started by: fly77 on June 09, 2019, 02:37:50 pm

Title: work on bk117 helicopter
Post by: fly77 on June 09, 2019, 02:37:50 pm
Finally I have learned to fly the bk117 helicopter by using a lot the trim and setting joystick sensivity to high and a deadzone to narrow.
Then I made some modification to the javascript to set up zoom (see code below for the core of it). Then as I pressed +/- keys on numpad to zoom keys while flying the bk117 heli up came this screen while zoom does not work..
the +/- keys seem associated to something different for the bk117..
What is its purpose ? Could I program similar nice sliders and buttons on my own ..look like java buttons?

(https://i.postimg.cc/cJXXq6wf/screen-1560104826.jpg) (https://postimg.cc/rdRSxVhp)

Code: [Select]

function update_frame(dt){

  fov_cockpit_zoom = 81.8;
  this.register_axis("air/sensor/fov_zoom", {minval:0, maxval:1, vel:1, center:0}, function(v){
    var dec2int = v*48;
    var integer = Math.floor(dec2int);
    var string = 81.8 - integer.toString();
    fov_cockpit_zoom = string;
  });
 
   if (this.get_camera_mode() == 0){
    ot_world.set_camera_fov(fov_cockpit_zoom);
  }


Title: Re: work on bk117 helicopter
Post by: cameni on June 09, 2019, 03:03:58 pm
It's an old window used for initial setup. Otherwise it's a normal html window.

What you can do is make such an html, set the path in config (see T817 script, property config returned from init_chassis).
The window will open when pressing the key bound to the ot/player/open_config action.

$object in the html corresponds to the vehicle interface there, but you should see it in the example.
Title: Re: work on bk117 helicopter
Post by: fly77 on June 09, 2019, 03:22:53 pm
Thanks a lot ! Interesting. Will try it.
By the way I found the reason why it came up. I put the register axis command in update frame instead of initialize_reload.
Title: Re: work on bk117 helicopter
Post by: Revolver on June 09, 2019, 05:13:56 pm
Hi Marco!

It becomes very interesting and of all worthwhile, if there can save under each flight object its own settings.
If you understand what I mean ... ;)

Gruß,
Stefan
Title: Re: work on bk117 helicopter
Post by: fly77 on June 10, 2019, 01:37:25 pm
yes I understand well what you mean. Will try if I can get it to work to make something useful
Title: Re: work on bk117 helicopter
Post by: fly77 on June 10, 2019, 03:04:18 pm
It's an old window used for initial setup. Otherwise it's a normal html window.

What you can do is make such an html, set the path in config (see T817 script, property config returned from init_chassis).
The window will open when pressing the key bound to the ot/player/open_config action.

$object in the html corresponds to the vehicle interface there, but you should see it in the example.

Sorry how to bring up the config window for the t817 ? which key ?
Title: Re: work on bk117 helicopter
Post by: KW71 on June 10, 2019, 07:21:31 pm
"t" (to config the suspension parameters).
Title: Re: work on bk117 helicopter
Post by: fly77 on June 15, 2019, 12:21:11 pm
Showing off my fleshly acquired Heli-flying skills doing an aircraft carrier landing. Joystick set to sensitive and low deadzone in outerra + using a lot of trim.
Aircraft carrier and bk117 heli mod are work in progress.

https://youtu.be/uC7PZlaINUI
Title: Re: work on bk117 helicopter
Post by: aWac9 on June 15, 2019, 05:44:30 pm
great, fantastic .. great contribution.
waiting for publication .. :)
Title: Re: work on bk117 helicopter
Post by: Revolver on June 16, 2019, 11:34:22 pm
oha! :o  cool! Sehr gut gemacht, Marco! :)
Title: Re: work on bk117 helicopter
Post by: fly77 on June 17, 2019, 04:39:10 am
danke Stefan ! Will publish something in july
Title: Re: work on bk117 helicopter
Post by: fly77 on June 27, 2019, 04:24:23 pm
I am trying to set up a "config.html" file where I'd like to set other parameters besides wheel_params. That is I'd like to set some of the variable values used in the javascript...for instance in case of the Heinkel...set the number and type of ammunitions. Is it possible through such a config window or do I need to go another way (for instance I am thinking I could use a canvas based menu and use key events to navigate through the menu and incr/decr individual values).
Using the config window would be much more elegant. Is it possible ?
Title: Re: work on bk117 helicopter
Post by: fly77 on June 29, 2019, 10:01:01 am
That window to set initial aircraft parameters looks very interesting... So by following the t817 example I decided I try adding a config folder to the cessna. I found that the necessary files are in outerra /anteworld/www folder

So I created a "config" folder inside the Cessna folder and added inside the "aircraft.html"  +  "ot-slider-raw-css.css" + "outerra-theme.css" files + the "css" and "js" folders copied from www folder as they seem needed.
Then modified the javascript of the Cessna including a  code line   : return {config: "config/aircraft.html"}; to the initialize-reload function.

Then by pressing key "t"  I can open the config window from within the Cessna and set the sliders..also closing the window leaves the plane alive.The only problem is that I do not see any effect on the plane.
Also each time I touch a control in the opened config window  outerra gives me FATAL errors in the eng_log

Code: [Select]
23:09:47.036 FATAL: (c4e) [0630/000947:INFO:aircraft.html?width=400&height=300(31)] onfocus
23:09:47.036 FATAL: (c4e) [0630/000947:INFO:aircraft.html?width=400&height=300(31)] onfocus
23:09:49.929 FATAL: (c4e) [0630/000949:INFO:aircraft.html?width=400&height=300(31)] onfocus
23:09:49.930 FATAL: (c4e) [0630/000949:INFO:aircraft.html?width=400&height=300(31)] onfocus
23:09:51.345 FATAL: (c4e) [0630/000951:INFO:aircraft.html?width=400&height=300(31)] onfocus
23:09:51.345 FATAL: (c4e) [0630/000951:INFO:aircraft.html?width=400&height=300(31)] onfocus
23:09:55.007 FATAL: (c4e) [0630/000955:INFO:aircraft.html?width=400&height=300(35)] onblur
23:09:55.007 WARNING: (c4e) [0630/000955:ERROR:aircraft.html?width=400&height=300(53)] Uncaught TypeError: Object #<Object> has no method 'on_scenario_close'

I guess FATAL is not good  ???

Then I found another way to bring up the config window which is written actually in the outerra help menu..where it says key tilde for initial airplane configuration..on my keyboard this is actually key "@" and it indeed opens the config window of the cessna and now as I touch the sliders indeed they have an effect on the plane position/attitude...BUT as soon as I close the window the Cessna position is frozen into place !!
While some parts of it still seem to react (for instance the joke still reacts to my joystick and flaps values ract to keyboard)..but the position is frozen. The plane can't be reactivated in any way while outerra is still working. Even ctrl+alt+R doesn't  work. By looking at the eng_log I have the following error messages which I don't understand

Code: [Select]
23:07:48.268 FATAL: (c4e) [0630/000748:INFO:aircraft.html?name=Aircraft%20Scenario&width=800&height=222&transparent=true(31)] onfocus
23:07:48.268 FATAL: (c4e) [0630/000748:INFO:aircraft.html?name=Aircraft%20Scenario&width=800&height=222&transparent=true(31)] onfocus
23:07:50.674 FATAL: (c4e) [0630/000750:INFO:aircraft.html?name=Aircraft%20Scenario&width=800&height=222&transparent=true(31)] onfocus
23:07:50.674 FATAL: (c4e) [0630/000750:INFO:aircraft.html?name=Aircraft%20Scenario&width=800&height=222&transparent=true(31)] onfocus
23:07:53.257 FATAL: (c4e) [0630/000753:INFO:aircraft.html?name=Aircraft%20Scenario&width=800&height=222&transparent=true(35)] onblur

So the question is how to "make it react to the sliders" and "keep plane alive"  ? ???  Any hint ?


Title: Re: work on bk117 helicopter
Post by: cameni on June 30, 2019, 02:18:46 am
Those fatals are actually harmless forgotten logs. It's the TypeError you should be worried about. Any object surely should not be named #<Object> ...
Title: Re: work on bk117 helicopter
Post by: fly77 on June 30, 2019, 04:27:45 am
OK I deleted the line "scenario.on_scenario_close()" inside the aircraft.html  that created the type error..now the window closes without giving the type error but still no response from plane when pressing "t" and still position frozen when pressing tilde (or rather @ for me). Is return {config: "config/aircraft.html"} to be placed at the end of initialize_reload or elsewhere and are there some variables that I need to define inside the plane's javascript (like wheelparams for vehicles) so that the return {config: "config/aircraft.html"}  has some effect ?  Like for instance "altitude_asl" that is inside the html ?

Code: [Select]
function close_window() {
                window.close();
                scenario.on_scenario_close()
            }
Title: Re: work on bk117 helicopter
Post by: cameni on June 30, 2019, 04:55:49 am
I think the config value should be returned from your initialize() method in script, like this: return {config:"..."}

The frozen position - that's possibly done by the init window itself, it's pausing the aircraft after the setup. Doesn't the space key unpause it?
Title: Re: work on bk117 helicopter
Post by: fly77 on June 30, 2019, 05:02:59 am
OK space key indeed unblocks the plane after having brought up the config window with tilde (or @) .
For the other method (pressing t) ...that I understand better because I know which config file it is reading...
I have indeed done as you say if I understand right but still no effect. I notice that with the "t" key "reset roll" and "reset pitch" buttons do not even reset the sliders ..which on the contrary happens when bringing up the config window with tilde. Is the tilde key launching the html inside www and the t key the one inside config folder ? If so maybe I need to include something else inside config folder  ? I noticed inside www there is also  "outerra_ui.css" so adding this as well to the config folder make sthe reset buttons act on the sliders..but no still no action on the plane.. something else missing ? I copied all the stuff from ww inside config but it does not change anything.

Anyway ...I can live with the "tilde key"  solution....but the reason why I like that window is that I imagine to use it to set other parameters ..as I said for instance set the fuel of the plane. ...set other variables of the javascript like light switches,amount of ammunition..etc..or properties that I could define in JSBSIM XML file...like autopilot switch...so the main question is ...is this possible with this kind of html file ?

Code: [Select]
function initialize(reload)
{

..
return {config: "config/aircraft.html"}; 
}

   

Title: Re: work on bk117 helicopter
Post by: cameni on June 30, 2019, 01:56:55 pm
What you mean by no effect? Window doesn't open?
But then you wrote
Quote
I notice that with the "t" key "reset roll" and "reset pitch" buttons do not even reset the sliders
If you just copied the original ~ window, then it won't work as that one used some ancient api to set the values. With config window you need to work like you did with vehicles.
Title: Re: work on bk117 helicopter
Post by: fly77 on June 30, 2019, 02:14:48 pm
by "no effect" I mean the config window opens and I can act on sliders and buttons  but the attitude (roll/picth) and altitude/speed of the plane doesn't change when I change the correspondig values in the config window.
OK I see the "airplane.html" inside www uses some old api...while the "vehicle_config.html" inside the t817 folder uses the new api. So I need to rewrite the "airplane.html" following the "syntax" of the "vehicle_config.html".
Will try. But what about my general question ? Can these kind of window be used to set values other than wheelparams or plane attitude/position/speed..I liek to use the to configure other attributes of vehicles and planes...such as variables defined in javascript or properties I define in JSBSIM XML file.
Title: Re: work on bk117 helicopter
Post by: cameni on June 30, 2019, 02:17:04 pm
Yes, I think I mentioned that elsewhere - the config window gets access to the vehicle object you open it on, allowing you to call methods on it that can change any properties available through the vehicle/aircraft API.
Title: Re: work on bk117 helicopter
Post by: fly77 on June 30, 2019, 02:31:35 pm
Great news !! I missed that. Will try to use it to configure autopilot setpoints, armour amount and type as well as fuel for the Heinkel. Thanks for the good news..will try  ;)