Implementing VNAV support in FlightGear: Difference between revisions

Jump to navigation Jump to search
(→‎JSBSim: how to add new FCS components)
Line 160: Line 160:
== JSBSim ==
== JSBSim ==
=== Adding new Control System Components ===
=== Adding new Control System Components ===
It is foreseeable that we may need to modify and extend JSBSim, i.e. to add new components - here's a stub to add an empty '''FGDummy''' component to JSBSim:
<syntaxhighlight lang="diff">
<syntaxhighlight lang="diff">
diff --git a/src/models/FGFCS.cpp b/src/models/FGFCS.cpp
diff --git a/src/models/FGFCS.cpp b/src/models/FGFCS.cpp
Line 242: Line 243:
diff --git a/src/models/flight_control/FGDummy.h b/src/models/flight_control/FGDummy.h
diff --git a/src/models/flight_control/FGDummy.h b/src/models/flight_control/FGDummy.h
new file mode 100644
new file mode 100644
index 0000000..cc30490
index 0000000..e4b0eeb
--- /dev/null
--- /dev/null
+++ b/src/models/flight_control/FGDummy.h
+++ b/src/models/flight_control/FGDummy.h
@@ -0,0 +1,42 @@
@@ -0,0 +1,32 @@
+#ifndef FGDUMMY_H
+#ifndef FGDUMMY_H
+#define FGDUMMY_H
+#define FGDUMMY_H
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+INCLUDES
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+
+#include <iostream>
+#include <iostream>
Line 262: Line 259:
+
+
+namespace JSBSim {
+namespace JSBSim {
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+
+class FGDummy  : public FGFCSComponent
+class FGDummy  : public FGFCSComponent
Line 279: Line 272:
+  ~FGDummy();
+  ~FGDummy();
+
+
+  /** Executes the distributor logic.
+      @return true - always*/
+  bool Run(void);
+  bool Run(void);
+
+
Line 290: Line 281:


</syntaxhighlight>
</syntaxhighlight>
=== Open Questions ===
=== Open Questions ===
Check the JSBSim docs/website: there's a compact little example called WNS (Waypoint Navigation System), for following/making lateral waypoints. All implemented in JSBSim directly, i.e. can be run/played with standalone. It's in the end of the reference manual, example #5 - just search for "waypoint" or "WNS".
Check the JSBSim docs/website: there's a compact little example called WNS (Waypoint Navigation System), for following/making lateral waypoints. All implemented in JSBSim directly, i.e. can be run/played with standalone. It's in the end of the reference manual, example #5 - just search for "waypoint" or "WNS".

Navigation menu