Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
robotics-codes-from-scratch
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
rli
robotics-codes-from-scratch
Compare revisions
d192f55876476699778800a0b36dcd535f018e03 to e0aa22d75fef266949e9c8711d675a7b07c6018f
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
rli/robotics-codes-from-scratch
Select target project
No results found
e0aa22d75fef266949e9c8711d675a7b07c6018f
Select Git revision
Branches
develop
master
Swap
Target
rli/robotics-codes-from-scratch
Select target project
rli/robotics-codes-from-scratch
1 result
d192f55876476699778800a0b36dcd535f018e03
Select Git revision
Branches
develop
master
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
fix: fix indexes in iLQRManipulator3d.py
· 279a5431
Jérémy MACEIRAS
authored
5 months ago
279a5431
fix: fixed least square computation in iLQR_manipulator3d.py
· e0aa22d7
Jérémy MACEIRAS
authored
5 months ago
e0aa22d7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/iLQR_manipulator3D.py
+11
-6
11 additions, 6 deletions
python/iLQR_manipulator3D.py
with
11 additions
and
6 deletions
python/iLQR_manipulator3D.py
View file @
e0aa22d7
...
...
@@ -206,17 +206,22 @@ for i in range(param.nbIter):
Ra
=
np
.
zeros_like
(
Qr
)
for
i
in
range
(
param
.
nbPoints
):
Rtmp
=
q2R
(
param
.
Mu
[
-
4
:,
i
])
# Orientation matrix for target
for
j
in
range
(
param
.
nbPoints
):
Rkp
=
np
.
zeros
((
param
.
nbVarF
-
1
,
param
.
nbVarF
-
1
))
# Transformation matrix with both translation and rotation
Rkp
[:
3
,:
3
]
=
np
.
identity
(
3
)
# For translation
Rkp
[
-
3
:,
-
3
:]
=
Rtmp
# For rotation
Rkp
[
-
3
:,
-
3
:]
=
q2R
(
param
.
Mu
[
-
4
:,
j
])
# Orientation matrix for target
nbVarQ
=
param
.
nbVarF
-
1
Ra
[
i
*
nbVarQ
:(
i
+
1
)
*
nbVarQ
,
i
*
nbVarQ
:(
i
+
1
)
*
nbVarQ
]
=
Rkp
Ra
[
j
*
nbVarQ
:(
j
+
1
)
*
nbVarQ
,
j
*
nbVarQ
:(
j
+
1
)
*
nbVarQ
]
=
Rkp
Q
=
Ra
@
Qr
@
Ra
.
T
# Precision matrix in absolute coordinate frame (base frame)
du
=
np
.
linalg
.
pinv
(
Su
.
T
@
J
.
T
@
Q
@
J
@
Su
+
R
)
@
(
-
Su
.
T
@
J
.
T
@
Q
@
f
-
u
*
param
.
r
)
# Gauss-Newton update
#du = np.linalg.pinv(Su.T @ J.T @ Q @ J @ Su + R) @ (-Su.T @ J.T @ Q @ f - u * param.r) # Gauss-Newton update
du
=
np
.
linalg
.
lstsq
(
Su
.
T
@
J
.
T
@
Q
@
J
@
Su
+
R
,
-
Su
.
T
@
J
.
T
@
Q
@
f
-
u
*
param
.
r
,
rcond
=-
1
)[
0
]
# Gauss-Newton update
# Estimate step size with backtracking line search method
alpha
=
1
...
...
@@ -235,7 +240,7 @@ for i in range(param.nbIter):
u
=
u
+
du
*
alpha
if
np
.
linalg
.
norm
(
du
*
alpha
)
<
1E-2
:
if
np
.
linalg
.
norm
(
du
*
alpha
)
<
1E-2
or
cost
<
1.5e-3
:
break
# Stop iLQR iterations when solution is reached
...
...
This diff is collapsed.
Click to expand it.