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 -*- # -*- coding: utf-8 -*-
""" """Declaration of MBsysC structure related to mbs_dirdyn_struct.h file in MBsysC."""
------------------------------- # Author : Robotran Team
(c) Universite catholique de Louvain, 2019 # (c) Universite catholique de Louvain, 2021
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.
"""
import ctypes import ctypes
...@@ -31,15 +13,15 @@ from .forward_decl import MbsBuffer_c ...@@ -31,15 +13,15 @@ from .forward_decl import MbsBuffer_c
from .forward_decl import MbsGrowingBuffer_c from .forward_decl import MbsGrowingBuffer_c
#============================================================================== # =============================================================================
# Global parameter of the current module # Global parameter of the current module
#============================================================================== # =============================================================================
__DEBUG__ = False __DEBUG__ = False
#============================================================================== # =============================================================================
# MbsDirdynOptions_c # MbsDirdynOptions_c
#============================================================================== # =============================================================================
MbsDirdynOptions_c._fields_ = [ MbsDirdynOptions_c._fields_ = [
("t0", ctypes.c_double), ("t0", ctypes.c_double),
("tf", ctypes.c_double), ("tf", ctypes.c_double),
...@@ -57,12 +39,15 @@ MbsDirdynOptions_c._fields_ = [ ...@@ -57,12 +39,15 @@ MbsDirdynOptions_c._fields_ = [
("realtime", ctypes.c_int), ("realtime", ctypes.c_int),
("accelred", ctypes.c_int), ("accelred", ctypes.c_int),
("flag_compute_Qc", ctypes.c_int), ("flag_compute_Qc", ctypes.c_int),
("compute_all_uxd", ctypes.c_int), ("compute_all_uxd", ctypes.c_int),
("compute_Qc", ctypes.POINTER(ctypes.c_int)), ("compute_Qc", ctypes.POINTER(ctypes.c_int)),
("integrator", ctypes.c_int), ("integrator", ctypes.c_int),
("verbose", ctypes.c_int), ("verbose", ctypes.c_int),
("flag_stop_stiff", ctypes.c_int), ("flag_stop_stiff", ctypes.c_int),
("flag_precise_dynamics", 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_waypoint", ctypes.c_int),
("flag_solout_wp", ctypes.c_int), ("flag_solout_wp", ctypes.c_int),
("delta_t_wp", ctypes.c_double), ("delta_t_wp", ctypes.c_double),
...@@ -73,13 +58,13 @@ MbsDirdynOptions_c._fields_ = [ ...@@ -73,13 +58,13 @@ MbsDirdynOptions_c._fields_ = [
("dt_max", ctypes.c_double), ("dt_max", ctypes.c_double),
("n_freeze", ctypes.c_int), ("n_freeze", ctypes.c_int),
("show_failed_closure", ctypes.c_int), ("show_failed_closure", ctypes.c_int),
] ]
#============================================================================== # =============================================================================
# MbsDirdyn_c # MbsDirdyn_c
#============================================================================== # =============================================================================
MbsDirdyn_c._fields_ =[ MbsDirdyn_c._fields_ = [
("options", ctypes.POINTER(MbsDirdynOptions_c)), ("options", ctypes.POINTER(MbsDirdynOptions_c)),
("mbs_aux", ctypes.POINTER(MbsAux_c)), ("mbs_aux", ctypes.POINTER(MbsAux_c)),
("tsim", ctypes.c_double), ("tsim", ctypes.c_double),
......
...@@ -489,6 +489,15 @@ class MbsDirdyn(object): ...@@ -489,6 +489,15 @@ class MbsDirdyn(object):
of the integrator, but the computation is a little faster. of the integrator, but the computation is a little faster.
default is 1 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 flag_waypoint: int
If set to 1, the integrator will be forced to give a solution at the 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 specified time interval('delta_t_wp'). If set to 0, the solution
...@@ -663,6 +672,9 @@ class MbsDirdyn(object): ...@@ -663,6 +672,9 @@ class MbsDirdyn(object):
'verbose': {'convert': int, 'c_name': 'verbose'}, 'verbose': {'convert': int, 'c_name': 'verbose'},
'flag_stop_stiff': {'convert': int, 'c_name': 'flag_stop_stiff'}, 'flag_stop_stiff': {'convert': int, 'c_name': 'flag_stop_stiff'},
'flag_precise_dynamics': {'convert': int, 'c_name': 'flag_precise_dynamics'}, '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_waypoint': {'convert': int, 'c_name': 'flag_waypoint'},
'flag_solout_wp': {'convert': int, 'c_name': 'flag_solout_wp'}, 'flag_solout_wp': {'convert': int, 'c_name': 'flag_solout_wp'},
'delta_t_wp': {'convert': float, 'c_name': 'delta_t_wp'}, 'delta_t_wp': {'convert': float, 'c_name': 'delta_t_wp'},
...@@ -794,6 +806,12 @@ class MbsDirdyn(object): ...@@ -794,6 +806,12 @@ class MbsDirdyn(object):
options.append(self.mbs_dirdyn_ptr.contents.options.contents.flag_stop_stiff) options.append(self.mbs_dirdyn_ptr.contents.options.contents.flag_stop_stiff)
elif key == "flag_precise_dynamics": elif key == "flag_precise_dynamics":
options.append(self.mbs_dirdyn_ptr.contents.options.contents.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": elif key == "flag_waypoint":
options.append(self.mbs_dirdyn_ptr.contents.options.contents.flag_waypoint) options.append(self.mbs_dirdyn_ptr.contents.options.contents.flag_waypoint)
elif key == "flag_solout_wp": 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