Commit ec834984 authored by Nicolas Van der Noot's avatar Nicolas Van der Noot
Browse files

merge master (separate build)

parents d4d4dc8e f11cf130
......@@ -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,23 @@ 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}")
target_link_libraries(${Executable} "${LIB_MBSYSC_UTILITIES}")
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)
......
......@@ -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)
......
#
# 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"
)
# possible paths for: 'libMBsysC_numerics.so'
SET(TRIAL_PATHS_LIB_MBSYSC_UTILITIES
"${ROBOTRAN_SOURCE_DIR}/build/mbs_utilities"
)
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})
FIND_LIBRARY(LIB_MBSYSC_UTILITIES libMBsysC_utilities.so ${TRIAL_PATHS_LIB_MBSYSC_UTILITIES})
#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 AND LIB_MBSYSC_UTILITIES)
SET(ROBOTRAN_C_FOUND 1)
ELSE(LIB_MBSYSC_MODULES AND LIB_MBSYSC_LOAD AND LIB_MBSYSC_UTILITIES)
SET(ROBOTRAN_C_FOUND 0)
ENDIF(LIB_MBSYSC_MODULES AND LIB_MBSYSC_LOAD AND LIB_MBSYSC_UTILITIES)
# outputs
MARK_AS_ADVANCED(
ROBOTRAN_C_FOUND
#SDL2_INCLUDE_PATH
#SDL2_LIBRARIES
)
......@@ -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@"
# 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
# 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")
#include "mbs_load_xml.h"
#include "realtime.h"
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
......
# 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)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result")
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)
/**
* @file mbs_dirdyn.h
*
* This header defines structure and functions of the
* This header defines functions of the
* dirdyn module in C.
*
*
......@@ -15,126 +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"
/**
* Dopri5 structure for dirdyn options
*/
typedef struct DirdynOptDopri5
{
int flag_use; ///< 1 to use dopri5 (adaptive time step), 0 to use runge kutta 4 (fixed time step)
int flag_waypoint; ///< 1 to use waypoints, 0 otherwise
int flag_solout_wp; ///< 1 to call solout only at required waypoints (only if flag_waypoint activated)
int nmax; ///< maximal number of stpes [-]
int verbose; ///< 1 to get print indications related to time adaptive integrator, 0 otherwise
double rtoler; ///< relative error tolerances [-]
double atoler; ///< absolute error tolerances [-]
double dt_max; ///< maximal time step [s]
double delta_t_wp; ///< time interval between two waypoints [s]
} DirdynOptDopri5;
/**
* 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
DirdynOptDopri5 *dopri5; ///< Dopri5 structure for dirdyn options
} MbsDirdynOptions;
/**
* Dopri5 structure for dirdyn
*/
typedef struct DirdynDopri5
{
int flag_save; ///< 1 if first dydt save done, 0 otherwise
double solout_last_t; ///< last time solout was called
double *dydt_save; ///< save dydt of the last time step
} DirdynDopri5;
/**
* 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;
DirdynDopri5 *dopri5; ///< Dopri5 structure for dirdyn
} MbsDirdyn;
/**
* Create a new direct dynamic structure.
......
# 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)
......@@ -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 *, MbsDirdyn *),
......
# 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")
/*
* 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@"
......@@ -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
......
......@@ -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>
......
......@@ -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;
......
/*
* 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@"
......@@ -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"
......
......@@ -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
*
......
# 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/")