Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
master project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joschua Gosda
master project
Commits
de4ff81c
Commit
de4ff81c
authored
3 years ago
by
Joschua Gosda
Browse files
Options
Downloads
Patches
Plain Diff
found fucking bug -> works now yaygit add python/preprocessing/genPaths.py
parent
4e1ca799
Branches
Branches containing commit
No related tags found
1 merge request
!1
all code snippets work
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/preprocessing/genPaths.py
+11
-11
11 additions, 11 deletions
python/preprocessing/genPaths.py
with
11 additions
and
11 deletions
python/preprocessing/genPaths.py
+
11
−
11
View file @
de4ff81c
...
@@ -116,7 +116,7 @@ z1 = np.zeros((pNum,1))
...
@@ -116,7 +116,7 @@ z1 = np.zeros((pNum,1))
z2
=
np
.
ones
((
pNum
,
1
))
*
wLen
z2
=
np
.
ones
((
pNum
,
1
))
*
wLen
# append z axis to position vectors
# append z axis to position vectors
p1m
=
np
.
hstack
((
p1
,
z1
))
p1m
=
np
.
hstack
((
p1
,
z1
))
p2m
=
np
.
hstack
((
p
1
,
z2
))
p2m
=
np
.
hstack
((
p
2
,
z2
))
p2m_ref
=
np
.
hstack
((
p2
,
z2
))
# original coordinates
p2m_ref
=
np
.
hstack
((
p2
,
z2
))
# original coordinates
# define array to compute distance between effectors
# define array to compute distance between effectors
effLen
=
np
.
zeros
((
pNum
,
1
))
effLen
=
np
.
zeros
((
pNum
,
1
))
...
@@ -133,20 +133,20 @@ for i in range(pNum):
...
@@ -133,20 +133,20 @@ for i in range(pNum):
hyp1
=
sqrt
(
dx
**
2
+
wLen
**
2
)
# calculate first hypothenuse
hyp1
=
sqrt
(
dx
**
2
+
wLen
**
2
)
# calculate first hypothenuse
hyp2
=
sqrt
(
dy
**
2
+
hyp1
**
2
)
hyp2
=
sqrt
(
dy
**
2
+
hyp1
**
2
)
ang
[
i
,
1
]
=
np
.
arctan
(
dx
/
wLen
)
# rotation around y-axis from oringal frame
ang
[
i
,
1
]
=
np
.
arctan
(
dx
/
wLen
)
# rotation around y-axis from oringal frame
ang
[
i
,
0
]
=
np
.
arctan
(
dy
/
hyp1
)
# rotation around x-axis in already rotated frame
ang
[
i
,
0
]
=
-
np
.
arctan
(
dy
/
hyp1
)
# rotation around x-axis in already rotated frame
effLen
[
i
,
0
]
=
hyp2
# effective length
effLen
[
i
,
0
]
=
hyp2
# effective length
dLen
=
hyp2
-
wLen
dLen
=
hyp2
-
wLen
# compute rotation matrices
# compute rotation matrices
# rotation in positive direction
# rotation in positive direction
Rx
=
np
.
array
([[
1
,
0
,
0
],
Rx
=
np
.
array
([[
1
,
0
,
0
],
[
0
,
cos
(
-
ang
[
i
,
0
]),
-
sin
(
-
ang
[
i
,
0
])],
[
0
,
cos
(
ang
[
i
,
0
]),
sin
(
ang
[
i
,
0
])],
[
0
,
sin
(
-
ang
[
i
,
0
]),
cos
(
-
ang
[
i
,
0
])]])
[
0
,
-
sin
(
ang
[
i
,
0
]),
cos
(
ang
[
i
,
0
])]])
# rotation in postive direction
# rotation in postive direction
Ry
=
np
.
array
([[
cos
(
ang
[
i
,
1
]),
0
,
sin
(
ang
[
i
,
1
])],
Ry
=
np
.
array
([[
cos
(
ang
[
i
,
1
]),
0
,
-
sin
(
ang
[
i
,
1
])],
[
0
,
1
,
0
],
[
0
,
1
,
0
],
[
-
sin
(
ang
[
i
,
1
]),
0
,
cos
(
ang
[
i
,
1
])]])
[
sin
(
ang
[
i
,
1
]),
0
,
cos
(
ang
[
i
,
1
])]])
# rotation matrix
# rotation matrix
# self defined convention: rotate around y axis, then around x axis the get from initial frame to wire frame
# self defined convention: rotate around y axis, then around x axis the get from initial frame to wire frame
...
@@ -202,21 +202,21 @@ for i, (r12,r22_) in enumerate(zip(dist_12, dist_22_)):
...
@@ -202,21 +202,21 @@ for i, (r12,r22_) in enumerate(zip(dist_12, dist_22_)):
fig
=
plt
.
figure
()
fig
=
plt
.
figure
()
plt
.
scatter
(
p1m
[
5
0
,
0
],
p1m
[
5
0
,
1
],
label
=
"
p1
"
)
plt
.
scatter
(
p1m
[
200
:
30
0
,
0
],
p1m
[
200
:
30
0
,
2
],
label
=
"
p1
"
)
plt
.
scatter
(
p2m_ref
[
5
0
,
0
],
p2m_ref
[
5
0
,
1
],
label
=
"
p2_ref
"
)
plt
.
scatter
(
p2m_ref
[
200
:
30
0
,
0
],
p2m_ref
[
200
:
30
0
,
2
],
label
=
"
p2_ref
"
)
plt
.
scatter
(
p2m
[
5
0
,
0
],
p2m
[
5
0
,
1
],
label
=
"
p2
"
)
plt
.
scatter
(
p2m
[
200
:
30
0
,
0
],
p2m
[
200
:
30
0
,
2
],
label
=
"
p2
"
)
plt
.
legend
()
plt
.
legend
()
plt
.
show
()
plt
.
show
()
# plot the data for visualisation
# plot the data for visualisation
fig
=
plt
.
figure
()
fig
=
plt
.
figure
()
ax
=
fig
.
add_subplot
(
111
,
projection
=
'
3d
'
)
ax
=
fig
.
add_subplot
(
111
,
projection
=
'
3d
'
)
#
ax.scatter(p1m[:,0],p1m[:,1],p1m[:,2])
ax
.
scatter
(
p1m
[:,
0
],
p1m
[:,
1
],
p1m
[:,
2
])
ax
.
scatter
(
p2m
[:,
0
],
p2m
[:,
1
],
p2m
[:,
2
])
ax
.
scatter
(
p2m
[:,
0
],
p2m
[:,
1
],
p2m
[:,
2
])
ax
.
scatter
(
p2m_ref
[:,
0
],
p2m_ref
[:,
1
],
p2m_ref
[:,
2
])
ax
.
scatter
(
p2m_ref
[:,
0
],
p2m_ref
[:,
1
],
p2m_ref
[:,
2
])
ax
.
set_xlim
(
0
,
0.170
)
ax
.
set_xlim
(
0
,
0.170
)
ax
.
set_ylim
(
0
,
0.100
)
ax
.
set_ylim
(
0
,
0.100
)
ax
.
set_zlim
(
0.
7
95
,
0.
8
05
)
ax
.
set_zlim
(
0.
3
95
,
0.
4
05
)
plt
.
show
()
plt
.
show
()
# make data ready for export
# make data ready for export
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment