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
a264e175
Commit
a264e175
authored
Nov 06, 2020
by
Olivier Lantsoght
Browse files
[MBsysPy][MbsEquil] New error management. and create error test in example.
parent
b681ab1c
Changes
3
Hide whitespace changes
Inline
Side-by-side
MBsysC/mbs_interface/MBsysPy/mbsyspy/mbs_equil.py
View file @
a264e175
...
...
@@ -88,7 +88,7 @@ class MbsEquil(object):
symbolic_path
=
os
.
path
.
join
(
project_path
,
symbolic_path
)
# Error handeling
if
not
os
.
path
.
isdir
(
symbolic_path
):
mbs_msg
(
'Thesymbolic function directory for direct dynamic module does not exist: "'
+
symbolic_path
+
'"'
)
mbs_msg
(
'The
symbolic function directory for direct dynamic module does not exist: "'
+
symbolic_path
+
'"'
)
mbs_msg
(
'The current root folder is: "'
+
os
.
getcwd
()
+
'"'
)
mbs_msg
(
'The following directory is used instead: "'
+
self
.
symbolic_path
+
'".'
)
else
:
...
...
@@ -146,6 +146,7 @@ class MbsEquil(object):
def
__del__
(
self
):
"""Delete the object by freeing the C - related memory."""
libmodules
.
mbs_delete_equil
(
self
.
mbs_equil_ptr
,
self
.
mbs
.
mbs_data_ptr
)
self
.
mbs_equil_ptr
=
None
if
__DEBUG__
:
mbs_msg
(
"DEBUG>> MbsEquil pointer deleted"
)
...
...
@@ -185,7 +186,7 @@ class MbsEquil(object):
error
=
libmodules
.
mbs_run_equil
(
self
.
mbs_equil_ptr
,
self
.
mbs
.
mbs_data_ptr
)
if
self
.
store_results
:
if
not
error
and
self
.
store_results
:
self
.
load_results
()
# Unassign user functions
...
...
@@ -211,10 +212,10 @@ class MbsEquil(object):
" - An error in user function (joint force, external forces) return wrong value.
\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
some
cases
if it was created
open the results/animation file and check
\n
"
"
the different equilibrium steps of the module
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'.
\n
"
" under the name 'Failed_loop_closing_procedure_q.res'
if the option was enable
.
\n
"
"
\n
--------------------------------------------------
\n
"
"
\n
--------------------------------------------------
\n
"
)
raise
RuntimeError
(
"MbsEquil.run() failed, read previous messages."
)
...
...
TestProjects/MR_350/readme.md
View file @
a264e175
...
...
@@ -7,7 +7,7 @@ Both project and MBsysC must be build with `FLAG_RELEASE=OFF`.
We should always ensure that no memory is definitively lost with:
*
MBsys
**C**
_: `valgrind --error-limit=yes --leak-check=full --show-leak-kinds=all --track-origins=yes --undef-value-errors=yes -v --log-file=valgrindout.txt ./exe_
PendulumSpringC
`
* MBsys**Py**: `
valgrind --tool=memcheck --suppressions=valgrind-python.supp --log-file="valgrindout.txt" python3 -E -tt main_MBsysPy.py
`
* MBsys**Py**: `
valgrind --tool=memcheck
--leak-check=full
--suppressions=valgrind-python.supp --log-file="valgrindout.txt" python3 -E -tt main_MBsysPy.py
`
check both _valgrindout.txt_ files and verify the following line:
```
...
...
TestProjects/MR_350/workR/main_MBsysPy.py
View file @
a264e175
...
...
@@ -47,6 +47,28 @@ mbs_equil = Robotran.MbsEquil(mbs_data)
# Error: joints have change
# mbs_data.set_qdriven(2)
# 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
# Error: impossible cut
# mbs_data->dpt[3][4] = 10;
# Error: no sensitive variables
# Replace all independent joints
# By anchor point coordinates with no symbol
# mbs_equil.add_exchange(mbs_data.dpt[2], 1, 1, "dpt[2][1]")
# mbs_equil.add_exchange(mbs_data.dpt[3], 1, 2, "dpt[3][1]")
# mbs_equil.add_exchange(mbs_data.dpt[2], 2, 3, "dpt[2][2]")
mbs_equil
.
set_options
(
method
=
1
,
senstol
=
1e-2
,
verbose
=
1
)
mbs_equil
.
run
()
...
...
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