Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Outerra Tech Demo download. Help with graphics driver issues

Author Topic: auto pilot  (Read 9681 times)

bomber

  • Hero Member
  • *****
  • Posts: 523
  • newbie
auto pilot
« on: March 01, 2015, 03:56:22 pm »

I was wondering if anyone has any interest in the design of one.

We'd need a java programmer and outerra developer to create a 2d gui...

I'll deal with the jsbsim side and any properties the java programmer requires...

If there's interest we could talk about a functional requirement.
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

Uriah

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 569
  • We do these things not because they are easy. -JFK
Re: auto pilot
« Reply #1 on: March 01, 2015, 04:54:16 pm »

I am very interested in working on an autopilot with you! Let's discuss the functional requirements and determine where we are at and what needs to be accomplished.

Regards,
Uriah
Logged

bomber

  • Hero Member
  • *****
  • Posts: 523
  • newbie
Re: auto pilot
« Reply #2 on: March 02, 2015, 02:11:13 pm »

Functional requirement.....

Wing leveller
Climb/decent to height
        Rate of climb
        Speed climb
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

bomber

  • Hero Member
  • *****
  • Posts: 523
  • newbie
Re: auto pilot
« Reply #3 on: March 03, 2015, 11:57:27 am »

What's needed as a basic requirement is to turn on wing leveling, (wing levleing I can do in jsbsim)....

I was thinking about turning the auto pilot on and off and was thinking could we have 2 pilot cameras.... identical to each other such that when swaping you can't tell.... However when in one view it sets a JSBsim property to 1 in the other to 0..

I can then use this within a JSBsim xml switch to activate and deactive the autopilot.

Simon
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

josem75

  • Sr. Member
  • ****
  • Posts: 286
  • newbie
Re: auto pilot
« Reply #4 on: March 03, 2015, 12:23:56 pm »

What's needed as a basic requirement is to turn on wing leveling, (wing levleing I can do in jsbsim)....

I was thinking about turning the auto pilot on and off and was thinking could we have 2 pilot cameras.... identical to each other such that when swaping you can't tell.... However when in one view it sets a JSBsim property to 1 in the other to 0..

I can then use this within a JSBsim xml switch to activate and deactive the autopilot.

Simon

Autopilot would be a great adition. At the moment i cant help in those tasks, but i can help in build nice things for fly over and see while autopilot do the job..
Logged

Uriah

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 569
  • We do these things not because they are easy. -JFK
Re: auto pilot
« Reply #5 on: March 03, 2015, 12:39:07 pm »

That is an interesting method. I can also bind the H key to any function we need. With helicopters it switches the autopilot on. Look in the FDM for the UH-60 Black Hawk or locate the jsbsim files for the Ah-64. We can also you the view switch method to bind the V key like you said. I had never though of that one in particular but it will work.

Set me up with a test FDM and all I need to know is what jsb properties to set.

Regards,
Uriah
Logged

Uriah

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 569
  • We do these things not because they are easy. -JFK
Re: auto pilot
« Reply #6 on: March 03, 2015, 01:41:46 pm »

I want to preface this by noting these are temporary hacks, and aircraft will have extended controls soon.

Here is the basic functionality for the seat_cam key bind hack:

You can replace the output of the //Autopilot Switch if and else if statements under update_frame section:

Code: [Select]
autopilot_switch = false; //Example
With to set any jsb property:

Code: [Select]
autopilot_switch = jsb['fcs/autopilot']=1; //Example of setting a jsb property

Code: [Select]
function switch_seat(cam){
  if(cam===0){     
    this.set_fps_camera_pos({x:-0.25, y:-0.2, z:0.3}); //Cockpit
  seat_cam=0;}
  else if(cam===1){
    this.set_fps_camera_pos({x:-0.25, y:-0.2, z:0.3}); //Front
  seat_cam=1;}
  else return false;return true;}


Code: [Select]
function update_frame(dt){

//Autopilot Switch
  var seat_switch;
  if(this.get_camera_mode() == 0 && seat_cam==0){
    autopilot_switch = false;
  }
  else if(this.get_camera_mode() == 1 && autopilot_cam==1){
    seat_switch = true;
  }

Now...

The 'H' key used to toggle Hover mode, is added to the javascript file in the initialize section of a helicopter like so:

Code: [Select]
this.activate_event_group("heli");
You can modify the input-output map (./Anteworld/iomap.default.cfg) to include a custom event group, and access those key binds from the FDM, like so:

Code: [Select]
this.activate_event_group("aircraft");
Code: [Select]
{
"name" : "aircraft",
"actions" : [
{
"name" : "elevator_up",
"bindings" : [{"event_name":"W"},{"event_name":"Axis0-"}]
},
{
"name" : "elevator_down",
"bindings" : [{"event_name":"S"},{"event_name":"Axis0+"}]
},
{
"name" : "aileron_left",
"bindings" : [{"event_name":"A"},{"event_name":"Axis1-"}]
},
{
"name" : "aileron_right",
"bindings" : [{"event_name":"D"},{"event_name":"Axis1+"}]
},
{
"name" : "rudder_left",
"bindings" : [{"event_name":"Z"},{"event_name":"Axis3-"}]
},
{
"name" : "rudder_right",
"bindings" : [{"event_name":"X"},{"event_name":"Axis3+"}]
},
{
"name" : "throttle",
"bindings" : [{"event_name":"Axis4","invert":true}]
},
{
"name" : "throttle_up",
"bindings" : [{"event_name":"PageUp"}]
},
{
"name" : "throttle_down",
"bindings" : [{"event_name":"PageDown"}]
},
{
"name" : "mixture",
"bindings" : []
},
{
"name" : "mixture_up",
"bindings" : [{"event_name":"Home"}]
},
{
"name" : "mixture_down",
"bindings" : [{"event_name":"End"}]
},
{
"name" : "flaps_up",
"bindings" : [{"event_name":"Insert"},{"event_name":"Btn2"}]
},
{
"name" : "flaps_down",
"bindings" : [{"event_name":"Delete"},{"event_name":"Btn0"}]
},
{
"name" : "trim_elevator_up",
"bindings" : []
},
{
"name" : "trim_elevator_down",
"bindings" : []
},
{
"name" : "trim_aileron_left",
"bindings" : []
},
{
"name" : "trim_aileron_right",
"bindings" : []
},
{
"name" : "trim_rudder_left",
"bindings" : []
},
{
"name" : "trim_rudder_right",
"bindings" : []
},
{
"name" : "gear",
"bindings" : [{"event_name":"Period"}]
},
{
"name" : "brake",
"bindings" : [{"event_name":"B"},{"event_name":"Btn8"}]
},
{
"name" : "start_stop_engine",
"bindings" : [{"event_name":"E"},{"event_name":"Btn6"}]
},
{
"name" : "scenario_setup",
"bindings" : [{"event_name":"~"}]
},
{
"name" : "pause_simulation",
"bindings" : [{"event_name":"Space"},{"event_name":"Btn7"}]
},
{
"name" : "autopilot_switch",
"bindings" : [{"event_name":"A", "modifiers":"Ctrl"}}]
},
]
},

Regards,
Uriah
« Last Edit: March 03, 2015, 01:51:04 pm by Uriah »
Logged

bomber

  • Hero Member
  • *****
  • Posts: 523
  • newbie
Re: auto pilot
« Reply #7 on: March 03, 2015, 02:05:12 pm »

A question....

Can you make these key bindings individual plane specific... or even change the key binding per camera view you're in ?
Logged
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchell

Uriah

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 569
  • We do these things not because they are easy. -JFK
Re: auto pilot
« Reply #8 on: March 03, 2015, 02:25:18 pm »

Easily,

Define as many new event groups as you need for individiual aircraft, add the include to the initialize section of the js script with the same name, which I am assuming replaces the default 'plane' event group for aircraft. The aircraft one I post above is a totally custom one, and could be named 'c172' for that matter.

Check the AH-64 or UH-60 FDMs to see how these key binds are input as actions into the FDM scipt, using the naming convention of the event:

Event in iomap in 'heli' event group:
Code: [Select]
{
"name" : "toggle_hover_mode",
"bindings" : [{"event_name":"H"},{"event_name":"Btn0"}]
},

For key bindings to change per camera, I would have to set the include under update section, and I haven't tested that yet, but I am about to.
Logged

Uriah

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 569
  • We do these things not because they are easy. -JFK
Re: auto pilot
« Reply #9 on: March 03, 2015, 04:39:59 pm »

Sorry I was wrong. There interface between the iomap and the FDM is hard coded at the moment so we can't pass custom events to jsb.

Oh well, extended controls on the horizon, and at least we have what we need for flight testing.

Regards,
Uriah
Logged