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:: Win64
For Windows 64 bits you only need to install Java, only if you want
the real-time features with Java. The other libraries are provided in
the *“MBS path”/MbsFiles/mbsysc/MBsysC/win64_include_lib* folder.
So, if you do not plan to use the 3D visualization, or if you prefer
using the OpenGL 3D visualization tool, you do not have to install
anything (except `Cmake `__ and `Visual
Studio `__, see later).
.. rubric:: Installation of Cmake
:name: installation-of-cmake
Follow this `link `__ to download and
install windows version of Cmake (for now it’s the same installer for
32 and 64 bits).
.. rubric:: Notes about Visual Studio
:name: notes-about-visual-studio
To run your project, you should download `Visual Studio
Community `__ (versions
prior to 2012 will probably not work). Please install Visual and
CMake on the same hard drive.
*Release 2017 and later*
During installation process select at least the tools for *desktop
development with C++* and *Universal Windows Platform development*.
.. figure:: figure/MBsysC_VSC_Install.png
:alt: Select the component during installation
Required component of Visual Studio community
*Release prior to 2017*
During installation process select at least the tools for *desktop
development with C++* and the *Universal Windows Platform Tools*. You
can change your installation thanks to the “Visual Studio Installer”
which should be on your computer.
*All versions of Visual Studio Community*
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:: Win64
.. rubric:: Compiling with the CMake Gui interface
:name: compiling-with-the-cmake-gui-interface-1
To use the CMake Gui interface, you first need to run the
corresponding application (look for *CMake* in your applications).
Then, click on *Browse Source…* and select the *“MBS
path”/MbsFiles/mbsysc/MBsysC* folder. Click on *Browse Build…* and
select the *“MBS path”/MbsFiles/mbsysc/MBsysC/build* (create it if
needed).
Click on the *Configure* button and select the type of generator
(IDE…) you want to use. Pay attention to use a 64 bit configuration.
The configuration panel will appear. **Red does not mean that
something went wrong**. Check the lines below the *Configure* button
to check if all libraries were found. Otherwise, look at the
*Installation tutorial*. *Symbolic … not found, linking to void
function* is not an error, it means that this function was not
generated because you do not use it in your project.
click on the *Generate* button. Your project will be created inside
the *build* folder you specified. In this folder, you can click on
the project to launch it (*MBsysC_ALL.sln* as a `Visual
Studio `__ project for example).
Then choose *Debug* or *Release* on the top of the VS window and
finally build the project (*Ctrl+B*). You should get 8 successful
generated solutions and 1 ignored.
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.
..
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.
.. container:: Win64
.. rubric:: Installation of Java (not mandatory)
:name: installation-of-java-not-mandatory
Download *Java SE Development Kit (JDK)* and install it (versions 7
and 8 have been tested). For instance, use this
`link `__
and download the file corresponding to *Windows x64*.
Download and install *Java 3D*. For instance, use this
`link `__
and download the lastest revision of *Java 3D*.
..
REMARK:
*j3dcore-ogl.dll* should usually be installed in *C:/Program
Files/Java/jdk1.7.0_xx/jre/bin*. If it is not the case, you have
to find it and move it into the *C:/Program
Files/Java/jdk1.7.0_xx/jre/bin* folder (or similar).
You must modify the environment variable called Path to add the
location of the *jvm.dll* file (usually in ‘*C:/Program
Files/Java/jdk1.7.0_xx/jre/bin/server*’). Locate this file
(*jvm.dll*) and copy its location. This is the path to access the
*jvm.dll* file. You must add it to the *Path environment variable*.
Here is the procedure:
1. Go to *Control Panel/All Control Panels/Systems* and click on
Modify Settings.
2. In *Advanced System Settings*, click on *Environment Variables*
3. In *System Variables*, click on the *Path* variable, then
*Modify*.
4. At the end of the second field, put a ‘;’ and paste the location
of your *jvm.dll* file. **Pay attention not to add any extra
space, otherwise, it will not work!**
This procedure could differ in function of your windows version.
REMARK for advanced user:
*MBsysC* could perhaps works with newer version of *Java* modules.
If you have others versions, you can try to use them by manually
modifying the files ``FindJ3D.cmake`` and ``FindJNI.cmake``
located in the folder *“MBS path”/MbsFiles/mbsysc/MBsysC/conf*.
The modifications consist in locating the path of each file
mentioned in the Windows section and to add it to the
*TRIAL_PATH_…*. Pay attention that before a space in the path you
have to add an backslash character.