Template:CppBind Ideas: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
m (makelistener() discussion: http://forum.flightgear.org/viewtopic.php?f=71&t=24649&p=225062#p225044)
m (SIGAR for cross-platform process monitoring (CPU, GPU, RAM, VRAM etc): https://support.hyperic.com/display/SIGAR/Home)
Line 15: Line 15:
* SGCondition {{Done}} (by TheTom) [https://gitorious.org/fg/flightgear/commit/1b55ab5f4032c6f3f1a4d07c0b9babd3744f1c37]
* SGCondition {{Done}} (by TheTom) [https://gitorious.org/fg/flightgear/commit/1b55ab5f4032c6f3f1a4d07c0b9babd3744f1c37]
* SGPropertyChangeListener {{Pending}} (suggested by Zakalawe & TheTom) [http://forum.flightgear.org/viewtopic.php?f=71&t=24649&p=225062#p225044]
* SGPropertyChangeListener {{Pending}} (suggested by Zakalawe & TheTom) [http://forum.flightgear.org/viewtopic.php?f=71&t=24649&p=225062#p225044]
* for better diagnostics, and better [[Subsystem-level Memory Tracking for FlightGear|end-user bug reports]], we could consider exposing a cross-platform process and system utilities module via [[Nasal/CppBind]], such as e.g. [https://github.com/giampaolo/psutil psutil] (Windows, MacOS & BSD/Unix) {{Not done}}
* for better diagnostics, and better [[Subsystem-level Memory Tracking for FlightGear|end-user bug reports]], we could consider exposing a cross-platform process and system utilities module via [[Nasal/CppBind]], such as e.g. [https://support.hyperic.com/display/SIGAR/Home SIGAR] (Windows, MacOS & BSD/Unix) {{Not done}}
* Airways/Airspace boundaries don't seem to be exposed via NasalPositioned currently? [http://wiki.flightgear.org/List_of_Nasal_extension_functions#Positioned_Object_Queries][http://forum.flightgear.org/viewtopic.php?f=75&t=23041]
* Airways/Airspace boundaries don't seem to be exposed via NasalPositioned currently? [http://wiki.flightgear.org/List_of_Nasal_extension_functions#Positioned_Object_Queries][http://forum.flightgear.org/viewtopic.php?f=75&t=23041]
* FGProtocol, to implement I/O protocols via Nasal (and help solve {{issue|396}} and support AJAX, REST, JSON or WebSockets) {{Progressbar|30}} [http://forum.flightgear.org/viewtopic.php?f=30&t=21346&p=194458&hilit=fginterface#p194456] [http://forum.flightgear.org/viewtopic.php?f=18&t=21561&p=196141#p196141] [http://forum.flightgear.org/viewtopic.php?f=18&t=22630&p=205664#p205430] (stubs available at [https://gitorious.org/fg/hoorays-flightgear/commits/topics/cppbind-fgprotocol])
* FGProtocol, to implement I/O protocols via Nasal (and help solve {{issue|396}} and support AJAX, REST, JSON or WebSockets) {{Progressbar|30}} [http://forum.flightgear.org/viewtopic.php?f=30&t=21346&p=194458&hilit=fginterface#p194456] [http://forum.flightgear.org/viewtopic.php?f=18&t=21561&p=196141#p196141] [http://forum.flightgear.org/viewtopic.php?f=18&t=22630&p=205664#p205430] (stubs available at [https://gitorious.org/fg/hoorays-flightgear/commits/topics/cppbind-fgprotocol])

Revision as of 16:07, 21 November 2014

FlightGear's built-in Nasal scripting language comes with a set of standard libraries, and can be extended using FlightGear specific APIs.

Exposing simulator internals to scripting space is a fairly common and useful thing, because it enables base package developers to access these internals without having to build FlightGear from source, so the barrier to entry is significantly lower and we've seen an increasing number of novel features purely implemented in scripting space, due to powerful APIs being available to aircraft developers and other base package developers.

Until FlightGear 2.8, the Nasal scripting engine only provided a C API to expose such hooks/bindings to scripting space or to expose scripting space data structures back to C/C++.

Unlike the core Nasal engine itself (which is C), FlightGear however is mostly written and being developed in C++. For quite a while, that meant that the Nasal APIs were a bit low-level, and sometimes also awkward to use when making functions, data structures or objects accessible between C++ and Nasal.

Thanks to development on Tom's Canvas system, there's now a new bindings framework to be found in $SG_SRC/simgear/nasal/cppbind. This is fully object oriented and supports modern C++ features by operating through classes and methods with full STL support, abstracting most common operations away.


After working through the Nasal/CppBind article, some of the more useful things to play with in the beginning, would be exposing additional SG/FG classes to Nasal space, such as for example:

  • SGPath Done Done (by TheTom)
  • SGCondition Done Done (by TheTom) [1]
  • SGPropertyChangeListener Pending Pending (suggested by Zakalawe & TheTom) [2]
  • for better diagnostics, and better end-user bug reports, we could consider exposing a cross-platform process and system utilities module via Nasal/CppBind, such as e.g. SIGAR (Windows, MacOS & BSD/Unix) Not done Not done
  • Airways/Airspace boundaries don't seem to be exposed via NasalPositioned currently? [3][4]
  • FGProtocol, to implement I/O protocols via Nasal (and help solve ticket #396 and support AJAX, REST, JSON or WebSockets) 30}% completed [5] [6] [7] (stubs available at [8])
  • the loglist/SG_LOG() logging buffer machinery [9]
  • expose VoiceSynthesizer/FLITE TTS[10] to Nasal to get rid of ATC chatter [11] Not done Not done
  • the SGSubsystem interface to register scripted SGSubsystems
  • flight path history [12] Done Done (by TheTom)
  • the flight recorder system (replay buffers) Not done Not done
  • State machines e.g. to help clean up the ND code [13]
  • the autopilot system [14] [15] [16] (there are certain Nasal GC issues, so that we ask people not to implement FDM-coupled Nasal code like autopilots)
  • exposing the sound manager, so that scripts can directly play audio files [17]
  • exposing the random buildings system [18] Pending Pending [19]
  • There's also a pending feature request (ticket #619) to implement USB-HID support [20].
  • ESRI shapelib? [21]
  • effects framework ?
  • Howto:Using OpenCL in FlightGear
  • Nasal/HLA bindings, so that we can run certain scripts as HLA federates outside the fgfs process space (such as bombable or local weather)
Cquote1.png Specifically, there are some C++ data structures that still need to be exposed to Nasal via cppbind so that we can implement features available in the Map dialog and the hard-coded ND

Canvas_GUI#PUI_Widgets


— Hooray (Tue Jun 24). Phasing out MapWidget post 3.2.
(powered by Instant-Cquotes)
Cquote2.png
Note  Before working on anything related, please do get in touch with other contributors to ensure that this list is still up-to-date.

For more technical Nasal questions (C API, internals etc), you'll probably want to refer to Philosopher, TheTom, Zakalawe or Hooray on the forum - TheTom and Zakalawe can also provide help on using cppbind, having both used it extensively during the last months.