trick/docs/faq/FAQ.md
2023-04-17 14:28:58 -05:00

8.6 KiB

Home → Frequently Asked Questions (FAQ)

Appendix

  1. What is Trick?
  2. Why should I use Trick?
  3. What operating systems can Trick run on?
    1. Does Trick run on Windows?
    2. Which MacOSX package manager works best with Trick?
  4. What is the current version of Trick?
    1. What are the differences between Trick versions?
  5. Can Trick interact with other applications?
    1. Does Trick work with MATLAB/Simulink?
    2. Does Trick work with Core Flight Software (CFS)?
  6. I found a bug with Trick, how do I tell someone?
  7. I have a question about Trick, where should I ask it?
  8. Why won't my Trick simulation compile?
  9. What units can Trick use?
  10. Do I need internet access to build Trick?
  11. Can I access class protected/private variables?
  12. Are there faster ways to implement events?
  13. Are there input file template limitations?
  14. Is Trick gluten-free, grass-fed, organic, non-GMO, environmentally conservative, free-range, vegan, and dolphin safe?

What is Trick?

Trick is a simulation environment and toolkit that allows users to create complex physics simulations.

Why should I use Trick?

You should use Trick if you want to develop an accurate physics simulation without needing to develop core simulation capabilities manually.

What operating systems can Trick run on?

Trick currently runs on all System V and POSIX compliant UNIX operating systems. MacOSX and most Linux distributions fall under this umbrella.

Does Trick run on Windows?

Trick does not run natively on Windows, however it is possible to run Trick on the Windows 10 Linux Subsystem. Trick will not be ported to Windows until Windows is POSIX compliant, which is highly unlikely.

Which MacOSX package manager works best with Trick?

Homebrew.

What is the current version of Trick?

Trick 19 is the version currently being developed on GitHub. We also maintain a branch for Trick 15 and Trick 17.

What are the differences between Trick versions?

Trick 15 marked the first iteration of an open source Trick Simulation Environment. Trick 17 has several bug fixes, new features, and is currently in active development; it should be used for all new simulation development.

Can Trick interact with other applications?

Trick is capable of interacting with other applications via the variable server; the variable server contains the values of a simulation which can then be sent over TCP/IP to a client application.

MathWorks developed a package to generate Trick friendly code from their models. An introduction video on Trick-MATLAB/Simulink interfacing can be found here.

Core Flight Software (CFS)

cFS support for Trick is provided by the following external projects:

  • TVS-IO is an open-source, Core Flight Software (cFS) application that provides for two-way communication between a cFS Software Bus Network (SBN) and a Trick simulation.

  • Another soon to be released capability, presumably called TrickCFS should also be available soon as open-source software. Stay-tuned.

I found a bug with Trick, how do I tell someone?

Create an issue on GitHub here. The more descriptive you are, the faster we can solve the issue.

SubmitAnIssue

I have a question about Trick, where should I ask it?

Create an issue on GitHub here with "QUESTION: " appended to the title.

AskingAQuestion

Why won't my Trick simulation compile?

There are many reasons why a simulation will fail to compile properly.

  1. Trick can't find your header files or source code.
  2. You haven't properly set your environmental variables.
  3. You haven't properly installed all required dependencies.

What units can Trick use?

Trick is capable of utilizing the vast majority of imperial and metric units. Trick uses the UDUNITS C library/database in its unit calculations. For a list of the most common units, run trick-units in a terminal window after installing Trick.

Do I need internet access to build Trick?

Trick's Java GUIs rely on several 3rd party .jar files which are normally downloaded during the initial compilation of Trick. If you are compiling on a machine without internet access you may copy the directory ${TRICK_HOME}/libexec/trick/java/lib to a machine that does have internet access and run make on that machine.

Can I access class protected/private variables?

If the Trick memory manager and init attribute function is made a friend of a class, we are able to access protected/private variables in the input file through the memory manager.

class A {
  // This class triggers Trick to process protected/private variables
  friend class InputProcessor ;
  // This friend function follows this naming convention "void init_attr ## <class_name>()"
  friend void init_attrA() ;
  private:
    int ii ;
} ;

Input File statements

# Direct access will fail
my_sim_object.a.ii = 1  #fails
var = my_sim_object.a.ii  #fails

# Use the var_set and var_get commands to access protected/private variables
trick.var_set("my_sim_object.a.ii", 1)
var = trick.var_get("my_sim_object.a.ii")

Are there faster ways to implement events?

Trick has a few alternatives to an input file event. Both method execute faster than a regular input processor event, but are not as flexible.

  1. A Just in Time (JIT) input file is C++ code that is compiled and run during simulation execution.
  2. Realtime Injection stages variable assignments and executes them in bulk at the top of a software frame.

Are there input file template limitations?

Trick input files understand a lot about templates, but there is a limitation when using them. Input files cannot access a fixed array of template types directly. There are memory manager calls accessible from the input file that may be used to to read and write arrayed templates.

template < typename T > class A {
  public:
    T t;
} ;

class B {
  public:
    A<double> a[4] ;
} ;

Here is an input file accessing the template type

# direct access to arrayed template class will fail
my_sim_object.b.a[1].t = 1  # fails
var = my_sim_object.b.a[1].t = 2 # fails

# use these memory manager calls instead
trick.var_set("my_sim_object.b.a[1].t", 1)
var = trick.var_get("my_sim_object.b.a[1].t")

Is Trick gluten-free, grass-fed, organic, non-GMO, environmentally conservative, free-range, vegan, and dolphin safe?

Trick is composed entirely of information. It contains no matter, organic or otherwise. Therefore Trick contains no gluten, GMOs, nor is it fed by grass, vegetables, or meat. Trick could be described as environmentally conservative in that it runs on numerous POSIX (Unix-like) operating systems. Trick is of course free-range! It's Opensource!, and freely available to anyone, even dolphins with internet access.