Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
robotran
mbsysc
Commits
e020f452
Commit
e020f452
authored
Sep 10, 2015
by
Nicolas Docquier
Browse files
Merge separate_build on master
parents
07d900a4
6d01b5f6
Changes
22
Hide whitespace changes
Inline
Side-by-side
MBprojects/PendulumSpringC/workR/CMakeLists.txt
View file @
e020f452
...
...
@@ -120,18 +120,10 @@ init_src()
increment_src
(
"
${
PROJECT_SOURCE_DIR
}
/src"
)
increment_src
(
"
${
PROJECT_SOURCE_DIR
}
/../userfctR"
)
increment_src
(
"
${
PROJECT_SOURCE_DIR
}
/../userFiles"
)
increment_src
(
"
${
PROJECT_SOURCE_DIR
}
/../symbolicR"
)
increment_void_symbolic
(
symbolicR
)
increment_src
(
"
${
ROBOTRAN_SOURCE_DIR
}
/mbs_common/mbs_struct"
)
increment_src
(
"
${
ROBOTRAN_SOURCE_DIR
}
/mbs_common/mbs_load_xml"
)
increment_src
(
"
${
ROBOTRAN_SOURCE_DIR
}
/mbs_common/mbs_module"
)
increment_src
(
"
${
ROBOTRAN_SOURCE_DIR
}
/mbs_common/mbs_numerics"
)
increment_src
(
"
${
ROBOTRAN_SOURCE_DIR
}
/mbs_common/mbs_utilities"
)
increment_src
(
"
${
ROBOTRAN_SOURCE_DIR
}
/mbs_common/mbs_realtime"
)
# list include directories (to find headers)
init_include
()
...
...
@@ -139,8 +131,6 @@ init_include()
increment_include
(
"
${
PROJECT_SOURCE_DIR
}
/.."
)
increment_include
(
"
${
ROBOTRAN_SOURCE_DIR
}
"
)
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
# CONFIGURE EXECUTABLE
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
...
...
@@ -154,6 +144,22 @@ set (Executable exe_${PROJECT_NAME})
# generate the executable
add_executable
(
${
Executable
}
${
SOURCE_FILES
}
)
if
(
FLAG_SEPARATE_BUILD
)
#Find MBSysC dynamic libraries
find_package
(
LibRobotranC REQUIRED
)
target_link_libraries
(
${
Executable
}
"
${
LIB_MBSYSC_MODULES
}
"
)
target_link_libraries
(
${
Executable
}
"
${
LIB_MBSYSC_LOAD
}
"
)
else
(
FLAG_SEPARATE_BUILD
)
add_subdirectory
(
"
${
ROBOTRAN_SOURCE_DIR
}
/mbs_common"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/mbs_common"
)
target_link_libraries
(
${
Executable
}
MBsysC_loadXML
)
target_link_libraries
(
${
Executable
}
MBsysC_module
)
if
(
NOT FLAG_SHARED_LIB
)
target_link_libraries
(
${
Executable
}
MBsysC_struct MBsysC_numerics MBsysC_utilities MBsysC_realtime
)
endif
(
NOT FLAG_SHARED_LIB
)
endif
(
FLAG_SEPARATE_BUILD
)
# math external library (for Unix): linkage
if
(
UNIX
)
target_link_libraries
(
${
Executable
}
m
)
...
...
MBsysC/cmake_aux/flags/CMakeLists.txt
View file @
e020f452
...
...
@@ -19,6 +19,14 @@ option (FLAG_PLOT
option
(
FLAG_VISU
"Java visualization"
ON
)
# Compile Robotran MBSysC as shared lib (.so / .dll)
option
(
FLAG_SHARED_LIB
"Compile as dynamic lib"
OFF
)
# Link to MBSysC lib already compiled
option
(
FLAG_SEPARATE_BUILD
"Link to MBSysC lib already compiled"
OFF
)
...
...
MBsysC/conf/FindLibRobotranC.cmake
0 → 100644
View file @
e020f452
#
# author: Timothee Habra
# Sept 7 2015
#
# This file finds the libraries
# related to Robotran MBSysC
#
# ROBOTRAN_C_FOUND : 1 if all required files found (0 otherwise)
# SDL2_INCLUDE_PATH : include paths (for the header files) -> for compilation
# SDL2_LIBRARIES : libraries -> for linkage
#
IF
(
UNIX
)
IF
(
APPLE
)
## ---- MAC OS ---- ##
## ---------------- ##
ELSE
(
APPLE
)
## ---- LINUX ---- ##
# possible paths for: 'libMBsysC_module.so'
SET
(
TRIAL_PATHS_LIB_MBSYSC_MODULES
"
${
ROBOTRAN_SOURCE_DIR
}
/build/mbs_module"
)
# possible paths for: 'libMBsysC_loadXML.so'
SET
(
TRIAL_PATHS_LIB_MBSYSC_LOAD
"
${
ROBOTRAN_SOURCE_DIR
}
/build/mbs_load_xml"
)
FIND_LIBRARY
(
LIB_MBSYSC_MODULES libMBsysC_module.so
${
TRIAL_PATHS_LIB_MBSYSC_MODULES
}
)
FIND_LIBRARY
(
LIB_MBSYSC_LOAD libMBsysC_loadXML.so
${
TRIAL_PATHS_LIB_MBSYSC_LOAD
}
)
#SET(SDL2_LIBRARIES ${SDL2_LIBRARIES_SDL2})
## --------------- ##
ENDIF
(
APPLE
)
ELSE
(
UNIX
)
## ---- WINDOWS ---- ##
ENDIF
(
UNIX
)
# flag put to 1 if all required files are found
IF
(
LIB_MBSYSC_MODULES AND LIB_MBSYSC_LOAD
)
SET
(
ROBOTRAN_C_FOUND 1
)
ELSE
(
LIB_MBSYSC_MODULES AND LIB_MBSYSC_LOAD
)
SET
(
ROBOTRAN_C_FOUND 0
)
ENDIF
(
LIB_MBSYSC_MODULES AND LIB_MBSYSC_LOAD
)
# outputs
MARK_AS_ADVANCED
(
ROBOTRAN_C_FOUND
#SDL2_INCLUDE_PATH
#SDL2_LIBRARIES
)
MBsysC/conf/cmake_config.h.in
View file @
e020f452
...
...
@@ -9,5 +9,3 @@
*/
#define PROJECT_SOURCE_DIR "@PROJECT_SOURCE_DIR@"
#define PROJECT_BINARY_DIR "@PROJECT_BINARY_DIR@"
#define ROBOTRAN_SOURCE_DIR "@ROBOTRAN_SOURCE_DIR@"
#define J3D_PATH "@J3D_PATH@"
MBsysC/mbs_common/CMakeLists.txt
0 → 100644
View file @
e020f452
# Copyright: (C)
# Authors: Timothee Habra
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
cmake_minimum_required
(
VERSION 2.8.7
)
project
(
MBsysC
)
## --------------- ##
# link to useful cmake functions
set
(
CMAKE_AUX
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../cmake_aux"
)
set
(
CMAKE_AUX_BIN
${
PROJECT_BINARY_DIR
}
/cmake_aux
)
set
(
CMAKE_MODULE_PATH
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../conf/"
)
add_subdirectory
(
${
CMAKE_AUX
}
/listing/
${
CMAKE_AUX_BIN
}
/listing/
)
add_subdirectory
(
${
CMAKE_AUX
}
/flags/
${
CMAKE_AUX_BIN
}
/flags/
)
add_subdirectory
(
${
CMAKE_AUX
}
/libraries/
${
CMAKE_AUX_BIN
}
/libraries/
)
definitions
()
flags_check
()
## --------------- ##
if
(
UNIX
)
set
(
CMAKE_C_FLAGS
"-fPIC"
)
set
(
CMAKE_EXE_LINKER_FLAGS
"-fPIC"
)
endif
(
UNIX
)
add_subdirectory
(
mbs_numerics/
${
CMAKE_CURRENT_BINARY_DIR
}
/mbs_numerics/
)
add_subdirectory
(
mbs_struct/
${
CMAKE_CURRENT_BINARY_DIR
}
/mbs_struct/
)
add_subdirectory
(
mbs_utilities/
${
CMAKE_CURRENT_BINARY_DIR
}
/mbs_utilities/
)
add_subdirectory
(
mbs_load_xml/
${
CMAKE_CURRENT_BINARY_DIR
}
/mbs_load_xml/
)
add_subdirectory
(
mbs_module/
${
CMAKE_CURRENT_BINARY_DIR
}
/mbs_module/
)
add_subdirectory
(
mbs_realtime/
${
CMAKE_CURRENT_BINARY_DIR
}
/mbs_realtime/
)
\ No newline at end of file
MBsysC/mbs_common/mbs_load_xml/CMakeLists.txt
0 → 100644
View file @
e020f452
# Copyright: (C)
# Authors: Timothee Habra
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
cmake_minimum_required
(
VERSION 2.8.7
)
project
(
MBsysC_loadXML
)
# Libxml2
xml_lib
()
# list source files to compile
init_src
()
increment_src
(
./
)
# list include directories (to find headers)
init_include
()
set
(
INCLUDE_DIR
${
INCLUDE_DIR
}
"./"
PARENT_SCOPE
)
if
(
FLAG_SHARED_LIB
)
add_library
(
MBsysC_loadXML SHARED
${
SOURCE_FILES
}
${
INCLUDE_DIR
}
)
else
(
FLAG_SHARED_LIB
)
add_library
(
MBsysC_loadXML STATIC
${
SOURCE_FILES
}
${
INCLUDE_DIR
}
)
endif
(
FLAG_SHARED_LIB
)
include_directories
(
"./"
)
include_directories
(
"../mbs_utilities"
)
include_directories
(
"../mbs_struct"
)
MBsysC/mbs_common/mbs_load_xml/mbs_load_xml.c
View file @
e020f452
#include
"mbs_load_xml.h"
#include
"realtime.h"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
...
...
MBsysC/mbs_common/mbs_module/CMakeLists.txt
0 → 100644
View file @
e020f452
# Copyright: (C)
# Authors: Timothee Habra
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
cmake_minimum_required
(
VERSION 2.8.7
)
project
(
MBsysC_module
)
# Libxml2
xml_lib
()
# list source files to compile
init_src
()
increment_src
(
./
)
# list include directories (to find headers)
init_include
()
set
(
INCLUDE_DIR
${
INCLUDE_DIR
}
"./"
PARENT_SCOPE
)
if
(
FLAG_SHARED_LIB
)
add_library
(
MBsysC_module SHARED
${
SOURCE_FILES
}
${
INCLUDE_DIR
}
)
target_link_libraries
(
MBsysC_module MBsysC_struct MBsysC_numerics MBsysC_utilities MBsysC_realtime
)
else
(
FLAG_SHARED_LIB
)
add_library
(
MBsysC_module STATIC
${
SOURCE_FILES
}
${
INCLUDE_DIR
}
)
endif
(
FLAG_SHARED_LIB
)
include_directories
(
../mbs_struct
)
include_directories
(
../mbs_numerics
)
include_directories
(
../mbs_utilities
)
include_directories
(
../mbs_utilities/auto_output
)
include_directories
(
../mbs_realtime/realtime
)
include_directories
(
../mbs_realtime/sdl
)
include_directories
(
../mbs_load_xml
)
#this dependencies should be avoided (needed by equil which needs mds)
MBsysC/mbs_common/mbs_module/mbs_dirdyn.h
View file @
e020f452
/**
* @file mbs_dirdyn.h
*
* This header defines
structure and
functions of the
* This header defines functions of the
* dirdyn module in C.
*
*
...
...
@@ -15,92 +15,8 @@
#ifndef MBS_DIRDYN_h
#define MBS_DIRDYN_h
#include
"mbs_dirdyn_struct.h"
#include
"mbs_data.h"
#include
"mbs_aux.h"
#include
"mbs_buffer.h"
/**
* Structure defining the option of a direct dynamic
*/
typedef
struct
MbsDirdynOptions
{
/// initial time of the simulation, defaut = 0.0
double
t0
;
/// final time of the simulation, defaut = 5.0
double
tf
;
/// initial value of the integration step size, default = 0.001
double
dt0
;
/** Determine whether results are written to files on disk (in resultsR folder):
* 1: results are saved
* 0: results are not saved
*/
int
save2file
;
/* The keyword used for determining the name of result files */
const
char
*
resfilename
;
/** Path in which result file are saved.
* Default: the resultsR folder of the project
*/
const
char
*
respath
;
/* The number of time steps between two buffer records
* values: a int value
* default: 1 (every time step are recorded)
*/
int
saveperiod
;
/* The maximal number of user variables saved
* values: a int value
* default: 12
*/
int
max_save_user
;
/* The number of time step that can be recorded in the buffer. Results are
* written to disk when the buffer is full.
* default: -1: compute the buffer size for saving results only once at the end
*/
int
buffersize
;
int
realtime
;
///< 1 to activate to real-time features, 0 to deactivate them
int
accelred
;
///< 1 to use accelred, 0 otherwise
}
MbsDirdynOptions
;
/**
* General structure of the direct dynamic module
*/
typedef
struct
MbsDirdyn
{
MbsDirdynOptions
*
options
;
///< structure defining the option of a direct dynamic
MbsAux
*
mbs_aux
;
double
tsim
;
///< current simulation time
double
dt
;
///< current integration step size
int
nState
;
// size of the state vector
/** pointers to the state vector */
double
*
y
;
/** pointers to the output vector (???) */
double
*
yout
;
/** pointers to the derivative vector */
double
*
yd
;
MbsBuffer
**
buffers
;
/** growing buffer to store user values */
MbsGrowingBuffer
*
user_buffer
;
int
bufferNb
;
/** pointer to the array that must be saved to buffers */
double
**
savedArrays
;
/** counter for checking wheter results must be saved */
int
savePeriodCounter
;
}
MbsDirdyn
;
/**
...
...
MBsysC/mbs_common/mbs_numerics/CMakeLists.txt
0 → 100644
View file @
e020f452
# Copyright: (C)
# Authors: Timothee Habra
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
cmake_minimum_required
(
VERSION 2.8.7
)
project
(
MBsysC_numerics
)
# list source files to compile
init_src
()
increment_src
(
./
)
# list include directories (to find headers)
init_include
()
set
(
INCLUDE_DIR
${
INCLUDE_DIR
}
"./"
PARENT_SCOPE
)
add_library
(
MBsysC_numerics
${
SOURCE_FILES
}
${
INCLUDE_DIR
}
)
include_directories
(
../mbs_struct
)
include_directories
(
../mbs_utilities
)
MBsysC/mbs_common/mbs_numerics/integrator.h
View file @
e020f452
...
...
@@ -4,9 +4,10 @@
#ifndef __INTEGRATOR_H_INCLUDED__ // guard against multiple/recursive includes
#define __INTEGRATOR_H_INCLUDED__
#include
"MBSfun.h"
#include
"mbs_data.h"
#include
"mbs_aux.h"
#include
"nrutil.h"
#include
"mbs_dirdyn.h"
#include
"mbs_dirdyn
_struct
.h"
void
rk4
(
double
y
[],
double
dydx
[],
int
n
,
double
x
,
double
h
,
double
yout
[],
void
(
*
derivs
)(
double
,
double
[],
double
[],
MbsData
*
,
MbsAux
*
,
MbsDirdynOptions
*
),
...
...
MBsysC/mbs_common/mbs_realtime/CMakeLists.txt
0 → 100644
View file @
e020f452
# Copyright: (C)
# Authors: Timothee Habra
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
cmake_minimum_required
(
VERSION 2.8.7
)
project
(
MBsysC_realtime
)
# list source files to compile
init_src
()
increment_src
(
./realtime
)
# Get SDL lib and add plot functions to src
if
(
FLAG_PLOT
)
# Find SDL
sdl_lib
()
increment_src
(
./sdl
)
# configure a header file to pass some of the CMake settings to the source code
set
(
SDL_FILES
${
CMAKE_CURRENT_SOURCE_DIR
}
/sdl/SDL_files
)
configure_file
(
"./sdl/conf/cmake_sdl_config.h.in"
"
${
PROJECT_BINARY_DIR
}
/conf/cmake_sdl_config.h"
)
include_directories
(
"
${
PROJECT_BINARY_DIR
}
/conf"
)
endif
(
FLAG_PLOT
)
# Get java lib and add java functions to src
if
(
FLAG_VISU
)
# find java and java 3d
java_lib
()
include_directories
(
"./java"
)
increment_src
(
./java
)
set
(
JAR_PATH
${
CMAKE_CURRENT_SOURCE_DIR
}
/../../mbsyspad/MBsysPad.jar
)
configure_file
(
"./java/conf/cmake_java_config.h.in"
"
${
PROJECT_BINARY_DIR
}
/conf/cmake_java_config.h"
)
include_directories
(
"
${
PROJECT_BINARY_DIR
}
/conf"
)
endif
(
FLAG_VISU
)
# list include directories (to find headers)
init_include
()
set
(
INCLUDE_DIR
${
INCLUDE_DIR
}
"./realtime"
PARENT_SCOPE
)
add_library
(
MBsysC_realtime
${
SOURCE_FILES
}
${
INCLUDE_DIR
}
)
include_directories
(
"./"
)
include_directories
(
"../mbs_struct"
)
include_directories
(
"../mbs_utilities"
)
include_directories
(
"./sdl"
"./sdl/auto_plot"
)
include_directories
(
"./realtime"
)
MBsysC/mbs_common/mbs_realtime/java/conf/cmake_java_config.h.in
0 → 100644
View file @
e020f452
/*
* author: Timothee Habra
* date: May 18 2015
*
* Get absolute paths to java and java 3d.
*
* A header file called 'cmake_java_config.h' is then automatically generated in the build directory
*/
#define JAR_PATH "@JAR_PATH@"
#define J3D_PATH "@J3D_PATH@"
MBsysC/mbs_common/mbs_realtime/java/java_functions.c
View file @
e020f452
...
...
@@ -2,7 +2,7 @@
#ifdef JAVA
#include
"java_functions.h"
#include
"cmake_config.h"
#include
"cmake_
java_
config.h"
#include
<stdlib.h>
...
...
@@ -10,7 +10,7 @@
#define JNI_VERSION JNI_VERSION_1_6
// path to the jar file containing mbsyspad bynary code
#define JAR_PATH ROBOTRAN_SOURCE_DIR"/mbsyspad/MBsysPad.jar"
//
#define JAR_PATH ROBOTRAN_SOURCE_DIR"/mbsyspad/MBsysPad.jar"
#define START_VIEWPOINT 0 ///< default initial viewpoint
...
...
MBsysC/mbs_common/mbs_realtime/realtime/realtime.c
View file @
e020f452
...
...
@@ -3,7 +3,7 @@
#include
"realtime.h"
#include
"time_functions.h"
#include
"cmake_config.h"
//
#include "cmake_config.h"
#include
"useful_functions.h"
#include
<stdlib.h>
...
...
MBsysC/mbs_common/mbs_realtime/realtime/realtime_ext.c
View file @
e020f452
...
...
@@ -77,7 +77,7 @@ Realtime_java* init_realtime_java(void *realtime_options, MbsData* mbs_data)
double
t0
;
Realtime_option
*
options
;
Realtime_java
*
java
;
Realtime_java
*
java
;
// variable (pointer) to return
options
=
(
Realtime_option
*
)
realtime_options
;
...
...
MBsysC/mbs_common/mbs_realtime/sdl/conf/cmake_sdl_config.h.in
0 → 100644
View file @
e020f452
/*
* author: Timothee Habra
* date: May 18 2015
*
* Get absolute paths to the SDL image.
*
* A header file called 'cmake_sdl_config.h' is then automatically generated in the build directory
*/
#define SDL_FILES_PATH "@SDL_FILES@"
MBsysC/mbs_common/mbs_realtime/sdl/events_sdl.c
View file @
e020f452
...
...
@@ -2,7 +2,6 @@
#ifdef SDL
#include
"plot_sdl.h"
#include
"visu_past.h"
#include
"realtime.h"
#include
"events_sdl.h"
#include
"mbs_data.h"
...
...
MBsysC/mbs_common/mbs_realtime/sdl/plot_sdl.c
View file @
e020f452
...
...
@@ -8,17 +8,17 @@
#include
"useful_functions.h"
#include
"plot_sdl.h"
#include
"cmake_config.h"
#include
"cmake_
sdl_
config.h"
#include
"time_functions.h"
#include
"events_sdl.h"
#include
"set_plot.h"
#include
"java_functions.h"
//
#include "java_functions.h"
#include
"realtime_functions.h"
#define TIME_NO_INTERACTION_BREAK 3e6 ///< time eith no interaction to go on break mode [us]
#define TIME_SDL_DELAY 25 ///< time delay for SDL
#define SDL_FILES_PATH ROBOTRAN_SOURCE_DIR"/mbs_common/mbs_realtime/sdl/SDL_files"
//
#define SDL_FILES_PATH ROBOTRAN_SOURCE_DIR"/mbs_common/mbs_realtime/sdl/SDL_files"
/*! \brief initialize the Screen_sdl structure
*
...
...
MBsysC/mbs_common/mbs_struct/CMakeLists.txt
0 → 100644
View file @
e020f452
# Copyright: (C)
# Authors: Timothee Habra
# CopyPolicy: Released under the terms of the LGPLv2.1 or later, see LGPL.TXT
cmake_minimum_required
(
VERSION 2.8.7
)
project
(
MBsysC_struct
)
# list source files to compile
init_src
()
increment_src
(
./
)
# list include directories (to find headers)
init_include
()
set
(
INCLUDE_DIR
${
INCLUDE_DIR
}
"./"
PARENT_SCOPE
)
add_library
(
MBsysC_struct
${
SOURCE_FILES
}
${
INCLUDE_DIR
}
)
include_directories
(
"../mbs_utilities/"
)
include_directories
(
"../mbs_numerics/"
)
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment