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
2a897819
Commit
2a897819
authored
Aug 11, 2020
by
Louis Beauloye
Browse files
code enhancement + doc
parent
5a350fc7
Changes
6
Hide whitespace changes
Inline
Side-by-side
MBsysC/mbs_interface/MBsysPy/mbsyspy/mbs_dirdyn.py
View file @
2a897819
...
...
@@ -131,10 +131,14 @@ class MbsDirdyn(object):
self
.
symbolic_path
=
symbolic_path
# Storing project function pointer
self
.
user_fun_list
=
[
'cons_hJ'
,
'cons_jdqd'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
,
'dirdyn_init'
,
'dirdyn_loop'
,
'dirdyn_finish'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'cons_jdqd'
,
'invdyna'
,
'dirdyna'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
self
.
user_fun_list
=
[
'cons_hJ'
,
'cons_jdqd'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
,
'dirdyn_init'
,
'dirdyn_loop'
,
'dirdyn_finish'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'cons_jdqd'
,
'invdyna'
,
'dirdyna'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
# Storing Results
self
.
results
=
MbsResult
(
self
.
mbs
)
...
...
@@ -275,9 +279,7 @@ class MbsDirdyn(object):
return
self
.
results
def
set_user_fct_from_file
(
self
,
function_name
,
user_path
,
user_file
):
"""
Load a user function from a file chosen by the user instead of the default one in the userfctR folder.
"""Load a user function from a file chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
@@ -295,9 +297,7 @@ class MbsDirdyn(object):
self
.
mbs
.
__set_user_fct_from_file__
(
function_name
,
user_path
,
user_file
)
def
set_user_fct_from_ptr
(
self
,
function_name
,
user_fct_ptr
):
"""
Load a user function chosen by the user instead of the default one in the userfctR folder.
"""Load a user function chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
MBsysC/mbs_interface/MBsysPy/mbsyspy/mbs_equil.py
View file @
2a897819
...
...
@@ -95,10 +95,14 @@ class MbsEquil(object):
else
:
self
.
symbolic_path
=
symbolic_path
self
.
user_fun_list
=
[
'cons_hJ'
,
'cons_jdqd'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
,
'equil_init'
,
'equil_loop'
,
'equil_finish'
,
'equil_fxe'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'cons_jdqd'
,
'invdyna'
,
'dirdyna'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
self
.
user_fun_list
=
[
'cons_hJ'
,
'cons_jdqd'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
,
'equil_init'
,
'equil_loop'
,
'equil_finish'
,
'equil_fxe'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'cons_jdqd'
,
'invdyna'
,
'dirdyna'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
# exchange of equilibrium variables
self
.
exchange_list
=
[]
...
...
@@ -237,7 +241,6 @@ class MbsEquil(object):
def
set_user_fct_from_file
(
self
,
function_name
,
user_path
,
user_file
):
"""
Load a user function from a file chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
@@ -257,7 +260,6 @@ class MbsEquil(object):
def
set_user_fct_from_ptr
(
self
,
function_name
,
user_fct_ptr
):
"""
Load a user function chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
@@ -335,14 +337,14 @@ class MbsEquil(object):
"""
if
self
.
get_options
(
"nxe"
):
mbs_msg
(
"As the number of equilibrium variables is locked in the external memory"
" after the first call of run(), this function can not be called between two run()"
)
" after the first call of run(), this function can not be called between two run()"
)
if
index
>
np
.
size
(
ptr
)
-
1
:
mbs_msg
(
">>EQUIL>> variable exchange: Index out of bound"
)
return
address
=
ptr
.
ctypes
.
data
+
ctypes
.
sizeof
(
ctypes
.
c_double
)
*
index
if
ptr
.
ctypes
.
data
==
self
.
mbs
.
q
.
ctypes
.
data
:
mbs_msg
(
">>EQUIL>> extra exchange: Warning ! Generalized coordinates have"
" to be used with caution as extra variables"
)
" to be used with caution as extra variables"
)
if
ptr_name
is
None
:
ptr_name
=
"extra_variable_{:d}"
.
format
(
len
(
self
.
addition_list
))
...
...
@@ -418,11 +420,11 @@ class MbsEquil(object):
if
self
.
get_options
(
"nquch"
):
mbs_msg
(
"As the number of equilibrium variables is locked in the external memory"
" after the first call of run(), this function can not be called between two run()"
)
" after the first call of run(), this function can not be called between two run()"
)
return
if
self
.
mbs
.
user_model
[
user_model
].
_type
[
param
]
!=
1
and
self
.
mbs
.
user_model
[
user_model
].
_type
[
param
]
!=
7
:
mbs_msg
(
">>EQUIL>> variable exchange: This function does not handle this"
" type of user model(only float and int)"
)
" type of user model(only float and int)"
)
return
address
=
self
.
mbs
.
user_model
[
user_model
].
__getarray__
(
param
)[
0
].
ctypes
.
data
if
__DEBUG__
:
...
...
@@ -462,7 +464,7 @@ class MbsEquil(object):
libmodules
.
mbs_equil_set_variable
(
self
.
mbs_equil_ptr
.
contents
.
options
,
element
[
0
],
i
+
1
,
element
[
1
])
elif
self
.
get_options
(
"nquch"
)
!=
len
(
self
.
exchange_list
):
mbs_msg
(
">>EQUIL>> variable exchange: nquch("
+
str
(
self
.
get_options
(
"nquch"
))
+
") different from the length of the exchange list("
+
str
(
len
(
self
.
exchange_list
))
+
")"
)
") different from the length of the exchange list("
+
str
(
len
(
self
.
exchange_list
))
+
")"
)
def
_compute_extra_variable
(
self
):
"""
...
...
@@ -478,7 +480,7 @@ class MbsEquil(object):
libmodules
.
mbs_equil_add_variable
(
self
.
mbs_equil_ptr
.
contents
.
options
,
element
[
0
],
i
+
1
)
elif
self
.
get_options
(
"nxe"
)
!=
len
(
self
.
addition_list
):
mbs_msg
(
">>EQUIL>> extra variable: nxe("
+
str
(
self
.
get_options
(
"nxe"
))
+
") different from the length of the extra variable list("
+
str
(
len
(
self
.
addition_list
))
+
")"
)
") different from the length of the extra variable list("
+
str
(
len
(
self
.
addition_list
))
+
")"
)
def
replace_exchange
(
self
,
ptr
,
index
,
id_exchanged
,
ptr_name
=
"??"
):
"""
...
...
@@ -501,7 +503,7 @@ class MbsEquil(object):
"""
if
ptr
.
ctypes
.
data
==
self
.
mbs
.
q
.
ctypes
.
data
:
mbs_msg
(
">>EQUIL>> variable exchange: Warning generalized coordinates"
" have to be used with caution as exchange variables"
)
" have to be used with caution as exchange variables"
)
if
id_exchanged
>
len
(
self
.
exchange_list
)
or
id_exchanged
<=
0
:
mbs_msg
(
">>EQUIL>> variable exchange: There is no exchange variable at this index:"
+
str
(
id_exchanged
))
...
...
@@ -527,7 +529,7 @@ class MbsEquil(object):
"""
if
ptr
.
ctypes
.
data
==
self
.
mbs
.
q
.
ctypes
.
data
:
mbs_msg
(
">>EQUIL>> extra exchange: Warning generalized coordinates"
" have to be used with caution as extra variables"
)
" have to be used with caution as extra variables"
)
if
id_extra
>
len
(
self
.
addition_list
)
or
id_extra
<=
0
:
mbs_msg
(
">>EQUIL>> extra exchange: There is no extra variable at this index:"
+
str
(
id_extra
))
...
...
@@ -553,7 +555,7 @@ class MbsEquil(object):
"""
if
self
.
mbs
.
user_model
[
user_model
].
_type
[
param
]
!=
1
and
self
.
mbs
.
user_model
[
user_model
].
_type
[
param
]
!=
7
:
mbs_msg
(
">>EQUIL>> extra exchange: This function does not handle this"
" type of user model(only float and int)"
)
" type of user model(only float and int)"
)
return
if
id_extra
>
len
(
self
.
addition_list
)
or
id_extra
<=
0
:
mbs_msg
(
">>EQUIL>> extra exchange: There is no extra variable at this index:"
+
str
(
id_extra
))
...
...
@@ -579,7 +581,7 @@ class MbsEquil(object):
"""
if
self
.
mbs
.
user_model
[
user_model
].
_type
[
param
]
!=
1
and
self
.
mbs
.
user_model
[
user_model
].
_type
[
param
]
!=
7
:
mbs_msg
(
">>EQUIL>> variable exchange: This function does not handle "
"this type of user model(only float and int)"
)
"this type of user model(only float and int)"
)
return
if
id_exchanged
>
len
(
self
.
exchange_list
)
or
id_exchanged
<=
0
:
mbs_msg
(
">>EQUIL>> variable exchange: There is no exchange variable at this index:"
+
str
(
id_exchanged
))
...
...
MBsysC/mbs_interface/MBsysPy/mbsyspy/mbs_invdyn.py
View file @
2a897819
...
...
@@ -112,10 +112,13 @@ class MbsInvdyn(object):
else
:
self
.
symbolic_path
=
symbolic_path
self
.
user_fun_list
=
[
'cons_hJ'
,
'cons_jdqd'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'cons_jdqd'
,
'invdyna'
,
'dirdyna'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
self
.
user_fun_list
=
[
'cons_hJ'
,
'cons_jdqd'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'cons_jdqd'
,
'invdyna'
,
'dirdyna'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
# Storing Results
self
.
results
=
MbsResult
(
self
.
mbs
)
...
...
@@ -262,7 +265,6 @@ class MbsInvdyn(object):
def
set_user_fct_from_file
(
self
,
function_name
,
user_path
,
user_file
):
"""
Load a user function from a file chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
@@ -282,7 +284,6 @@ class MbsInvdyn(object):
def
set_user_fct_from_ptr
(
self
,
function_name
,
user_fct_ptr
):
"""
Load a user function chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
MBsysC/mbs_interface/MBsysPy/mbsyspy/mbs_modal.py
View file @
2a897819
...
...
@@ -108,10 +108,13 @@ class MbsModal(object):
else
:
self
.
symbolic_path
=
symbolic_path
self
.
user_fun_list
=
[
'cons_hJ'
,
'cons_jdqd'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'cons_jdqd'
,
'invdyna'
,
'dirdyna'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
self
.
user_fun_list
=
[
'cons_hJ'
,
'cons_jdqd'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'cons_jdqd'
,
'invdyna'
,
'dirdyna'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
# Storing Results
self
.
results
=
MbsResultModal
()
...
...
@@ -213,7 +216,6 @@ class MbsModal(object):
def
set_user_fct_from_file
(
self
,
function_name
,
user_path
,
user_file
):
"""
Load a user function from a file chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
@@ -233,7 +235,6 @@ class MbsModal(object):
def
set_user_fct_from_ptr
(
self
,
function_name
,
user_fct_ptr
):
"""
Load a user function chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
MBsysC/mbs_interface/MBsysPy/mbsyspy/mbs_part.py
View file @
2a897819
...
...
@@ -122,10 +122,12 @@ class MbsPart(object):
# Storing project function pointer
# self.user_cons_hJ = None
# self.mbs_cons_hJ = None
self
.
user_fun_list
=
[
'cons_hJ'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
]
self
.
user_fun_list
=
[
'cons_hJ'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
'link'
,
'link3D'
,
'sensor'
]
# Exposing some memory
if
__DEBUG__
:
...
...
@@ -182,7 +184,6 @@ class MbsPart(object):
def
set_user_fct_from_file
(
self
,
function_name
,
user_path
,
user_file
):
"""
Load a user function from a file chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
@@ -202,7 +203,6 @@ class MbsPart(object):
def
set_user_fct_from_ptr
(
self
,
function_name
,
user_fct_ptr
):
"""
Load a user function chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
MBsysC/mbs_interface/MBsysPy/mbsyspy/mbs_solvekin.py
View file @
2a897819
...
...
@@ -91,10 +91,13 @@ class MbsSolvekin(MbsInvdyn):
else
:
self
.
symbolic_path
=
symbolic_path
self
.
user_fun_list
=
[
'cons_hJ'
,
'cons_jdqd'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'cons_jdqd'
,
'invdyna'
,
'dirdyna'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
self
.
user_fun_list
=
[
'cons_hJ'
,
'cons_jdqd'
,
'derivative'
,
'DrivenJoints'
,
'ExtForces'
,
'JointForces'
,
'LinkForces'
,
'Link3DForces'
]
self
.
symb_fun_list
=
[
'accelred'
,
'cons_hJ'
,
'cons_jdqd'
,
'invdyna'
,
'dirdyna'
,
'extforces'
,
'gensensor'
,
'link'
,
'link3D'
,
'sensor'
]
# Storing Results
self
.
results
=
MbsResult
(
self
.
mbs
)
...
...
@@ -209,7 +212,6 @@ class MbsSolvekin(MbsInvdyn):
def
set_user_fct_from_file
(
self
,
function_name
,
user_path
,
user_file
):
"""
Load a user function from a file chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
@@ -229,7 +231,6 @@ class MbsSolvekin(MbsInvdyn):
def
set_user_fct_from_ptr
(
self
,
function_name
,
user_fct_ptr
):
"""
Load a user function chosen by the user instead of the default one in the userfctR folder.
The function is then unassigned by the module at the end of the run().
...
...
Write
Preview
Markdown
is supported
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