Trick Simulation Environment. Trick provides a common set of simulation capabilities and utilities to build simulations automatically.
Go to file
Keith Vetter f2e93ac490
Fix for assigning to non-existent variables (#1708) (#1718)
* Fix for assigning to non-existent variables (#1708)

This fix modifies Trick's convert_swig script.  It
adds a directive to not accept dynamic attributes.
The directive will ensure that modelers do not
assign to non-existent parameter in their input files.

The prior fix (issues #1288 and/or #1603) did not
cover C structures, so this commit is really an
addendum to that fix.  With this commit, the convert_swig
script will generate a non-dynamic directive foreach
class and structure.

This fix also stops generating swig interface code
for typedef structure definitions since swig only
produces an interface to the actual typedef name.
For example, with this typedef:

typedef struct StructureName {
   double  main_engine_thrust;  /* N Thrust of main engine */
   struct StructureName* next;  /* ** Next pointer */
} TypeDefName;

swig creates an interface for "TypeDefName", and not
"StructureName", so there is no need for Trick to
produce anything in regards "StructureName".

* Fix for issue with classes defined in ifndef SWIG block

convert_swig takes in the raw header and does no preprocessing,
so blocks of c/c++ header code which are meant to be skipped
by Swig are processed by convert_swig.  This causes an issue
with the generated python code that try to access classes
that are ifndef SWIGed out.

To fix this, check for class existence in the generated python
code e.g:

if 'MomMom' in globals():
    MomMom.__setattr__ = _swig_setattr_nondynamic_instance_variable(object.__setattr__)

* Fix for assignment to swig_double and swig_int primitives

The previous commit(s) on this branch fixed bad assignments
like (misspell position an attribute of BSTATE_IN):
ball.state.input.positiaaaan = 4.0

This commit fixes bad assignments to leaf/primitive attributes
like (try to add attribute to primitive/leaf double type):

ball.state.input.position.fred = 4.0

* Moved _swig_setattr_nondynamic_instance_variable to right after each class in process_class and removed duplicate _swig_setattr_nondynamic_instance_variable blocks for classes that are not in a namespace.

* Add the call for __setattr__ for class templates.

---------

Co-authored-by: Hong Chen <hong.chen-1@nasa.gov>
2024-07-16 10:34:02 -05:00
.github/workflows Clean up 2024-07-10 15:15:10 -05:00
autoconf Update configure script to check for swig >= 3 (#1554) 2023-08-28 13:55:17 -05:00
bin Improve tutorial documentation (#1408) 2022-12-02 14:55:40 -06:00
CMakeModules Fix args to FIND_PACKAGE_HANDLE_STANDARD_ARGS in FindMaven.cmake and FindTee.cmake closes #980 2020-04-06 14:03:47 -05:00
CMakeTestFiles Incorporate llvm 18 changes. (#1685) 2024-04-02 13:37:00 -05:00
docs Repurposed -OO for all sim run outputs including S_sie.resource being saved in the specified directory. (#1714) 2024-07-16 10:31:52 -05:00
doxygen Generate Doxygen files for Trick headers 2017-03-20 10:57:34 -05:00
include/trick Updated not to always pass disown flag for swig pointer conversion instead base on "own" value of the input object. (#1690) 2024-05-23 10:37:27 -05:00
libexec/trick Fix for assigning to non-existent variables (#1708) (#1718) 2024-07-16 10:34:02 -05:00
share Revert changes to trickops test yml file from Sept 2023 to fix trickops unit tests (#1681) 2024-04-01 09:43:12 -05:00
test Updated not to always pass disown flag for swig pointer conversion instead base on "own" value of the input object. (#1690) 2024-05-23 10:37:27 -05:00
trick_sims Water Clock Cleanup (#1711) 2024-05-23 10:30:56 -05:00
trick_source Fix for assigning to non-existent variables (#1708) (#1718) 2024-07-16 10:34:02 -05:00
.gitattributes 1232 1236 ac lib check and linguist (#1237) 2022-02-28 16:02:07 -06:00
.gitignore Add per-session variable server logs 2023-06-26 12:23:58 -05:00
CMakeLists.txt update version numbers to prerelease 19.8.0-beta 2023-12-18 14:25:50 -06:00
configure Update configure script to check for swig >= 3 (#1554) 2023-08-28 13:55:17 -05:00
LICENSE Adding license. 2015-02-25 08:47:59 -06:00
Makefile Change 32 bit pipeline to only build part of the test suite (#1536) 2023-07-17 11:34:54 -05:00
README.md Update README.md 2023-09-29 13:08:35 -05:00
test_overrides.mk Change 32 bit pipeline to only build part of the test suite (#1536) 2023-07-17 11:34:54 -05:00
test_sims32.yml Change 32 bit pipeline to only build part of the test suite (#1536) 2023-07-17 11:34:54 -05:00
test_sims.yml Repurposed -OO for all sim run outputs including S_sie.resource being saved in the specified directory. (#1714) 2024-07-16 10:31:52 -05:00
TrickLogo_darkmode.png Make trick logo look better in dark mode 2022-10-13 16:25:30 -05:00
TrickLogo.png Renamed trick logo file. 2017-10-05 14:54:39 -05:00
trickops.py Change 32 bit pipeline to only build part of the test suite (#1536) 2023-07-17 11:34:54 -05:00
trigger iss #1009 (#1040) 2020-08-28 14:52:23 -05:00

Trick logo

Linux macOS 32-bit Coverage Status

The Trick Simulation Environment, developed at the NASA Johnson Space Center, is a powerful simulation development framework that enables users to build applications for all phases of space vehicle development. Trick expedites the creation of simulations for early vehicle design, performance evaluation, flight software development, flight vehicle dynamic load analysis, and virtual/hardware in the loop training. Trick's purpose is to provide a common set of simulation capabilities that allow users to concentrate on their domain specific models, rather than simulation-specific functions like job ordering, input file processing, or data recording.

Install Guide Tutorial Documentation
Follow the installation guide to properly configure Trick on your operating system. Complete the tutorial to become familiar with the basics. Visit the documentation for a more complete understanding of Trick.
Related Projects Frequently Asked Questions How-To Guides
View some of the many projects that use Trick. Read some of the most frequently asked questions pertaining to Trick. See a collection of how-to guides detailing common Trick processes.
Developer Docs
Read detailed documentation for various Trick internals and processes.

Trick is released under the NASA Open Source Agreement Version 1.3 license.