OHM Calculation MFD

Wishbone

Clueless developer
Addon Developer
Joined
Sep 12, 2010
Messages
2,421
Reaction score
1
Points
0
Location
Moscow
It finally works this side of the screen, and am anxious to try it out, will keep you posted.

EDIT: simple features (variable and function display) are amazing, will test autopilots next. Hoping you can implement multiple independent MFDs later, or at least 2 per vessel.
 
Last edited:

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
Wishbone, you can open 2 MFDs or more per vessel. They do share the same calculations, but you can scroll/pgup/pgdn the MFDs independently to see different data. Is this what you mean?

Also, there is a file called "calculationmfd PID TEST.txt" that you can rename to try out some pids with the deltaglider. It will work with other ships, it just needs to be tuned.
 

Wishbone

Clueless developer
Addon Developer
Joined
Sep 12, 2010
Messages
2,421
Reaction score
1
Points
0
Location
Moscow
1.All vessels now share the same MFD instance. Not good. (I use Ext MFD a lot).

2.Tried the PID autopilots feature, this is a must-have addon!

EDIT: 3. Setpoints (aka user-defined constants) should be tunable in single click - say, I enter:
Code:
'desired slip'0 step 0.001

and clicking on + and - buttons (yes, I know there's button deficit, but still) will increment and decrement the constant by the value of the step.
 
Last edited:

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
Thanks Wishbone for the feedback!

Looking into multiple instances and step function. I'm thinking of making a menu overlay to minimize some of the buttons. I think I could lose the PR+/PR- buttons for another spot.
 

Wishbone

Clueless developer
Addon Developer
Joined
Sep 12, 2010
Messages
2,421
Reaction score
1
Points
0
Location
Moscow
Re: buttons. Yes, PR+ and PR- can be merged into one button, cycling the precision just the same as you do for font size (BTW, am not sure whether FNT button deserves being placed on the front page). You can always add reverse cycling by checking if the user pressed Ctrl (with the GetAsyncKeyState function).

Page up and down are used very infrequently, so it may be possible to tie this functionality to line up and down buttons with Ctrl modifier.

The description for the FNT button is misplaced (press MNU to verify). My personal preference is to abstain from making the user press MNU, and limit the number of buttons per MFD page to 11 (I use one button to cycle through pages).

Would be nice to be able to choose the name of the file to load settings from (e.g. different autopilot routines could reside in different files).

EDIT:
Re: functions. For Mars missions and missions to the giants, it may be useful to explicitly specify reference body for pitch, yaw, etc., since the SurfaceRef planet/moon is not always the body of interest (e.g. I want to keep my craft horizontal in reference to Mars, and not Mars, Phobos, Deimos and Mars again in succession).

The MFD configuration should allow the player to specify and enforce maximum time acceleration when the MFD is not paused (otherwise the autopilots start misbehavin').

EDIT #2: The entry for "Compatible SDKs" at OHM is confusing. It usually means you've got to have the corresponding SDKs installed. There are no such pre-requisites for Calculation MFD (does it use sounds?).
 
Last edited:

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
Thanks for the feedback Wishbone. Please tell me if I missed anything in my list of items.

Items:
1) pr+/-
Still thinking about this one. I like the idea of cycling the precision. There are at least 3 buttons that are taking room that could be converted to 1. Still thinking about this.

2) pgup/pgdn + ctrl
3) fnt desc
fixed

4) file
Would the user type it in? Perhaps some type of "browse" would work too.

5) functions that take ref body

The pitch function called when you enter an expression is this:

Code:
double pitch()
{
    return g_vessel->GetPitch() ;
}

I just looked quick to see if I could find a pitch function that takes a ref body as reference, but didn't see one. I see a function for relative velocity and position to a reference body, but that would not give a true pitch or orientation.

I could do something nasty like get the orientation off the reference body than use the default ref body as a middle point for calculation, but that's kind of a "hack" imo.

Do you know a function for global orientation or orientation wrt a ref body? Or a better way to calculate this?

6) limit time compression
7) ohm "compatible sdks"
Fixed. Yeah, I stared at that for a bit, and continually saw the word "compatible". lol Yeah I agree, it seems like it's more used like "required sdks" than "compatible".


Also:
a) Please share if you would like to see specific functions/variables from orbiter. You can also submit the function right here in the forums if you want. I will add more functions as I go.

Function formats:
Code:
double <function name>( void )
double <function name>( double value )
double <function name>( double* value ) // array, calc mfd will also need # of arguments

I'm starting to think user defined functions might be useful, but that's for a later point.

b) If controls or something is "jerky" or not working properly, please share. I tried calc mfd on my old computer, and the pgup/pgdn was a bit jerky when the mfd refresh rate was too high, I'm debating on whether to tweak or not.
 
Last edited:

Wishbone

Clueless developer
Addon Developer
Joined
Sep 12, 2010
Messages
2,421
Reaction score
1
Points
0
Location
Moscow
Found a bug:

If I enter a line
Code:
abs(dx1/9.81)
the parser enters into an infinite loop and one has to terminate Orbiter.
 

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
Got this fixed, with a few other bugs. abs is the first non 1 char function, and it was conflicting with ',' in the function list.

---------- Post added at 05:50 PM ---------- Previous post was at 05:48 PM ----------

Uploading fix in a few minutes...

[edit] uploading fix in a few minutes (min() seems to be acting strange)...

---------- Post added at 06:14 PM ---------- Previous post was at 05:50 PM ----------

Item 8) INC/DEC (step function)
I don't know why I forgot to add this to the list, I remember you mentioned this.

---------- Post added at 06:19 PM ---------- Previous post was at 06:14 PM ----------

I don't know if I feel comfortable with the CTRL key modifier however for some MFD buttons. I never heard of using the CTRL key for the MFD keys. I feel I would have to use the CTRL key modifier in addition to another method.

Here's what I have for the menu so far.
Code:
Old button layout (2 pages)
// SET    UP
// DEL    DN
// PR+    PGU
// PR-    PGD
// 1E    HLP
// PAU    FNT

// SAV    UP
// LOD    DN
// T+    PGU
// T-    PGD
// CUT    RPN
// PST

// new button layout (1 page)
//    SET    UP
//    OPT    DN
//    DEL    PGU
//    INC    PGD
//    DEC    HLP
//    PAU    OK

// OPTIONS page (user would scroll up and down OR click the adjacent button to access functions)
// Equation Settings:
// <equation> <value>
// SET equation
// SET precision
// SET format
// CUT equation
// PASTE equation
//
// MFD Settings
// RPN mode
// SET font size
// SET refresh rate
//
 

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
Just an idea of a menu system...
 

Attachments

  • calc_mfd_testing.png
    calc_mfd_testing.png
    107.6 KB · Views: 18

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
Here's the latest beta release.

Sept 19 2001 Changelog:
- there are only 12 MFD buttons total now.
- DEL button removed, now replaced with CUT. So, if you want to delete something, use CUT. If you CUT something by mistake, just go into OPTions and PASTE. This will eliminate DELeting something by mistake. Anything placed in the CUT buffer can be PASTEd many times, until something else is CUT.
- OPTions menu
- CUTting and PASTEing will redirect variables used. For example, if I have: expression x1: "x0 * 2" and I cut x0 and paste it in expression x2, x1 will be redirected to x2, so expression x1: "x2 * 0"
- if an expression has been edited, the file has not been saved and orbiter exits, calcmfd will save the expressions to "__last__calc_mfd.txt".
- functions rel_pos_x, rel_pos_y and rel_pos_z have been added to get relative positions from a specified planet, vessel, etc. The user will supply an index to get the object. If the index of an object is unknown, it can be obtained with the function by_name. For example:
rel_pos_x( by_name( earth ) ) : will return the x component of the vector from earth to your vessel.
- functions arot_x, arot_y and arot_z are now available to provide the user with the Euler angles of the vessel in ecliptic frame (x corresponding to alpha, y to beta and z to gamma angles).
- keyboard shortcuts now work with the menu buttons. The keys 1 to 9, 0, - and = are used for the full 12 MFD buttons (the full 12 keys on your keyboard starting from 1 to =). So, if the MFD is the left MFD, left shift plus these keys will manipulate the MFD keys.
- step function. If an expression is selected, and the function has the operator "step" in it, the value of step can be incremented or decremented by 1 using the INC or DEC keys on the MFD. For example, expression x0: "step * 0.1" will cause x0 to evaluate to 0 at first run, and pressing INC will change x0 to step * 0.1 = 1 * 0.1 = 0.1. So if the user wants to change the step size, the user can multiply or divide the step by a value, or use the step as part of an exponential calculation
- fixed bug with main/slaved mfds
- pitch_wrt() works, however bank_wrt() and yaw_wrt() are work in progress. pitch_wrt (pitch with respect to) takes an object index as a parameter, similar to rel_pos_x above. So, to get the pitch value from earth, we would use pitch_wrt( by_name( earth ) ) or pitch_wrt( 3 ) since Earth happens to be the third object.

Todo:
- bank_wrt and yaw_wrt

Might do:
- vector3 and matrix3 output
- vector3 and matrix3 operations
- graphing (cartesian and polar, maybe even something specific for Euler angles). This might be a separate MFD however.
 

Attachments

  • CalculationMFD.zip
    759.4 KB · Views: 6
Last edited:

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
Version 110928 Released with pitch_wrt, bank_wrt and yaw_wrt.

For example, deg( pitch_wrt(0) ) or deg( pitch_wrt( get_obj_index( "sun" ) ) ) will return the pitch angle in degrees from the Sun. As far as I know, all flying objects can be referenced, so if you want your pitch relative to delta glider GL-02, you can set:
pitch_wrt( get_obj_index( "GL-02" ) )

Now... to look into making each instance of Calculation MFD stand alone.
 

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
Bugs? Review? Is it horrible? lol

Bugs I found: periapsis_dist and apoapsis_dist now only return distance to surface of reference planet, NOT the actual radius to center of reference planet.

Wishbone, I remember you asked for separate instances. I was able to use CalcMFD in external mfd just fine. Are you looking to get data from other vessels other than the vessel you're controlling?

Either way, this is in the works, just thought of a few ways to make the mfds independent without too much trouble.

---------- Post added 10-03-11 at 04:05 PM ---------- Previous post was 10-02-11 at 06:20 PM ----------

Ok multiple Calc MFDs are independent now, where each MFD has its own instance. An issue now is if one MFD saves a file, the other MFD has to reload the file to see the changes. The only thing shared is joystick data (read below).

Also, multiple joystick support for joysticks is now available. I also put in force feedback support for joysticks that have force feedback.

So new functions:
<double> joy_x( <joy_index> )
" joy_y "
" joy_z "
" joy_slider1 "
" joy_slider2 "
" joy_rx "
" joy_ry "
" joy_rz "

joy_force_xy( <joy_index>, <enable>, <force_x>, <force_y> )

I still need to do some testing, but it looks good so far. I had fun with the force feedback by setting <force_y> to aoa, so the joystick always forces towards 0 aoa.

Example:
joy_force_xy(0,1,0,aoa*-1)
 
Last edited:

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
Oct 7 2011 Beta Features:

-each Calculation MFD is a new instance so a user can load a different calculation file for each CalcMFD. Each CalcMFD defaults to the "calculationmfd.txt" file until the user loads another file.
-support for 16 joysticks and multiple axes (x,y,z,rx,ry,rz, slider1 and slider2 )
New functions for joystick are:
Code:
joy_x( <joystick index> )
joy_y( <joystick index> )
joy_z( <joystick index> )
joy_rx( <joystick index> )
joy_ry( <joystick index> )
joy_rz( <joystick index> )
joy_slider1( <joystick index> )
joy_slider2( <joystick index> )

joystick index: 0 to 15, corresponding to the joystick.  You can load js.txt to test for joysticks.  If the joystick was not detected or unplugged, the appropriate error will appear.




-support for forcefeedback joysticks. Users can now send forces to the x and y axes.
Code:
joy_force_xy( <joystick index>, <enable>, <X force>, <Y force> )
joystick index: 0 to 16
enable: 0 for disable, anything but 0 to enable
X force: range -1 to 1, 0 being no force
Y force: range -1 to 1, 0 being no force

-new selection in the options menu: Show Calc Times. By enabling this, the user will be able to see how long each calculation takes (in cpu ticks).

-improved some orbit parameter calculations so that some orbit calculations will run faster.

After about a week or so of testing, I'll upload this file to the Hangar.

:cheers:
 

Attachments

  • CalculationMFD.zip
    639.1 KB · Views: 3
Last edited:

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
I should mention: force feedback was tested on an old Microsoft ForceFeedback 2 joystick. MY MS FF2 will only start to give serious forces above 0.15, so if your joy_force_xy result is less than 0.15 you might not feel it very much.

Also, if your joystick isn't supporting force feedback you should get an error on the line where joy_force_xy was.

Some fun stuff I used forcefeedback with:
- I used the aoa * a modifier as the y force, so if the aoa was too high, the joystick would force forward, and if the aoa was too low, the joystick would push back. It's really cool to know what your aoa is just by the feeling of the forces on the stick. This was fun with the XR2 because I could shift back the CG and still keep the aircraft under control by not oscillating past the velocity vector.
- I used bank as the x force, so the joystick would always want to level out the vehicle.

== EDIT ==
For smoother response from the joystick, you can start Orbiter, click on parameters in the Launchpad, and make sure "MFD Refresh [sec]" is between 0.05 and 0.1. If the value is too low, the MFDs will refresh too often and bring down Orbiter's performance, especially fps (frame rate per second). If "MFD Refresh" is set to 0.1, then Calculation MFD can be set to 100 refresh (100 ms). If "MFD Refresh" is set to 0.05, Calculation MFD can be set also to 50 ms.

Unrelated to the joystick functions:
Calculation MFD cannot refresh faster than the MFD Refresh, but if some calculations are cpu intensive, then Calculation MFD can calculate less often by increasing the Refresh time.
 
Last edited:

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
Updated on Orbiter Hangar. I also added an aesthetic option: users can now change the colors.

Version is 111015.

:cheers:

---------- Post added at 03:12 AM ---------- Previous post was at 03:10 AM ----------

Bugfix: ix0 to ix64 should work correctly now.
 

RaR76

Addon Developer
Addon Developer
Joined
Jun 22, 2010
Messages
42
Reaction score
0
Points
0
Location
New Brunswick
This addon is in "limbo" for the time being - I have many things going on like a new baby boy, 8 months old tomorrow! Also, virus (ramnit) took out my entire computer including vc++ and all the other stuff I had with it (orbiter sdk, cuda, direct x...).

It will be in a hold state until I get vc++ up and running and I have time to work on it. If someone was or is looking really forward to updates, please post and I'll see if I can help.

I apologize if this is considered "necroposting".

Cheers!
 
Last edited:

Kinetics

Member
Joined
Dec 22, 2012
Messages
32
Reaction score
0
Points
6
how do you use the command : 'fuel_eff(index)'

How can you find actual main thrust - not hypothetical

thanks
 
Last edited:
Top