Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stack Of Tasks
pinocchio
Commits
13384976
Commit
13384976
authored
Jun 11, 2020
by
Julian Eßer
Browse files
[examples][reduced-model] Simplify code
parent
b2cda051
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/build-reduced-model.py
View file @
13384976
...
...
@@ -14,19 +14,19 @@ robot = RobotWrapper.BuildFromURDF(modelPath + URDF_SUBPATH, [modelPath])
# Check dimensions of the original model
print
(
'standard model: dim='
+
str
(
len
(
robot
.
model
.
joints
)))
for
jn
in
range
(
len
(
robot
.
model
.
joints
))
:
print
(
robot
.
model
.
joints
[
jn
]
)
for
jn
in
robot
.
model
.
joints
:
print
(
jn
)
# Create a list of joints to lock
jointsToLock
=
[
'wrist_1_joint'
,
'wrist_2_joint'
,
'wrist_3_joint'
]
# Get the ID of all existing joints
jointsToLockIDs
=
[]
for
jn
in
range
(
len
(
jointsToLock
))
:
if
robot
.
model
.
existJointName
(
j
ointsToLock
[
jn
]
):
jointsToLockIDs
.
append
(
robot
.
model
.
getJointId
(
j
ointsToLock
[
jn
]
))
for
jn
in
jointsToLock
:
if
robot
.
model
.
existJointName
(
j
n
):
jointsToLockIDs
.
append
(
robot
.
model
.
getJointId
(
j
n
))
else
:
print
(
'Warning: joint '
+
str
(
j
ointsToLock
[
jn
]
)
+
' does not belong to the model!'
)
print
(
'Warning: joint '
+
str
(
j
n
)
+
' does not belong to the model!'
)
# Set initial position of both fixed and revoulte joints
initialJointConfig
=
np
.
matrix
([
0
,
0
,
0
,
# shoulder and elbow
...
...
@@ -40,5 +40,5 @@ robot.model, robot.visual_model = pin.buildReducedModel(robot.model, robot.visua
# Check dimensions of the reduced model
print
(
'reduced model: dim='
+
str
(
len
(
robot
.
model
.
joints
)))
for
jn
in
range
(
len
(
robot
.
model
.
joints
)):
print
(
robot
.
model
.
joints
[
jn
])
\ No newline at end of file
for
jn
in
robot
.
model
.
joints
:
print
(
jn
)
\ No newline at end of file
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