Examples#
While the majority of the kdFlex software is written in
C++, Python bindings for the C++ classes are available as Python
extensions.
Example Python scripts, named notebook.py, are availabe within each of the
subfolders within /usr/share/Karana/Tutorials in your local
installation. These scripts illustrate the use of the kdFlex Python extenson and can be run from within each of these folders by
running python3 notebook.py.
There are also Jupyter notebook versions of each of the tutorials, named notebook.ipynb within the same folder. The introduction video shows how to run these notebooks from a remote machine, from a local machine, and as a normal Python script.
This section contains tutorial examples on using kdFlex. The Python examples are included here, while the C++ examples are included inline in the C++ documentation area. (TODO - add link).
Python Tutorial Notebooks#
The following Jupyter notebooks (located under
/usr/share/Karana/Tutorials) contain tutorial examples of using
kdFlex.
Jupyter notebook |
Folder |
Description/License tier |
Video walkthrough |
|---|---|---|---|
example_urdf |
Illustrates importing a Barrett WAM robot arm multibody model from a URDF file |
||
example_m2020 |
Illustrates importing a Mars 2020 rover model from a URDF file |
||
example_2_link_pendulum |
Illustrates the step by step creation of the bodies for a 2-link pendulum, and setting up a time domain simulation for it. |
||
example_n_link_pendulum |
Illustrates the procedural creation of an n-link pendulum and a time domain simulation for it. |
||
example_spice_frames |
Illustrates use of the frames layer with planetary body frames |
||
example_import_export |
Illustrates importing and exporting multibody models files in various formats; also, the use of units and quantitiies. |
||
example_visualization |
Illustrates the capabilities of the 3D graphics layer. |
||
example_data_logging |
Illustrates basic data logging capabilities. |
||
Jacobians and Inverse kinematics (coming soon) |
- |
Illustrates creation of inertial and relative Jacobians for single and multiple nodes; general constraint and inverse kinematics |
|
example_slider_crank |
Illustrates creating a slide-crank system with loop constraints and graph topology. |
||
example_double_wishbone |
Illustrates creating a double-wishbone system with loop constraints and graph topology. |
||
example_pendulum_collision |
Illustrates collistion dynamics with a 2-link pendulum example. |
||
example_procedural_collision |
Illustrates collistion dynamics with a multi-link pendulum example. |
||
Zero-crossing detection: (coming soon) |
- |
Illustrates zero-crossing detection with a pendulum collision problem |
|
Flexible body dynamics: (coming soon) |
- |
Illustrates creation of a 2-link flexible body pendulum |
|
Algorithms showcase: (coming soon) |
- |
Illustrates various system level algorithmic methods for the mass matrix, system inertias etc |
|
example_flexible_slider_crank |
Illustrates a slider-crank with a flexible body. This is a system that has both flexible bodies and closed loops. |
||
example_flexible_double_wishbone |
Illustrates a double-wishbone with a flexible body. This is a system that has both flexible bodies and closed loops. |
||
example_rigid_timing |
Verify O(N) performance of SOA dynamics by measuring computational time with varying number of bodies. |
||
example_fully_augmented_benchmark |
Compare O(N) performance of SOA dynamics with O(N^3) perforamnce of conventional full-augmented (FA) dynamics. |
Each notebook has a cooresponding notebook.py, which is a regular Python script.