Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gepetto-viewer-corba
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
Container Registry
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
Guilhem Saurel
gepetto-viewer-corba
Commits
b77a111e
Commit
b77a111e
authored
5 years ago
by
Joseph Mirabel
Committed by
Joseph Mirabel
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Allow to set the translation of Linear, Angular and Vector6.
parent
03382047
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/gepetto/corbaserver/tools.py
+16
-13
16 additions, 13 deletions
src/gepetto/corbaserver/tools.py
with
16 additions
and
13 deletions
src/gepetto/corbaserver/tools.py
+
16
−
13
View file @
b77a111e
...
@@ -38,7 +38,7 @@ def _pointsCircularArrow (R, r, nR, nr):
...
@@ -38,7 +38,7 @@ def _pointsCircularArrow (R, r, nR, nr):
# Compute a transformation which rotates (1, 0, 0) to v
# Compute a transformation which rotates (1, 0, 0) to v
# Return (norm_v, T)
# Return (norm_v, T)
# When norm_v == 0, T is None
# When norm_v == 0, T is None
def
_tranformFromXvector
(
v
):
def
_tranformFromXvector
(
v
,
origin
=
(
0
,
0
,
0
)
):
norm_v
=
np
.
linalg
.
norm
(
v
)
norm_v
=
np
.
linalg
.
norm
(
v
)
if
norm_v
==
0
:
if
norm_v
==
0
:
# self.plugin.gui.gui.resizeArrow (n, self.radius, norm_v)
# self.plugin.gui.gui.resizeArrow (n, self.radius, norm_v)
...
@@ -51,11 +51,11 @@ def _tranformFromXvector (v):
...
@@ -51,11 +51,11 @@ def _tranformFromXvector (v):
c
=
max
(
u
[
0
],
-
1
)
c
=
max
(
u
[
0
],
-
1
)
w2
=
(
1
+
c
)
/
2
w2
=
(
1
+
c
)
/
2
s
=
sqrt
(
1
-
w2
)
s
=
sqrt
(
1
-
w2
)
t
=
(
0
,
0
,
0
,
V
[
0
,
2
]
/
s
,
V
[
1
,
2
]
/
s
,
V
[
2
,
2
]
/
s
,
w2
)
t
=
origin
+
(
V
[
0
,
2
]
/
s
,
V
[
1
,
2
]
/
s
,
V
[
2
,
2
]
/
s
,
w2
)
else
:
else
:
s
=
sqrt
(
2
*
(
1
+
u
[
0
]))
s
=
sqrt
(
2
*
(
1
+
u
[
0
]))
# axis = (0, -u[2]/s, u[1]/s) # x ^ u
# axis = (0, -u[2]/s, u[1]/s) # x ^ u
t
=
(
0
,
0
,
0
,
0
,
-
u
[
2
]
/
s
,
u
[
1
]
/
s
,
s
/
2
)
t
=
origin
+
(
0
,
-
u
[
2
]
/
s
,
u
[
1
]
/
s
,
s
/
2
)
return
norm_v
,
t
return
norm_v
,
t
## Helper class to plot a 3D vector as a circular arrow
## Helper class to plot a 3D vector as a circular arrow
...
@@ -94,10 +94,11 @@ class Angular:
...
@@ -94,10 +94,11 @@ class Angular:
## Set the 3D vector to plot
## Set the 3D vector to plot
## \param gui the IDL client (typically the \c gui attribute of class gepetto.corbaserver.client.Client)
## \param gui the IDL client (typically the \c gui attribute of class gepetto.corbaserver.client.Client)
## \param v a list or tuple of 3 elements
## \param value the vector to plot (list or tuple of 3 elements)
## \param origin the translation of the origin (list or tuple of 3 elements)
## \param factor the norm of the vector is divided by this value
## \param factor the norm of the vector is divided by this value
def
set
(
self
,
gui
,
v
,
factor
=
pi
):
def
set
(
self
,
gui
,
v
alue
,
origin
=
(
0
,
0
,
0
)
,
factor
=
pi
):
norm
,
pos
=
_tranformFromXvector
(
v
)
norm
,
pos
=
_tranformFromXvector
(
v
alue
,
origin
=
origin
)
count
=
min
(
self
.
minC
+
int
(
norm
*
(
self
.
maxC
-
self
.
minC
)
/
factor
),
self
.
maxC
)
count
=
min
(
self
.
minC
+
int
(
norm
*
(
self
.
maxC
-
self
.
minC
)
/
factor
),
self
.
maxC
)
gui
.
setCurvePointsSubset
(
self
.
name
,
0
,
count
)
gui
.
setCurvePointsSubset
(
self
.
name
,
0
,
count
)
if
pos
is
not
None
:
gui
.
applyConfiguration
(
self
.
name
,
pos
)
if
pos
is
not
None
:
gui
.
applyConfiguration
(
self
.
name
,
pos
)
...
@@ -125,10 +126,11 @@ class Linear:
...
@@ -125,10 +126,11 @@ class Linear:
## Set the 3D vector to plot
## Set the 3D vector to plot
## \param gui the IDL client (typically the \c gui attribute of class gepetto.corbaserver.client.Client)
## \param gui the IDL client (typically the \c gui attribute of class gepetto.corbaserver.client.Client)
## \param v a list or tuple of 3 elements
## \param value the vector to plot (list or tuple of 3 elements)
## \param origin the translation of the origin (list or tuple of 3 elements)
## \param factor the norm of the vector is divided by this value
## \param factor the norm of the vector is divided by this value
def
set
(
self
,
gui
,
v
,
factor
=
1.
):
def
set
(
self
,
gui
,
v
alue
,
origin
=
(
0
,
0
,
0
)
,
factor
=
1.
):
norm
,
pos
=
_tranformFromXvector
(
v
)
norm
,
pos
=
_tranformFromXvector
(
v
alue
,
origin
=
origin
)
gui
.
resizeArrow
(
self
.
name
,
self
.
R
,
norm
/
factor
)
gui
.
resizeArrow
(
self
.
name
,
self
.
R
,
norm
/
factor
)
if
pos
is
not
None
:
gui
.
applyConfiguration
(
self
.
name
,
pos
)
if
pos
is
not
None
:
gui
.
applyConfiguration
(
self
.
name
,
pos
)
...
@@ -183,10 +185,11 @@ class Vector6:
...
@@ -183,10 +185,11 @@ class Vector6:
## Set the 6D vector to plot
## Set the 6D vector to plot
## \param gui the IDL client (typically the \c gui attribute of class gepetto.corbaserver.client.Client)
## \param gui the IDL client (typically the \c gui attribute of class gepetto.corbaserver.client.Client)
## \param v a list or tuple of 6 elements
## \param value the vector to plot (list or tuple of 6 elements)
def
set
(
self
,
gui
,
v
):
## \param origin the translation of the origin (list or tuple of 3 elements)
self
.
linear
.
set
(
gui
,
v
[
0
:
3
],
self
.
linF
)
def
set
(
self
,
gui
,
value
,
origin
=
(
0
,
0
,
0
)):
self
.
angular
.
set
(
gui
,
v
[
3
:
6
],
self
.
angF
)
self
.
linear
.
set
(
gui
,
value
[
0
:
3
],
self
.
linF
,
origin
=
origin
)
self
.
angular
.
set
(
gui
,
value
[
3
:
6
],
self
.
angF
,
origin
=
origin
)
## Plot a function of 2 arguments i.e. (x, y, f(x, y))
## Plot a function of 2 arguments i.e. (x, y, f(x, y))
# \param gui the CORBA client
# \param gui the CORBA client
...
...
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