I don't know if this is the best approach or not, but when I tackled this
task for the ATC Flight Simulator interface (FAA certified flight sim based
on FlightGear) I dug in and wrote some C++ code.

I created a structure where I could load an xml file that associated the raw
physical hardware (switch number, etc) with a flightgear property.  The C++
code would run every frame, read the hardware, and then do the appropriate
magic to figure out the user intent, and then update the actual FlightGear
properties.

This has worked out pretty well and been very solid ... and as a plus, you
can directly handle some -- shall we say -- creative hardware layout
schemes.

I started all this before Nasal really existed or at least before it was
widely used.  These days you might think about reading the raw switch states
into some branch of the property tree you create.  Then setup some nasal
code that examines the switch states each frame and does whatever
computation is necessary to interpret your hardware and update the property
values correctly.

Best regards,

Curt.

On Thu, Mar 31, 2011 at 3:28 PM, Roberto Inzerillo <rob...@gmx.net> wrote:

> Hallo everybody,
>  I purchased a few rotary encoder and a bunch of 7segment displays to build
> a physical replacement of the Bendix KX165. I'm using Arduino which feeds
> data to FGFS on a serial connection. I'd like to update
> "instrumentation/comm[0]/frequencies/standby-mhz" property using the rotary
> encoder, I wonder what's the best strategy.
>
> My current setup lets me read the rotary encoder rotation (it's a signed
> int value that measures it's direction and the amount of rotation; e.g. +3
> equals three steps CW, -1 is 1 step CCW and 0 means it's not rotating) and
> send it to fgsf at 30Hz. This encoder is meant to be the KX165 physical
> equivalent of the frequency selector knob.
>
> I can send those values to FGFS but that's useless as it is now; I should
> make FGFS increment the "standby-mhz" property accordingly; problem is that
> using the generic protocol to feed those data I can't use the same approach
> as in kx165-1.xml where the "property-adjust" (with a proper <step> value)
> command has been used.
>
> I wonder how could I attack this part of the problem. Suggestions?
>
> My first thought was to feed the raw increment to fgfs, store it in a
> custom property and let fgfs run a nasal script to update standby-mhz
> accordingly in the background. I'm only guessing now, I don't even know if
> it's even possible.
>
> This scenario is of course of great interest to me since I'd like to use
> those rotary encoders for more stuff on FGFS.
>
> cheers,
>  Roberto
> --
> NEU: FreePhone - kostenlos mobil telefonieren und surfen!
> Jetzt informieren: http://www.gmx.net/de/go/freephone
>
>
> ------------------------------------------------------------------------------
> Create and publish websites with WebMatrix
> Use the most popular FREE web apps or write code yourself;
> WebMatrix provides all the features you need to develop and
> publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
> _______________________________________________
> Flightgear-devel mailing list
> Flightgear-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
>



-- 
Curtis Olson:
http://www.atiak.com - http://aem.umn.edu/~uav/
http://www.flightgear.org -
http://gallinazo.flightgear.org<http://www.flightgear.org/blogs/category/personal/curt/>
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to