Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
navipy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olivier Bertrand
navipy
Commits
c9ba8626
Commit
c9ba8626
authored
7 years ago
by
Olivier Bertrand
Browse files
Options
Downloads
Patches
Plain Diff
rename angles in moving module to match database
parent
99126702
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
navipy/moving/agent.py
+11
-11
11 additions, 11 deletions
navipy/moving/agent.py
navipy/moving/test_agent.py
+11
-11
11 additions, 11 deletions
navipy/moving/test_agent.py
with
22 additions
and
22 deletions
navipy/moving/agent.py
+
11
−
11
View file @
c9ba8626
...
@@ -71,8 +71,8 @@ class AbstractAgent():
...
@@ -71,8 +71,8 @@ class AbstractAgent():
if
isinstance
(
posorients_vel
,
pd
.
Series
)
is
False
:
if
isinstance
(
posorients_vel
,
pd
.
Series
)
is
False
:
raise
TypeError
(
'
posorients_vel should be a pandas Series
'
)
raise
TypeError
(
'
posorients_vel should be a pandas Series
'
)
for
col
in
[
'
x
'
,
'
y
'
,
'
z
'
,
'
yaw
'
,
'
pitch
'
,
'
roll
'
,
for
col
in
[
'
x
'
,
'
y
'
,
'
z
'
,
'
alpha_0
'
,
'
alpha_1
'
,
'
alpha_2
'
,
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
d
yaw
'
,
'
dpitch
'
,
'
droll
'
]:
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
d
alpha_0
'
,
'
dalpha_1
'
,
'
dalpha_2
'
]:
if
col
not
in
posorients_vel
.
index
:
if
col
not
in
posorients_vel
.
index
:
raise
KeyError
(
raise
KeyError
(
'
posorients_vel should have {} as index
'
.
format
(
col
))
'
posorients_vel should have {} as index
'
.
format
(
col
))
...
@@ -85,13 +85,13 @@ class AbstractAgent():
...
@@ -85,13 +85,13 @@ class AbstractAgent():
# Compute the closest possible position
# Compute the closest possible position
if
posorients_vel
is
None
:
if
posorients_vel
is
None
:
posorients_vel
[[
'
x
'
,
'
y
'
,
'
z
'
,
posorients_vel
[[
'
x
'
,
'
y
'
,
'
z
'
,
'
yaw
'
,
'
pitch
'
,
'
roll
'
]]
=
\
'
alpha_0
'
,
'
alpha_1
'
,
'
alpha_2
'
]]
=
\
navimomath
.
closest_pos_memory_friendly
(
navimomath
.
closest_pos_memory_friendly
(
posorients_vel
,
posorients_vel
,
self
.
db
)
self
.
db
)
else
:
else
:
posorients_vel
[[
'
x
'
,
'
y
'
,
'
z
'
,
posorients_vel
[[
'
x
'
,
'
y
'
,
'
z
'
,
'
yaw
'
,
'
pitch
'
,
'
roll
'
]]
=
\
'
alpha_0
'
,
'
alpha_1
'
,
'
alpha_2
'
]]
=
\
navimomath
.
closest_pos
(
navimomath
.
closest_pos
(
posorients_vel
,
posorients_vel
,
self
.
__posorients
)
self
.
__posorients
)
...
@@ -108,9 +108,9 @@ class Single(AbstractAgent):
...
@@ -108,9 +108,9 @@ class Single(AbstractAgent):
self
.
__posorientvel
=
pd
.
Series
(
self
.
__posorientvel
=
pd
.
Series
(
index
=
[
'
x
'
,
'
y
'
,
'
z
'
,
index
=
[
'
x
'
,
'
y
'
,
'
z
'
,
'
yaw
'
,
'
pitch
'
,
'
roll
'
,
'
alpha_0
'
,
'
alpha_1
'
,
'
alpha_2
'
,
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
d
yaw
'
,
'
dpitch
'
,
'
droll
'
],
'
d
alpha_0
'
,
'
dalpha_1
'
,
'
dalpha_2
'
],
dtype
=
np
.
float
)
dtype
=
np
.
float
)
if
isinstance
(
initial_condition
,
pd
.
Series
):
if
isinstance
(
initial_condition
,
pd
.
Series
):
...
@@ -151,11 +151,11 @@ class Single(AbstractAgent):
...
@@ -151,11 +151,11 @@ class Single(AbstractAgent):
@property
@property
def
orientation
(
self
):
def
orientation
(
self
):
return
self
.
__posorientvel
.
loc
[[
'
yaw
'
,
'
pitch
'
,
'
roll
'
]]
return
self
.
__posorientvel
.
loc
[[
'
alpha_0
'
,
'
alpha_1
'
,
'
alpha_2
'
]]
@property
@property
def
angular_velocity
(
self
):
def
angular_velocity
(
self
):
return
self
.
__posorientvel
.
loc
[[
'
d
yaw
'
,
'
dpitch
'
,
'
droll
'
]]
return
self
.
__posorientvel
.
loc
[[
'
d
alpha_0
'
,
'
dalpha_1
'
,
'
dalpha_2
'
]]
@angular_velocity.setter
@angular_velocity.setter
def
angular_velocity
(
self
,
angvel
):
def
angular_velocity
(
self
,
angvel
):
...
@@ -163,9 +163,9 @@ class Single(AbstractAgent):
...
@@ -163,9 +163,9 @@ class Single(AbstractAgent):
if
is_numeric_dtype
(
angvel
):
if
is_numeric_dtype
(
angvel
):
# Use explicitly vel.dx, ...
# Use explicitly vel.dx, ...
# to make sure that the Series contain those
# to make sure that the Series contain those
self
.
__posorientvel
.
d
yaw
=
angvel
.
d
yaw
self
.
__posorientvel
.
d
alpha_0
=
angvel
.
d
alpha_0
self
.
__posorientvel
.
d
pitch
=
angvel
.
d
pitch
self
.
__posorientvel
.
d
alpha_1
=
angvel
.
d
alpha_1
self
.
__posorientvel
.
d
roll
=
angvel
.
d
roll
self
.
__posorientvel
.
d
alpha_2
=
angvel
.
d
alpha_2
else
:
else
:
raise
TypeError
(
'
vel should be numeric
'
)
raise
TypeError
(
'
vel should be numeric
'
)
else
:
else
:
...
...
This diff is collapsed.
Click to expand it.
navipy/moving/test_agent.py
+
11
−
11
View file @
c9ba8626
...
@@ -40,8 +40,8 @@ class TestNavipyMovingAgent(unittest.TestCase):
...
@@ -40,8 +40,8 @@ class TestNavipyMovingAgent(unittest.TestCase):
agent
.
abstractmove
(
'
NotPandasSeries
'
)
agent
.
abstractmove
(
'
NotPandasSeries
'
)
posorient_vel
=
pd
.
Series
()
posorient_vel
=
pd
.
Series
()
for
col
in
[
'
x
'
,
'
y
'
,
'
z
'
,
'
yaw
'
,
'
pitch
'
,
'
roll
'
,
for
col
in
[
'
x
'
,
'
y
'
,
'
z
'
,
'
alpha_0
'
,
'
alpha_1
'
,
'
alpha_2
'
,
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
d
yaw
'
,
'
dpitch
'
,
'
droll
'
]:
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
d
alpha_0
'
,
'
dalpha_1
'
,
'
dalpha_2
'
]:
with
self
.
assertRaises
(
KeyError
):
with
self
.
assertRaises
(
KeyError
):
agent
.
abstractmove
(
posorient_vel
)
agent
.
abstractmove
(
posorient_vel
)
posorient_vel
[
col
]
=
2
posorient_vel
[
col
]
=
2
...
@@ -52,9 +52,9 @@ class TestNavipyMovingAgent(unittest.TestCase):
...
@@ -52,9 +52,9 @@ class TestNavipyMovingAgent(unittest.TestCase):
posorient_vel
=
pd
.
Series
(
data
=
0
,
posorient_vel
=
pd
.
Series
(
data
=
0
,
index
=
[
'
x
'
,
'
y
'
,
'
z
'
,
index
=
[
'
x
'
,
'
y
'
,
'
z
'
,
'
yaw
'
,
'
pitch
'
,
'
roll
'
,
'
alpha_0
'
,
'
alpha_1
'
,
'
alpha_2
'
,
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
d
yaw
'
,
'
dpitch
'
,
'
droll
'
])
'
d
alpha_0
'
,
'
dalpha_1
'
,
'
dalpha_2
'
])
pos
=
self
.
mydb
.
read_posorient
(
rowid
=
1
)
pos
=
self
.
mydb
.
read_posorient
(
rowid
=
1
)
posorient_vel
.
loc
[[
'
x
'
,
'
y
'
,
'
z
'
]]
=
pos
.
loc
[[
'
x
'
,
'
y
'
,
'
z
'
]]
posorient_vel
.
loc
[[
'
x
'
,
'
y
'
,
'
z
'
]]
=
pos
.
loc
[[
'
x
'
,
'
y
'
,
'
z
'
]]
...
@@ -81,9 +81,9 @@ class TestNavipyMovingAgent(unittest.TestCase):
...
@@ -81,9 +81,9 @@ class TestNavipyMovingAgent(unittest.TestCase):
def
test_velocity_setter
(
self
):
def
test_velocity_setter
(
self
):
posorient_vel
=
pd
.
Series
(
data
=
np
.
random
.
rand
(
12
),
posorient_vel
=
pd
.
Series
(
data
=
np
.
random
.
rand
(
12
),
index
=
[
'
x
'
,
'
y
'
,
'
z
'
,
index
=
[
'
x
'
,
'
y
'
,
'
z
'
,
'
yaw
'
,
'
pitch
'
,
'
roll
'
,
'
alpha_0
'
,
'
alpha_1
'
,
'
alpha_2
'
,
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
d
yaw
'
,
'
dpitch
'
,
'
droll
'
])
'
d
alpha_0
'
,
'
dalpha_1
'
,
'
dalpha_2
'
])
agent
=
naviagent
.
Single
(
self
.
mydb
,
agent
=
naviagent
.
Single
(
self
.
mydb
,
posorient_vel
,
posorient_vel
,
memory_friendly
=
False
)
memory_friendly
=
False
)
...
@@ -96,15 +96,15 @@ class TestNavipyMovingAgent(unittest.TestCase):
...
@@ -96,15 +96,15 @@ class TestNavipyMovingAgent(unittest.TestCase):
def
test_angular_velocity
(
self
):
def
test_angular_velocity
(
self
):
posorient_vel
=
pd
.
Series
(
data
=
np
.
random
.
rand
(
12
),
posorient_vel
=
pd
.
Series
(
data
=
np
.
random
.
rand
(
12
),
index
=
[
'
x
'
,
'
y
'
,
'
z
'
,
index
=
[
'
x
'
,
'
y
'
,
'
z
'
,
'
yaw
'
,
'
pitch
'
,
'
roll
'
,
'
alpha_0
'
,
'
alpha_1
'
,
'
alpha_2
'
,
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
dx
'
,
'
dy
'
,
'
dz
'
,
'
d
yaw
'
,
'
dpitch
'
,
'
droll
'
])
'
d
alpha_0
'
,
'
dalpha_1
'
,
'
dalpha_2
'
])
agent
=
naviagent
.
Single
(
self
.
mydb
,
agent
=
naviagent
.
Single
(
self
.
mydb
,
posorient_vel
,
posorient_vel
,
memory_friendly
=
False
)
memory_friendly
=
False
)
agent
.
angular_velocity
=
posorient_vel
agent
.
angular_velocity
=
posorient_vel
self
.
assertTrue
(
self
.
assertTrue
(
posorient_vel
.
loc
[[
'
d
yaw
'
,
'
dpitch
'
,
'
droll
'
]].
equals
(
posorient_vel
.
loc
[[
'
d
alpha_0
'
,
'
dalpha_1
'
,
'
dalpha_2
'
]].
equals
(
agent
.
angular_velocity
),
agent
.
angular_velocity
),
'
angular velocity setter failed
'
)
'
angular velocity setter failed
'
)
...
@@ -182,10 +182,10 @@ class TestNavipyMovingAgent(unittest.TestCase):
...
@@ -182,10 +182,10 @@ class TestNavipyMovingAgent(unittest.TestCase):
# Two loops attractors
# Two loops attractors
graph_edges
=
list
()
graph_edges
=
list
()
for
snode
,
enode
in
zip
(
graph_nodes
[:
11
],
for
snode
,
enode
in
zip
(
graph_nodes
[:
11
],
np
.
roll
(
graph_nodes
[:
11
],
1
)):
np
.
alpha_2
(
graph_nodes
[:
11
],
1
)):
graph_edges
.
append
((
snode
,
enode
))
graph_edges
.
append
((
snode
,
enode
))
for
snode
,
enode
in
zip
(
graph_nodes
[
11
:],
for
snode
,
enode
in
zip
(
graph_nodes
[
11
:],
np
.
roll
(
graph_nodes
[
11
:],
1
)):
np
.
alpha_2
(
graph_nodes
[
11
:],
1
)):
graph_edges
.
append
((
snode
,
enode
))
graph_edges
.
append
((
snode
,
enode
))
graph
=
nx
.
DiGraph
()
graph
=
nx
.
DiGraph
()
...
...
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