Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multiparty_interaction_simulator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Spring
WP6_Robot_Behavior
multiparty_interaction_simulator
Commits
cd2a6628
Commit
cd2a6628
authored
1 year ago
by
SANCHEZ Victor
Browse files
Options
Downloads
Patches
Plain Diff
little change in the measurement.py file
parent
3959ba01
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
mpi_sim/utils/measurements.py
+11
-4
11 additions, 4 deletions
mpi_sim/utils/measurements.py
with
11 additions
and
4 deletions
mpi_sim/utils/measurements.py
+
11
−
4
View file @
cd2a6628
...
...
@@ -71,24 +71,27 @@ def measure_distance(p1, p2, simulation=None):
if
simulation
is
None
:
raise
UserWarning
(
'
The distance measurement between an object and a position needs the simulation
'
)
# In case the object is given in firt or second position
if
isinstance
(
p1
,
mpi_sim
.
Object
)
:
_object
=
p1
point
=
p2
_
point
=
p2
else
:
_object
=
p2
point
=
p1
_
point
=
p1
distance
=
np
.
inf
point_a
=
None
point_b
=
None
# Creating an object to measure the distance from
fake_dot_obj
=
mpi_sim
.
objects
.
RoundTable
(
position
=
point
,
position
=
_
point
,
orientation
=
0
,
radius
=
0.000001
,
)
simulation
.
add_object
(
fake_dot_obj
)
# Measure the min distance for each bodies and each fixture
for
body_a
in
fake_dot_obj
.
box2d_bodies
:
for
fixture_a
in
body_a
.
fixtures
:
...
...
@@ -114,8 +117,12 @@ def measure_distance(p1, p2, simulation=None):
distance
=
b2_dist_info
.
distance
point_a
=
np
.
array
(
b2_dist_info
.
pointA
)
point_b
=
np
.
array
(
b2_dist_info
.
pointB
)
# Remove the fake object from simulation
simulation
.
remove_object
(
fake_dot_obj
)
# Correct the distance measurement w.r.t to its radius
distance
+=
0.000001
return
DistanceInfo
(
distance
,
point_a
,
point_b
)
...
...
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