Commit aa51507a authored by Olivier Lantsoght's avatar Olivier Lantsoght
Browse files

[MBsysPy][MbsDirdyn][Bug] Fix missing fields in options structure.

parent 080337df
# -*- coding: utf-8 -*-
"""
-------------------------------
(c) Universite catholique de Louvain, 2019
Creation : 2019 by O. Lantsoght
Last update : 2019
version MBsysC v1.11.2
-------------------------------
Portable Python interface to MBsysC using Ctypes.
While generating the libraries:
- SENSORKIN MUST BE UNDEFINED
- REALTIME MUST BE UNDEFINED
- PRJ_FCT_PTR MUST BE DEFINED
Declaration of MBsysC structure related to mbs_dirdyn_struct.h file in MBsysC.
"""
"""Declaration of MBsysC structure related to mbs_dirdyn_struct.h file in MBsysC."""
# Author : Robotran Team
# (c) Universite catholique de Louvain, 2021
import ctypes
......@@ -31,15 +13,15 @@ from .forward_decl import MbsBuffer_c
from .forward_decl import MbsGrowingBuffer_c
#==============================================================================
# =============================================================================
# Global parameter of the current module
#==============================================================================
# =============================================================================
__DEBUG__ = False
#==============================================================================
# =============================================================================
# MbsDirdynOptions_c
#==============================================================================
# =============================================================================
MbsDirdynOptions_c._fields_ = [
("t0", ctypes.c_double),
("tf", ctypes.c_double),
......@@ -63,6 +45,9 @@ MbsDirdynOptions_c._fields_ = [
("verbose", ctypes.c_int),
("flag_stop_stiff", ctypes.c_int),
("flag_precise_dynamics", ctypes.c_int),
("flag_baumgarte_stabilization", ctypes.c_int),
("baumgarte_alpha", ctypes.c_double),
("baumgarte_beta", ctypes.c_double),
("flag_waypoint", ctypes.c_int),
("flag_solout_wp", ctypes.c_int),
("delta_t_wp", ctypes.c_double),
......@@ -76,10 +61,10 @@ MbsDirdynOptions_c._fields_ = [
]
#==============================================================================
# =============================================================================
# MbsDirdyn_c
#==============================================================================
MbsDirdyn_c._fields_ =[
# =============================================================================
MbsDirdyn_c._fields_ = [
("options", ctypes.POINTER(MbsDirdynOptions_c)),
("mbs_aux", ctypes.POINTER(MbsAux_c)),
("tsim", ctypes.c_double),
......
......@@ -489,6 +489,15 @@ class MbsDirdyn(object):
of the integrator, but the computation is a little faster.
default is 1
flag_baumgarte_stabilization: int
Flag to use the baumgarte stabilization of the independant accelerations.
default is 0
baumgarte_alpha: float
Alpha parameter of baumgarte stabilization (>0) in 1/s.
default = 0.1
baumgarte_beta: float
Beta parameter of baumgarte stabilization (>0) in 1/s.
default = 0.1
flag_waypoint: int
If set to 1, the integrator will be forced to give a solution at the
specified time interval('delta_t_wp'). If set to 0, the solution
......@@ -663,6 +672,9 @@ class MbsDirdyn(object):
'verbose': {'convert': int, 'c_name': 'verbose'},
'flag_stop_stiff': {'convert': int, 'c_name': 'flag_stop_stiff'},
'flag_precise_dynamics': {'convert': int, 'c_name': 'flag_precise_dynamics'},
'flag_baumgarte_stabilization': {'convert': int, 'c_name': 'flag_baumgarte_stabilization'},
'baumgarte_alpha': {'convert': float, 'c_name': 'baumgarte_alpha'},
'baumgarte_beta': {'convert': float, 'c_name': 'baumgarte_beta'},
'flag_waypoint': {'convert': int, 'c_name': 'flag_waypoint'},
'flag_solout_wp': {'convert': int, 'c_name': 'flag_solout_wp'},
'delta_t_wp': {'convert': float, 'c_name': 'delta_t_wp'},
......@@ -794,6 +806,12 @@ class MbsDirdyn(object):
options.append(self.mbs_dirdyn_ptr.contents.options.contents.flag_stop_stiff)
elif key == "flag_precise_dynamics":
options.append(self.mbs_dirdyn_ptr.contents.options.contents.flag_precise_dynamics)
elif key == "flag_baumgarte_stabilization":
options.append(self.mbs_dirdyn_ptr.contents.options.contents.flag_baumgarte_stabilization)
elif key == "baumgarte_alpha":
options.append(self.mbs_dirdyn_ptr.contents.options.contents.baumgarte_alpha)
elif key == "baumgarte_beta":
options.append(self.mbs_dirdyn_ptr.contents.options.contents.baumgarte_beta)
elif key == "flag_waypoint":
options.append(self.mbs_dirdyn_ptr.contents.options.contents.flag_waypoint)
elif key == "flag_solout_wp":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment