Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


There are many types of built-in Commands used in spacecraft missions. New Commands can be created to extend GMAT to perform a new task. This document will describe a general procedure to add a new Command to the baseline GMAT code. If you would prefer to add your new Command as a plugin, please see instead the document "Building a GMAT Plug-in: A Walkthrough Using Visual Studio 2010.".


All configurable Command types must be derived from GmatCommand.The GmatCommand class is derived from the base GMAT class, GmatBase. There Often there are often intermediate classes as well, to that encapsulate common data and methods for the Command type. For example, there is a PlotCommand class, which derives derived from GmatCommand, and from which ClearPlot, MarkPoint, PenDown, and PenUp Commands are derived. Data and method implementations that are common to all of these subclasses are placed in the PlotCommand class, and only those that need specific modifications are added or overridden in the subclasses. Only leaf Commands can be created and used in the GMAT mission sequence.

Most Commands have one or more associated Resources and options. Though not shown in the above diagram, the associated Resource type of the PlotCommand is the Subscriber/XYPlot, and there are no command options. The example Sample script syntax of one of the PlotCommand leaf classes is

Code Block
ClearPlot DefaultXYPlot; 

A more complicated command is the Propagate command, shown below.

Code Block
Propagate DefaultProp(DefaultSC) {DefaultSC.ElapsedSecs = 12000.0}; 

The associated Resource type for this command is the a Propagator type named "DefaultProp" and the a Spacecraft type named "DefaultSC." The command option in this example is "DefaultSC.ElapsedSecs = 12000.0." This script tells the Propagate command to propagate the Spacecraft object "DefaultSC" for 12000 seconds using the Propagator object "DefaultProp."


The associated Resource type is an object of the ImpulsiveBurn type named "DefaultIB" and the a Spacecraft type named "DefaultSC." This script snippet tells the Maneuver Command to apply a maneuver to the Spacecraft object "DefaultSC" using the ImpulsiveBurn object "DefaultIB."

Commands in GMAT are executed in order, whether created via script or GUI, when running a mission. When a Command is created via the GUI, it is set to use its default Resource and options(s) and option(s). When a Command is created via script, the associated Resource must be created before the Commands are created, otherwise errors will occur during script parsing. 

GMAT uses a late binding scheme to provide interconnection between Resource objects and Commands. Therefore, Commands store names of associated Resource objects during script parsing. Actual object instances are connected before the execution of Commands when the Sandbox is initialized. See the "GMAT Architectural Specification" document for more details on GMAT's late binding scheme.

Required First Steps