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).

WARNING: MBsysPy is only compatible with 64 bits!

Requirements

To work properly (without real-time features), the two following libraries are required:

  • MBsysC source code: perform the MBS analyses (See the MBsysPad 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.

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).

Installation of Cmake

Follow this link to download and install windows version of Cmake. Since Robotran v1.26.0, Cmake minimum version is 3.11.

Notes about Visual Studio

To run your project, you could 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.

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.

Compiling with developer power shell

Open a terminal Developper Command Prompt for VS XXX 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 .. -DCMAKE_INSTALL_PREFIX="../install"       # generate a Makefile
cmake --build . --target INSTALL --config Release  # build the project (Choose Release of Debug)

Compiling with the CMake Gui interface

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).

WARNING:

Since v1.25.X and higher, you need to add the path for installing the project. Click on + Add Entry -> Name=CMAKE_INSTALL_PREFIX, Type=PATH, value=../install. This will ensure the mbsysc modules are installed in the right folder. If this path is already present, just check that the path is correct. If not, change it to “../install”.

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 build the project (Ctrl+B). You should get 4 successful generated solutions and 0 ignored.

Finally, install everything by right clicking on the solution “INSTALL” under the Solution Explorer then (re)regenerate this solution. This should put everything in the mbsysc/MBsysC/install/ folder, as required.

Updating

Each version of MBsysC is attached to a version of MBsysPad. 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 MBSysCis 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.

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 CMAKE_PREFIX_PATH to the path to the development version. For example:set(CMAKE_PREFIX_PATH /home/user/my_mbsysc_folder/install). Then compile you project as usual. This way is not recommended.

Second way, by the cmake gui interface: set the variable CMAKE_PREFIX_PATH to the path to your MBsysC/install 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.

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.