Howto talk:Implement a Fly-By-Wire System for Airliners: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(Created page with "@Hooray, I think I over-wrote your changes as I was editing the page when you made them. How do I merge your changes with the rest of the article? I don't really know how to get ...")
 
m (moved [[Talk:Howto: Implement a Fly-By-Wire System for Airliners]] to [[Talk:Howto:Implement a Fly-By-Wire System for Airliners]]: Robot: Moved page)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Editing conflict ==
@Hooray, I think I over-wrote your changes as I was editing the page when you made them. How do I merge your changes with the rest of the article? I don't really know how to get those changes either. --Omega95
@Hooray, I think I over-wrote your changes as I was editing the page when you made them. How do I merge your changes with the rest of the article? I don't really know how to get those changes either. --Omega95
: Don't worry, those were just simple fixes. I'll stop editing your code until you think you are finished. No problem. It's very easy to see what changes were made and add them again, just look at the history (tab) and then click the "prev" link for any edits you see, that will show you the differences for the edits made between that version and the previous version. Clicking the "cur" link will show you the differences between the current/latest version and that edit. Alternatively, you click "Recent Changes" and then the "diff" link for any edit. HTH --[[User:Hooray|Hooray]] 04:46, 7 February 2012 (EST)
== Aircraft specific configurations ==
Seems you are looking to come up with a module that can be used for both, Airbus and Boeing aircraft? I can help you generalizing the Nasal code accordingly. But I would suggest not to use entirely different code here for similar modes. For functions that are specific to the aircraft manufacturer or the type of aircraft, it would be better to read in custom variables from the property tree, such as min/max bank, max roll rate, min/max AoA. These things could be conveniently specified in a separate [[PropertyList XML]] file. So aircraft developers would only need to copy and customize an XML file, and include it in their aircraft-set.xml file. This would help you keep your code pretty generic, reading aircraft-specific stuff from the property tree instead. Obviously, this would only need
to take place during initialization/at startup, because the manufacturer or type of aircraft doesn't change at run time. So, you could set up some script-specific variables during init to customize your code with aircraft-specific data. --[[User:Hooray|Hooray]] 05:58, 7 February 2012 (EST)
== Vectors and Hashes Error ==
Hooray, I tried your modifications and got this error:
Nasal runtime error: vector index 0 out of bounds (size: 0)
  at /usr/local/src/fgdata-2.4/Aircraft/787-8/Nasal/fbw.nas, line 91
--[[User:Omega1174|Omega95]]
:: Sorry, my bad: Should be fixed, but to explain what happened: I basically set up a vector with size 0 and then tried to access non-existent elements. The right thing to do would be using the [http://plausible.org/nasal/lib.html setsize(vector, size) function] here, or just initializing the vector with some data, so that the size is correct. The setsize() function would do that automatically (for each item,it'd add a nil value). This happened because in my example (PM) I suggested directly adding the getprop() calls into the vector initialization: <syntaxhighlight lang="php">var throttles=[getprop("controls/engines/engine[0]/throttle"), getprop("controls/engines/engine[1]/throttle")];</syntaxhighlight> --[[User:Hooray|Hooray]] 12:28, 7 February 2012 (EST)
::: Is the code working again properly for you? --[[User:Hooray|Hooray]] 05:42, 8 February 2012 (EST)

Latest revision as of 16:42, 6 May 2012

Editing conflict

@Hooray, I think I over-wrote your changes as I was editing the page when you made them. How do I merge your changes with the rest of the article? I don't really know how to get those changes either. --Omega95

Don't worry, those were just simple fixes. I'll stop editing your code until you think you are finished. No problem. It's very easy to see what changes were made and add them again, just look at the history (tab) and then click the "prev" link for any edits you see, that will show you the differences for the edits made between that version and the previous version. Clicking the "cur" link will show you the differences between the current/latest version and that edit. Alternatively, you click "Recent Changes" and then the "diff" link for any edit. HTH --Hooray 04:46, 7 February 2012 (EST)

Aircraft specific configurations

Seems you are looking to come up with a module that can be used for both, Airbus and Boeing aircraft? I can help you generalizing the Nasal code accordingly. But I would suggest not to use entirely different code here for similar modes. For functions that are specific to the aircraft manufacturer or the type of aircraft, it would be better to read in custom variables from the property tree, such as min/max bank, max roll rate, min/max AoA. These things could be conveniently specified in a separate PropertyList XML file. So aircraft developers would only need to copy and customize an XML file, and include it in their aircraft-set.xml file. This would help you keep your code pretty generic, reading aircraft-specific stuff from the property tree instead. Obviously, this would only need to take place during initialization/at startup, because the manufacturer or type of aircraft doesn't change at run time. So, you could set up some script-specific variables during init to customize your code with aircraft-specific data. --Hooray 05:58, 7 February 2012 (EST)

Vectors and Hashes Error

Hooray, I tried your modifications and got this error:

Nasal runtime error: vector index 0 out of bounds (size: 0)

 at /usr/local/src/fgdata-2.4/Aircraft/787-8/Nasal/fbw.nas, line 91

--Omega95

Sorry, my bad: Should be fixed, but to explain what happened: I basically set up a vector with size 0 and then tried to access non-existent elements. The right thing to do would be using the setsize(vector, size) function here, or just initializing the vector with some data, so that the size is correct. The setsize() function would do that automatically (for each item,it'd add a nil value). This happened because in my example (PM) I suggested directly adding the getprop() calls into the vector initialization:
var throttles=[getprop("controls/engines/engine[0]/throttle"), getprop("controls/engines/engine[1]/throttle")];
--Hooray 12:28, 7 February 2012 (EST)
Is the code working again properly for you? --Hooray 05:42, 8 February 2012 (EST)