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
69ff33da
Commit
69ff33da
authored
Nov 18, 2020
by
Olivier Lantsoght
Browse files
[MbsModal][NewError] Added for MBsysPy, leaks checked.
parent
17c50eae
Changes
4
Hide whitespace changes
Inline
Side-by-side
MBsysC/mbs_interface/MBsysPy/_mbsysc_loader/mbs_functions_c.py
View file @
69ff33da
...
...
@@ -137,7 +137,7 @@ libmodules.mbs_delete_sensor.restype = None
libmodules
.
mbs_new_part
.
argtypes
=
[
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_new_part
.
restype
=
ctypes
.
POINTER
(
MbsPart_c
)
libmodules
.
mbs_run_part
.
argtypes
=
[
ctypes
.
POINTER
(
MbsPart_c
),
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_run_part
.
argtypes
=
[
ctypes
.
POINTER
(
MbsPart_c
),
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_run_part
.
restype
=
ctypes
.
c_int
libmodules
.
mbs_delete_part
.
argtypes
=
[
ctypes
.
POINTER
(
MbsPart_c
)]
...
...
@@ -190,10 +190,6 @@ libmodules.mbs_equil_add_variable.argtypes = [ctypes.POINTER(MbsEquilOptions_c),
libmodules
.
mbs_equil_add_variable
.
restypes
=
None
libmodules
.
mbs_new_modal
.
argtypes
=
[
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_new_modal
.
restype
=
ctypes
.
POINTER
(
MbsModal_c
)
libmodules
.
mbs_new_invdyn
.
argtypes
=
[
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_new_invdyn
.
restype
=
ctypes
.
POINTER
(
MbsInvdyn_c
)
...
...
@@ -231,6 +227,7 @@ libmodules.mbs_solvekin_loop.restype = None
libmodules
.
mbs_solvekin_finish
.
argtypes
=
[
ctypes
.
POINTER
(
MbsSolvekin_c
),
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_solvekin_finish
.
restype
=
None
libmodules
.
mbs_new_modal
.
argtypes
=
[
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_new_modal
.
restype
=
ctypes
.
POINTER
(
MbsModal_c
)
...
...
@@ -238,13 +235,13 @@ libmodules.mbs_delete_modal.argtypes = [ctypes.POINTER(MbsModal_c), ctypes.POINT
libmodules
.
mbs_delete_modal
.
restype
=
None
libmodules
.
mbs_run_modal
.
argtypes
=
[
ctypes
.
POINTER
(
MbsModal_c
),
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_run_modal
.
restype
=
None
libmodules
.
mbs_run_modal
.
restype
=
ctypes
.
c_int
libmodules
.
mbs_modal_init
.
argtypes
=
[
ctypes
.
POINTER
(
MbsModal_c
),
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_modal_init
.
restype
=
None
libmodules
.
mbs_modal_init
.
restype
=
ctypes
.
c_int
libmodules
.
mbs_modal_loop
.
argtypes
=
[
ctypes
.
POINTER
(
MbsModal_c
),
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_modal_loop
.
restype
=
None
libmodules
.
mbs_modal_loop
.
restype
=
ctypes
.
c_int
libmodules
.
mbs_modal_finish
.
argtypes
=
[
ctypes
.
POINTER
(
MbsModal_c
),
ctypes
.
POINTER
(
MbsData_c
)]
libmodules
.
mbs_modal_finish
.
restype
=
None
libmodules
.
mbs_modal_finish
.
restype
=
ctypes
.
c_int
MBsysC/mbs_interface/MBsysPy/mbsyspy/mbs_modal.py
View file @
69ff33da
# -*- coding: utf-8 -*-
"""
Module to handle
direct dynamics simulation
s on Multibody systems.
Module to handle
modal analysi
s on Multibody systems.
Summary
-------
...
...
@@ -191,9 +191,7 @@ class MbsModal(object):
self
.
set_options
(
**
kwargs
)
libmodules
.
mbs_run_modal
(
self
.
mbs_modal_ptr
,
self
.
mbs
.
mbs_data_ptr
)
if
self
.
store_results
:
self
.
load_results
()
error
=
libmodules
.
mbs_run_modal
(
self
.
mbs_modal_ptr
,
self
.
mbs
.
mbs_data_ptr
)
# Unassign user functions
if
self
.
mbs
.
opt_load_c
<
2
:
...
...
@@ -203,6 +201,35 @@ class MbsModal(object):
if
self
.
mbs
.
opt_load_c
<
1
:
self
.
mbs
.
__unassign_symb_fct__
(
self
.
symb_fun_list
)
if
error
<
0
:
mbs_msg
(
"
\n
--------------------------------------------------------------------------------
\n
"
# There is 80 characters printed
"READ CAREFULLY !!!
\n
"
"--------------------------------------------------------------------------------
\n\n
"
"An error occurs during the modal analysis.
\n
"
"The messages above give deeper informations on what went wrong.
\n
"
"The messages below gives classic error and error backtrace.
\n\n
"
"Usual errors are:
\n
"
" - Some options are not correct;
\n
"
" - Some mass or Inertia component is missing, leading to a invalid mass
\n
"
" matrix during the computation;
\n
"
" - The system is in a singular configuration;
\n
"
" - An error in user function (joint force, external forces) return wrong
\n
"
" value. Excessive force can generate infinte acceleration.
\n
"
"
\n
"
"If the simulation runs a little you should:
\n
"
" - In all cases, open the results/animation file and check the motion of the
\n
"
" system until it fails.
\n
"
" - In case of loop closure problem, you can alos check the dedicated animation
\n
"
" under the name 'Failed_loop_closing_procedure_q.res' if the related option
\n
"
" has been enable.
\n
"
"
\n
--------------------------------------------------------------------------------
\n
"
"
\n
--------------------------------------------------------------------------------
\n
"
)
raise
RuntimeError
(
"MbsModal.run() failed, read previous messages."
)
if
self
.
store_results
:
self
.
load_results
()
return
self
.
results
def
load_results
(
self
):
...
...
TestProjects/MR_350/workR/main_MBsysPy.py
View file @
69ff33da
...
...
@@ -82,6 +82,21 @@ mbs_modal = Robotran.MbsModal(mbs_data)
# Error: joints have change
# mbs_data.set_qdriven(2)
# Error: impossible cut
# mbs_data.dpt[3][4] = 10.
# Error: Mass matrix full of 0.
# Set all mass to 0
# mbs_data.m[1] = 0.0
# mbs_data.m[3] = 0.0
# mbs_data.m[4] = 0.0
# mbs_data.m[5] = 0.0
# Set all inertia to 0
# mbs_data.In[5][1] = 0.0
# mbs_data.In[5][4] = 0.0
# mbs_data.In[5][5] = 0.0
mbs_modal
.
set_options
(
save_result
=
1
,
save_anim
=
1
,
mode_ampl
=
0.2
)
mbs_modal
.
run
()
...
...
TestProjects/MR_350/workR/src/main.c
View file @
69ff33da
...
...
@@ -132,6 +132,21 @@ int main(int argc, char const *argv[])
mbs_modal
->
options
->
save_result
=
1
;
mbs_modal
->
options
->
save_anim
=
1
;
mbs_modal
->
options
->
verbose
=
1
;
// Error: impossible cut
// mbs_data->dpt[3][4] = 10;
// Error: Mass matrix full of 0.
// Set all mass to 0
// mbs_data->m[1] = 0.0;
// mbs_data->m[3] = 0.0;
// mbs_data->m[4] = 0.0;
// mbs_data->m[5] = 0.0;
// Set all inertia to 0
// mbs_data->In[5][1] = 0.0;
// mbs_data->In[5][4] = 0.0;
// mbs_data->In[5][5] = 0.0;
mbs_run_modal
(
mbs_modal
,
mbs_data
);
mbs_delete_modal
(
mbs_modal
,
mbs_data
);
...
...
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