ChronoPyEngine:Introduction

From ChronoWiki

Jump to: navigation, search

File:Carousel_chronopyengine.jpg

Contents


This is an introduction on how to use Chrono::PyEngine, that is Chrono::Engine for Python.

The Chrono::PyEngine Python module is an alternative way of creating applications based on Chrono::Engine that does not require any C++ programming. In fact, once you installed the Chrono::Engine Python module in your Python environment, you will be able to use the easy Python scripting language to call a big part of the Chrono::Engine API functions, classes, methods, etc.

Advantages of Python programming vs. C++ programming:

  • Python is simple,
  • Python can be interpreted on the fly,
  • there are lot of third party modules for Python, for instance Matplotlib for plotting, Numpy for algebra, etc.,
  • a minimal installation is required.

Disadvantages of Python programming vs. C++ programming:

  • Python is slower than C++,
  • the Chrono::Engine Python module does not cover all the features of the C++ API.


Installation

There are two options:

  • For users that do not want to install the entire Chrono::Engine API there is a precompiled installer. Do this:
    • install Python (only Python version 3.2 or greater, for 32 bit, is supported)
    • install the Chrono::PyEngine module for Python, using the installer.
  • For advanced users that use the entire Chrono::Engine C++ API, they should

We suggest you to use a specialized IDE editor that nicely handles the Python language (syntax highlighting, auto completion of text, etc.). The default IDE installed with most Python distribution is IDLE: it is nice but we suggest a suggest to install a more powerful editor: PyScripter, that is free.

We suggest to install also the following third party packages for expanding the capabilities of Python in mathematical ad plotting areas:

NOTE. At the date of writing, official precompiled binaries of Numpy and Matplotlib for Python 3.2 are not yet available, but you can download them from the unofficial repository: [1]. Otherwise there is a custom Python distribution called Enthough that already includes the two packages.

How to write programs

You can read about Chrono::PyEngine usage, its syntax, its differences respect to the C++ API, etc., at the Documentation page.

Demos and examples

You can find examples of use in these tutorials.

Personal tools