Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
JPScore
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JuPedSim
JPScore
Commits
298c22dd
Commit
298c22dd
authored
Jul 17, 2019
by
Ben Hein
Browse files
Options
Downloads
Patches
Plain Diff
disable direction model and introduce basic noise
parent
fa6cc5a9
No related branches found
No related tags found
No related merge requests found
Pipeline
#22458
failed
Jul 17, 2019
Stage: configure
Stage: compile
Stage: unit_test
Stage: dev_test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
math/VelocityModel.cpp
+32
-2
32 additions, 2 deletions
math/VelocityModel.cpp
with
32 additions
and
2 deletions
math/VelocityModel.cpp
+
32
−
2
View file @
298c22dd
...
@@ -249,7 +249,35 @@ void VelocityModel::ComputeNextTimeStep(double current, double deltaT, Building*
...
@@ -249,7 +249,35 @@ void VelocityModel::ComputeNextTimeStep(double current, double deltaT, Building*
Point
repWall
=
ForceRepRoom
(
allPeds
[
p
],
subroom
);
Point
repWall
=
ForceRepRoom
(
allPeds
[
p
],
subroom
);
// calculate new direction ei according to (6)
// calculate new direction ei according to (6)
Point
direction
=
e0
(
ped
,
room
)
+
repPed
+
repWall
;
//Point direction = e0(ped, room) + repPed + repWall;
Point
direction
=
e0
(
ped
,
room
);
//std::cout << "e0:" << direction._x << direction._y << std::endl;
// generate random angle
const
double
min_angle
=
0
;
const
double
max_angle
=
30
;
std
::
random_device
rd
;
std
::
mt19937
eng
(
rd
());
std
::
uniform_int_distribution
<>
distr
(
min_angle
,
max_angle
);
Point
noise
=
Point
(
sin
(
2
*
3.14159
*
distr
(
eng
)
/
360
),
sin
(
2
*
3.14159
*
distr
(
eng
)
/
360
));
direction
=
direction
+
noise
;
// Define random generator with Gaussian distribution
//const double mean = 0.0;
//const double stddev = 0.4;
//std::default_random_engine generator;
//std::normal_distribution<double> white_noise(mean, stddev);
// Add Gaussian noise
//std::cout << "old:" << direction._x << direction._y << std::endl;
//direction._x = direction._x + white_noise(generator);
//direction._y = direction._y + white_noise(generator);
//direction = direction.Normalized();
//std::cout << "new:" << direction._x << direction._y << std::endl;
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
for
(
int
i
=
0
;
i
<
size
;
i
++
)
{
Pedestrian
*
ped1
=
neighbours
[
i
];
Pedestrian
*
ped1
=
neighbours
[
i
];
// calculate spacing
// calculate spacing
...
@@ -380,6 +408,7 @@ Point VelocityModel::e0(Pedestrian* ped, Room* room) const
...
@@ -380,6 +408,7 @@ Point VelocityModel::e0(Pedestrian* ped, Room* room) const
(
dynamic_cast
<
DirectionSubLocalFloorfield
*>
(
_direction
.
get
()))
)
{
(
dynamic_cast
<
DirectionSubLocalFloorfield
*>
(
_direction
.
get
()))
)
{
desired_direction
=
target
-
pos
;
desired_direction
=
target
-
pos
;
if
(
desired_direction
.
NormSquare
()
<
0.25
)
{
if
(
desired_direction
.
NormSquare
()
<
0.25
)
{
//if (desired_direction.NormSquare() < 0.05) {
desired_direction
=
lastE0
;
desired_direction
=
lastE0
;
ped
->
SetLastE0
(
lastE0
);
ped
->
SetLastE0
(
lastE0
);
// Log->Write("desired_direction: %f %f", desired_direction._x, desired_direction._y);
// Log->Write("desired_direction: %f %f", desired_direction._x, desired_direction._y);
...
@@ -409,7 +438,8 @@ Point VelocityModel::e0(Pedestrian* ped, Room* room) const
...
@@ -409,7 +438,8 @@ Point VelocityModel::e0(Pedestrian* ped, Room* room) const
double
VelocityModel
::
OptimalSpeed
(
Pedestrian
*
ped
,
double
spacing
)
const
double
VelocityModel
::
OptimalSpeed
(
Pedestrian
*
ped
,
double
spacing
)
const
{
{
double
v0
=
ped
->
GetV0Norm
();
double
v0
=
ped
->
GetV0Norm
();
double
T
=
ped
->
GetT
();
//double T = ped->GetT();
double
T
=
1.0
;
double
l
=
2
*
ped
->
GetEllipse
().
GetBmax
();
//assume peds are circles with const radius
double
l
=
2
*
ped
->
GetEllipse
().
GetBmax
();
//assume peds are circles with const radius
double
speed
=
(
spacing
-
l
)
/
T
;
double
speed
=
(
spacing
-
l
)
/
T
;
speed
=
(
speed
>
0
)
?
speed
:
0
;
speed
=
(
speed
>
0
)
?
speed
:
0
;
...
...
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