MBsysC
======
The following instruction will give you the information for the specific
software and libraries that you will need to use the C/C++ version of
Robotran. However, we do not detail classic parts like the installation
of a compiler (because it is implicit within any C/C++ project).
Requirements
------------
To work properly (without real-time features), the two following
libraries are required:
- *MBsysC source code*: perform the MBS analyses (See the
`MBsysPad <./MBsysPad.html>`__ part of the tutorial)
- *Libxml2*: read the xml files to load your multibody model (.mbs
file)
- *Lapack*: perform numerical computations for coordinate partitioning
(may be installed already)
If the real-time features are needed, other libraries have to be
installed:
- *SDL 2.0*: display graphs and allow interactions (keyboard,
joystick,…) in real-time
- *Java* or *OpenGL*: display a 3D visualization of the system in
real-time (OpenGL is the defaut choice)
The *Java* visualization was developed earlier but seems to be less
compatible with modern OS (especially *Mac OS* since *Sierra* version).
The supporting CAD files are *VRML* files (*.wrl*).
The *OpenGL* visualization was developed at the end of 2016. The
supporting CAD files are *OBJ* files (*.obj*) and *VRML* files (*.wrl*).
Some new features are introduced in this version like shadow mapping. As
explained
`here `__,
you might have to update your drivers (but it is usually not necessary).
Moreover you will need `Cmake `__ in order to build
and compile your project. This software has to be installed for every
OS.
Since Robotran v1.26.0 and higher, the required minimum standard
compiler norm for MBsysC is ``C++11``. Please contact
``info@robotran.be`` in case of trouble.
.. container:: Linux
For Ubuntu the libraries are provided by the following packages:
- *libxml2-dev* for *Libxml2*;
- *liblapack-dev* for *Lapack*;
- *libsdl2-ttf-dev* for *SDL 2.0* (needed for real-time features
only);
- *libglm-dev*, *libglew-dev* and *libglfw3-dev* for *OpenGL*
(needed for real-time features with OpenGL only).
- *openjdk-8-jdk* (higher version not tested) for *Java* and
*libjava3d-jni* for *Java3D* (needed for real-time features with
Java only);
**Ubuntu 16.04 and later**
You can install the packages with the following commands:
``sudo apt-get install libxml2-dev liblapack-dev`` for the essential
parts of *MBsysC*, ``sudo apt-get install libsdl2-ttf-dev`` if you
need the SDL real-time libraries,
``sudo apt-get install libglm-dev libglew-dev libglfw3-dev`` if you
need the OpenGL 3D visualization and
``sudo apt-get install openjdk-8-jdk libjava3d-jni`` if you need the
Java 3D visualization.
Full installation:
``sudo apt-get install libxml2-dev liblapack-dev libsdl2-ttf-dev libglm-dev libglew-dev libglfw3-dev openjdk-8-jdk libjava3d-jni``
**Ubuntu prior to 16.04**
For previous version (before 16.04), you can install the packages
with the following command:
``sudo apt-get install libxml2-dev liblapack-dev`` for the essential
parts of *MBsysC*, ``sudo apt-get install libsdl2-ttf-dev`` if you
need the SDL real-time libraries,
``sudo apt-get install libglm-dev libglew-dev`` if you need the
OpenGL 3D visualization and
``sudo apt-get install openjdk-7-jdk libjava3d-jni`` if you need the
Java 3D visualization.
For the OpenGL 3D visualization, you also need to install the
*libglfw3-dev* libraries manually (for Ubuntu version before 16.04),
using the following lines:
::
git clone https://github.com/glfw/glfw.git
cd glfw
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON ..
make
sudo make install
..
REMARK:
You can manually install SDL and Java if you do not want to use
the package. Instructions are respectively given in the
*manual_sdl_install.md* and *manual_java_install.md* files located
in the *“MBS path”/MbsFiles/mbsysc/MBsysC/readme_aux* folder.
.. rubric:: Installation of Cmake
:name: installation-of-cmake-1
Install the *cmake* package wich is available in the official ppa.
Use the following command: ``sudo apt-get install cmake``. For you
convenience, you could also install the package *cmake-qt-gui* which
allows you to use a graphical interface instead of command lines:
``sudo apt-get install cmake-qt-gui``.
Compilation of the “User file generation” application and the MBsysC modules
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The **User file generation** application enables to generate
automatically user model files and the header containing element id
(body id, joint id, …). This application is independent of any project
and has to be compiled when installing or updating MBsysC. The
compilation of this application is **mandatory** to use all Robotran
functionality.
The compilation of the **MBsysC modules** will confirm that all
requirements are met. Compiling the modules allows you to enable the
separate build compilation option on project. This option allows you to
avoid compilation of all the source code for each project. This is not
the default behavior.
.. container:: Linux
.. rubric:: Compiling in Terminal
:name: compiling-in-terminal
Open a terminal in the *“MBS path”/MbsFiles/mbsysc/MBsysC* folder and
run the following commands:
::
mkdir build # create a folder named build
cd build # go in build folder
cmake .. # generate a Makefile
make # build the project
Updating
~~~~~~~~
Each version of MBsysC is attached to a version of
`MBsysPad <./MBsysPad.html>`__. Since version 1.6.3, MBsysPad will
detect by itself if it is up to date and ask you to update it when
needed. You will need to recompile the MBsysC modules and the “User file
generation” application at each new version.
Various
-------
How to get and use development version
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The development version of MBsysC is maintained on our `gitlab
website `__. This project is
accessible to everyone.
..
**WARNING:**
The development version is not stable, it could give wrong results.
Moreover the project template (the user files, the *CmakeLists.txt*
…) could be different from the one provided by MBsysPad when you
created your project. This can prevent the project compilation.
To use this version:
1. Download the gitlab project;
2. Extract the downloaded file;
3. Copy the contents of */MBsysC* folder where you want (**do not**
replace the content of *“MBS path”/MbsFiles/mbsysc/MBsysC* folder);
4. Compile the MBsysC modules and the “User file generation”
application;
5. Update the source path, either for all new project or for a specific
project;
6. You can delete the rest of downloaded files.
Updating source path for all new project
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Go to *Tools* and select *Edit preferences*. Check the box “*Specify a
custom MBsysC path*” and put in the text box unlocked the path to your
*MBsysC* folder. The path should stop before ``MBsysC``, it should look
like ``C:/Users/username/Documents/mbsysc`` (for windows, assuming
``MBSysC``\ is here ``C:/Users/username/Documents/mbsysc/MBsysC/``). To
check if your path is correct, copy-paste it the address bar of your
file explorer, you have to see the contents you just copy.
.. figure:: figure/MBsysC_Set_Source.png
:alt: Setting MBsysC source path to a specific MBsysC version
Setting MBsysC source path to a specific MBsysC version
After this operation all new created project will use the version of
*MBsysC* you specified. For older project you will have to update
manually the sources (see hereafter).
Updating source path for a specific project
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can update the sources of a project manually in different ways.
First way, by editing the *CmakeLists.txt* of your project: set the
variable ``TRIAL_PATHS_MBSYSC`` to the path to the development version.
For example:\ ``set(TRIAL_PATHS_MBSYSC /home/user/myfolder/)``. Then
compile you project as usual.
Second way, by the cmake gui interface: set the variable
``ROBOTRAN_SOURCE_DIR`` to the path to your *MBsysC* folder (included in
the path). Then compile you project as usual.
.. container:: Linux
Third way, by the unix terminal: after the command ``cmake ../``, set
the variable to the robotran source directory with the following
command ``cmake . -DROBOTRAN_SOURCE_DIR=/home/user/myfolder``. Then
compile you project as usual.
..
REMARK:
If you delete and then recreate the build folder (or clean it) the
modification of the source is only permanent if the modification has
been done in the *CmakeLists.txt*.
How to modify MBsysC
~~~~~~~~~~~~~~~~~~~~
If you need to adapt *MBsysC* to your project, copy-paste the *“MBS
path”/MbsFiles/mbsysc* folder or the development version to another
location and make your modifications. Then update the path to the
sources for your project.
If your modifications could be useful to multiple users, you can share
them with the community either by `contacting
us `__ or via the `iMMC gitlab
website `__ (you will need
to ask specific access to create a fork for your modifications).
How to use add-on
~~~~~~~~~~~~~~~~~
We have to choose how to handle addons.