Read me first !
There are three possibilities to use this simulator:
- Simulink (C)
- Standalone (C/C++)
No compilation is required for this version. This version is compatible with any computer, provided Matlab is installed (release R2007a or later). This version allows fast code prototyping and debugging thanks to Matlab environment. However, this version is the slowest one.
Simulink version (C/C++)
This version uses Simulink to compile a C project. So, it is still possible to use some modules coming from Matlab.
C files must be compiled with a Mex compiler. Thanks to the C code, this version is much faster than the Matlab one (there might be a factor 100 for the execution time). This version can also be extended with C++ code.
Provided Matlab and a Mex compiler are installed, this version can run on the three OS (Linux, Mac OS and Windows), both for the 32-bit and the 64-bit versions. For more information, consult the README.md located in the workR/Simulink folder.
Standalone version (C/C++)
This version is a standalone one in the sense that it does not require Matlab nor Simulink to run. It can be seen as a C function running without resorting to other programs. Nevertheless, some libraries (like SDL) are used to add new features. The most important one is its ability to run the simulation in real-time, while allowing the user to interact with it and analyzing results on graphs plotted in real-time.
This version only uses C files but can be extended with C++ code. It uses CMake to generate projects on any of the three OS (Linux, Mac OS and Windows) with different IDEs (Visual Studio, Code::Blocks, XCode...) or with Makefiles projects. Nevertheless, this version requires using a 64-bit OS and may have some problems with the real-time visualization on Mac OS. Therefore, we advise to use this version with Linux or Windows 64-bit.
This version requires to compile the project, but is the fastest one (slightly faster than the Simulink version because there is no link with Simulink-Matlab). For more information, consult the README.md located in the StandaloneC folder.
Project specific features
- Basic version: COMAN with 23 actuated DOFs (+ 6 DOFs for the floating base) and initial rounded rigid feet
- Short feet: Basic version where the initial rounded rigid feet are replaced by shorter (14 cm long instead of 19 cm) rectangular rigid feet
- Compliant feet: Basic version where the rigid feet are replaced by comliant feet made of two rigid plates connected by a spring
- Long arms: Short feet version, with long arms ans hands
- SkyWalker: Basic version, but the COMAN is hung, so that it does not walk on the ground but in the sky...
Some of these versions have two sub-models:
- 2D walking: waist of the COMAN is constrained to stay in the world sagittal plane (3 DOFs of the waist are constrained to 0: lateral motion, roll and yaw)
- 3D walking: COMAN is totally free (6 DOFs for the waist)
All these versions are stored in StandaloneC/src/other/CoMan_versions. These are the files stored in this folder:
- .mbs file : the xml model description
- symbolic files : the routines generated by Robotran
Consequently, this Git version does not save these files outside the CoMan_versions folder. To get them back, you must copy-paste them to their correct location, or run CMake. For the Simulink version, you must also modify the flags at the beginning of the matlab file ' compile_c_files.m ', located in workR/Simulink.
The current state of the controller allows position or torque tracking for all the joints. The references are updated in the get_ref.c file. For instance, torque references need to be updated in ovs->Qq_ref[i] and are activated with this line: ovs->imp_ctrl_index[i] = QQ_REF_TRACKING;. The joint index i depends on a list presented int the controller_def.h file.
Positions and torques low-level controller is implemented in the impedance_controller.c file. While its purpose is to reproduce the low-level controller on the real COMAN, the gains and rules are not exactly the same. Consequently, this file could be improved. At the end, the voltage uvs->Voltage[i] sent to each motor i is computed and converted in a controller reference called uvs->Control[i] (with torque units) in the controller_outputs.c file.
Joints models are then integrated (with uvs->Control[i]) in the user_Derivative.c file, producing joint torques in the user_JointForces.c file. The joint torques MBSdata->Qq[i] are the ones Robotran is using to compute the dynamical equations. Their indexes i are not the same as the ones of ovs->imp_ctrl_index[i]': they correspond to the list available in the simu_def.h file.
The files in the controller_files folder do not have access to all the data from Robotran. This is done on purpose, so that the controller only has inputs available on the real COMAN. Then, transferring the controller to the real hardware is straightforward. These inputs are defined in the controller_inputs.c file.