Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
JPScore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
92
Issues
92
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JuPedSim
JPScore
Commits
c9d3353a
Verified
Commit
c9d3353a
authored
Mar 04, 2017
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option for unit.
Some expertimens are in cm
parent
dfb7c8cb
Pipeline
#1910
passed with stages
in 5 minutes and 16 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
10 deletions
+30
-10
CHANGELOG.md
CHANGELOG.md
+4
-2
IO/PedDistributionParser.cpp
IO/PedDistributionParser.cpp
+2
-0
pedestrian/PedDistributor.cpp
pedestrian/PedDistributor.cpp
+9
-6
pedestrian/PedDistributor.h
pedestrian/PedDistributor.h
+1
-1
pedestrian/StartDistribution.cpp
pedestrian/StartDistribution.cpp
+10
-0
pedestrian/StartDistribution.h
pedestrian/StartDistribution.h
+4
-1
No files found.
CHANGELOG.md
View file @
c9d3353a
...
...
@@ -4,7 +4,9 @@ All notable changes to this project will be documented in this file.
## v0.8.2 [unreleased]
Repository moved to
[
new server
](
https://gitlab.version.fz-juelich.de/jupedsim/jpscore
)
### Added
-
New opstion for
`groups`
. It is now possible to load the first positions of peedestrians from a file.
Needed for better comparison with experiments. Use attribute:
`positions_dir="/path/to/directory/"`
`unit="cm"`
.
The unit of the trajectories can be specified. Default is meter.
### Changed
-
New Progressbar (ec7c9b0c)
...
...
@@ -118,4 +120,4 @@ First release of the the Juelich Pedestrian Simulator. Most noteworthy features:
-
Loading and visualizing trajectories and geometries
-
Easy to use visualization interface
-
Making high quality videos directly from the visualization interface or generating png sequences
-
XML based input files
\ No newline at end of file
-
XML based input files
IO/PedDistributionParser.cpp
View file @
c9d3353a
...
...
@@ -74,6 +74,7 @@ bool PedDistributionParser::LoadPedDistribution(vector<std::shared_ptr<StartDist
//double risk_tolerance_mean = xmltof(e->Attribute("risk_tolerance_mean"), 0);
//double risk_tolerance_sigma = xmltof(e->Attribute("risk_tolerance_sigma"), 0);
string
positions_dir
=
xmltoa
(
e
->
Attribute
(
"positions_dir"
),
""
);
string
unit_traj
=
xmltoa
(
e
->
Attribute
(
"unit"
),
"m"
);
double
x_min
=
xmltof
(
e
->
Attribute
(
"x_min"
),
-
FLT_MAX
);
double
x_max
=
xmltof
(
e
->
Attribute
(
"x_max"
),
FLT_MAX
);
double
y_min
=
xmltof
(
e
->
Attribute
(
"y_min"
),
-
FLT_MAX
);
...
...
@@ -103,6 +104,7 @@ bool PedDistributionParser::LoadPedDistribution(vector<std::shared_ptr<StartDist
dis
->
SetPatience
(
patience
);
dis
->
InitPremovementTime
(
premovement_mean
,
premovement_sigma
);
dis
->
SetPositionsDir
(
positions_dir
);
dis
->
SetUnitTraj
(
unit_traj
);
if
(
dis
->
GetPositionsDir
().
length
())
{
...
...
pedestrian/PedDistributor.cpp
View file @
c9d3353a
...
...
@@ -123,6 +123,7 @@ bool PedDistributor::Distribute(Building *building) const {
bool
fromDirectory
=
false
;
if
(
dist
->
GetPositionsDir
().
length
()){
string
directory
=
dist
->
GetPositionsDir
();
string
unit
=
dist
->
GetUnitTraj
();
fs
::
path
the_path
(
directory
);
if
(
fs
::
exists
(
directory
)
&&
fs
::
is_directory
(
directory
)){
fs
::
directory_iterator
it
(
the_path
),
eod
;
...
...
@@ -132,7 +133,7 @@ bool PedDistributor::Distribute(Building *building) const {
{
std
::
string
basename
=
fs
::
basename
(
p
);
std
::
string
extention
=
fs
::
extension
(
p
);
auto
tmpPositions
=
GetPositionsFromFile
(
p
.
string
(),
dist
->
GetAgentsNumber
());
auto
tmpPositions
=
GetPositionsFromFile
(
p
.
string
(),
dist
->
GetAgentsNumber
()
,
unit
);
//check if positions are
//empty. May happen if file
//is misformed.
...
...
@@ -413,7 +414,11 @@ vector<Point>PedDistributor::PositionsOnFixY(double min_x, double max_x, double
}
// format: id fr x y
const
vector
<
Point
>
PedDistributor
::
GetPositionsFromFile
(
std
::
string
filename
,
int
n
)
const
{
const
vector
<
Point
>
PedDistributor
::
GetPositionsFromFile
(
std
::
string
filename
,
int
n
,
std
::
string
unit
)
const
{
float
m2cm
=
1.0
;
if
(
unit
==
"cm"
)
m2cm
=
100.0
;
std
::
ifstream
infile
(
filename
);
// read all data from file in xpos, ypos, ids and frames
// @todo: need to read z too
...
...
@@ -422,8 +427,6 @@ const vector<Point> PedDistributor::GetPositionsFromFile(std::string filename,
std
::
vector
<
int
>
ids
;
std
::
vector
<
int
>
frames
;
// here we push_back only the first (x,y) of every id.
// std::vector<double> first_xpos;
// std::vector<double> first_ypos;
std
::
vector
<
Point
>
positions
;
std
::
vector
<
int
>
first_ids
;
if
(
infile
.
good
()){
...
...
@@ -438,8 +441,8 @@ const vector<Point> PedDistributor::GetPositionsFromFile(std::string filename,
boost
::
split
(
strs
,
sLine
,
boost
::
is_any_of
(
"
\t
"
));
id
=
atoi
(
strs
[
0
].
c_str
());
fr
=
atoi
(
strs
[
1
].
c_str
());
x
=
atof
(
strs
[
2
].
c_str
());
y
=
atof
(
strs
[
3
].
c_str
());
x
=
atof
(
strs
[
2
].
c_str
())
/
m2cm
;
y
=
atof
(
strs
[
3
].
c_str
())
/
m2cm
;
// @todo: check for z component. Some data don't have. Some do.
xpos
.
push_back
(
x
);
ypos
.
push_back
(
y
);
...
...
pedestrian/PedDistributor.h
View file @
c9d3353a
...
...
@@ -99,7 +99,7 @@ public:
* WARNING: It is assumed that positions should be in the corresponding room/subroom.
* checks with n if the file delivers the right number of peds
*/
const
vector
<
Point
>
GetPositionsFromFile
(
std
::
string
filename
,
int
n
)
const
;
const
vector
<
Point
>
GetPositionsFromFile
(
std
::
string
filename
,
int
n
,
std
::
string
unit
)
const
;
};
...
...
pedestrian/StartDistribution.cpp
View file @
c9d3353a
...
...
@@ -63,6 +63,7 @@ StartDistribution::StartDistribution(int seed)
_yMax
=
FLT_MAX
;
_groupParameters
=
NULL
;
_positions_dir
=
""
;
_unit_traj
=
"m"
;
static
bool
_seeded
=
false
;
// seed only once, not every time
if
(
!
_seeded
)
{
_generator
=
std
::
default_random_engine
(
seed
);
// mt19937 g(static_cast<uint32_t>(_configuration->GetSeed()));
...
...
@@ -399,3 +400,12 @@ const std::string& StartDistribution::GetPositionsDir() const
{
return
_positions_dir
;
}
void
StartDistribution
::
SetUnitTraj
(
const
std
::
string
&
unit
)
{
_unit_traj
=
unit
;
}
const
std
::
string
&
StartDistribution
::
GetUnitTraj
()
const
{
return
_unit_traj
;
}
pedestrian/StartDistribution.h
View file @
c9d3353a
...
...
@@ -53,7 +53,8 @@ private:
//demographic parameters
//TODO: should also follow a distribution, see _premovement
std
::
string
_gender
;
std
::
string
_positions_dir
;
// directory containing >=1 file(s) used to setup starting positions
std
::
string
_positions_dir
;
// directory containing >=1 file(s) used to setup starting positions
std
::
string
_unit_traj
;
//unit of traj from file
int
_age
;
int
_height
;
double
_patience
;
...
...
@@ -125,6 +126,8 @@ public:
double
GetRiskTolerance
();
void
SetPositionsDir
(
const
std
::
string
&
dir
);
const
std
::
string
&
GetPositionsDir
()
const
;
void
SetUnitTraj
(
const
std
::
string
&
unit
);
const
std
::
string
&
GetUnitTraj
()
const
;
Pedestrian
*
GenerateAgent
(
Building
*
building
,
int
*
pid
,
std
::
vector
<
Point
>&
positions
);
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment