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
11d6baf6
Commit
11d6baf6
authored
Feb 13, 2018
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop_with_airouter' into 'develop'
Develop with airouter See merge request
!16
parents
d60e398f
11b1da68
Pipeline
#6851
failed with stages
in 8 minutes and 18 seconds
Changes
38
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
5206 additions
and
31 deletions
+5206
-31
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
CMakeLists.txt
CMakeLists.txt
+79
-12
IO/IniFileParser.cpp
IO/IniFileParser.cpp
+72
-0
IO/IniFileParser.h
IO/IniFileParser.h
+2
-0
general/Configuration.h
general/Configuration.h
+11
-0
general/Macros.h
general/Macros.h
+25
-18
general/randomnumbergenerator.h
general/randomnumbergenerator.h
+30
-0
geometry/Room.cpp
geometry/Room.cpp
+34
-0
geometry/Room.h
geometry/Room.h
+9
-0
geometry/SubRoom.cpp
geometry/SubRoom.cpp
+4
-0
routing/ai_router/AIRouter.cpp
routing/ai_router/AIRouter.cpp
+298
-0
routing/ai_router/AIRouter.h
routing/ai_router/AIRouter.h
+113
-0
routing/ai_router/BrainStorage.cpp
routing/ai_router/BrainStorage.cpp
+383
-0
routing/ai_router/BrainStorage.h
routing/ai_router/BrainStorage.h
+92
-0
routing/ai_router/Cortex.cpp
routing/ai_router/Cortex.cpp
+554
-0
routing/ai_router/Cortex.h
routing/ai_router/Cortex.h
+65
-0
routing/ai_router/cognitiveMap/associations.cpp
routing/ai_router/cognitiveMap/associations.cpp
+61
-0
routing/ai_router/cognitiveMap/associations.h
routing/ai_router/cognitiveMap/associations.h
+26
-0
routing/ai_router/cognitiveMap/cognitivemap.cpp
routing/ai_router/cognitiveMap/cognitivemap.cpp
+679
-0
routing/ai_router/cognitiveMap/cognitivemap.h
routing/ai_router/cognitiveMap/cognitivemap.h
+87
-0
routing/ai_router/cognitiveMap/connection.cpp
routing/ai_router/cognitiveMap/connection.cpp
+53
-0
routing/ai_router/cognitiveMap/connection.h
routing/ai_router/cognitiveMap/connection.h
+35
-0
routing/ai_router/cognitiveMap/internnavigationnetwork.cpp
routing/ai_router/cognitiveMap/internnavigationnetwork.cpp
+184
-0
routing/ai_router/cognitiveMap/internnavigationnetwork.h
routing/ai_router/cognitiveMap/internnavigationnetwork.h
+62
-0
routing/ai_router/cognitiveMap/landmark.cpp
routing/ai_router/cognitiveMap/landmark.cpp
+198
-0
routing/ai_router/cognitiveMap/landmark.h
routing/ai_router/cognitiveMap/landmark.h
+82
-0
routing/ai_router/cognitiveMap/landmarknetwork.cpp
routing/ai_router/cognitiveMap/landmarknetwork.cpp
+258
-0
routing/ai_router/cognitiveMap/landmarknetwork.h
routing/ai_router/cognitiveMap/landmarknetwork.h
+52
-0
routing/ai_router/cognitiveMap/region.cpp
routing/ai_router/cognitiveMap/region.cpp
+112
-0
routing/ai_router/cognitiveMap/region.h
routing/ai_router/cognitiveMap/region.h
+46
-0
routing/ai_router/perception/cgalgeometry.cpp
routing/ai_router/perception/cgalgeometry.cpp
+268
-0
routing/ai_router/perception/cgalgeometry.h
routing/ai_router/perception/cgalgeometry.h
+53
-0
routing/ai_router/perception/sign.cpp
routing/ai_router/perception/sign.cpp
+83
-0
routing/ai_router/perception/sign.h
routing/ai_router/perception/sign.h
+50
-0
routing/ai_router/perception/visibleenvironment.cpp
routing/ai_router/perception/visibleenvironment.cpp
+234
-0
routing/ai_router/perception/visibleenvironment.h
routing/ai_router/perception/visibleenvironment.h
+40
-0
routing/ai_router/perception/visualsystem.cpp
routing/ai_router/perception/visualsystem.cpp
+684
-0
routing/ai_router/perception/visualsystem.h
routing/ai_router/perception/visualsystem.h
+87
-0
No files found.
.gitlab-ci.yml
View file @
11d6baf6
...
...
@@ -29,7 +29,7 @@ configure-linux:
script
:
-
mkdir -p build
-
cd build
-
cmake -DBUILD_TESTING=ON -DBoost_NO_SYSTEM_PATHS=true -DBOOST_ROOT=~/boost_1_61_0 ..
-
cmake -DBUILD_TESTING=ON -DBoost_NO_SYSTEM_PATHS=true -DBOOST_ROOT=~/boost_1_61_0
-DCGAL_DIR=~/cgal/build
..
-
echo "configure | ${CI_PROJECT_DIR}"
stage
:
configure
tags
:
...
...
CMakeLists.txt
View file @
11d6baf6
...
...
@@ -36,12 +36,6 @@ endif ()
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
warnings
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
warnings
}
"
)
# TODO clean up. no flags.
#set(CMAKE_CXX_STANDARD 11)
#set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_EXTENSIONS OFF)
if
(
NOT BUILD_TESTING
)
set
(
BUILD_TESTING OFF
)
# test units & python tests are not generated.
endif
(
NOT BUILD_TESTING
)
...
...
@@ -204,6 +198,9 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
#boost
find_package
(
Boost COMPONENTS timer chrono system filesystem unit_test_framework REQUIRED
)
#CGAL
find_package
(
CGAL REQUIRED
)
# test all cpp-files in Utest
if
(
BUILD_TESTING OR BUILD_CPPUNIT_TEST
)
...
...
@@ -313,7 +310,7 @@ set(source_files
#quickest
routing/quickest/QuickestPathRouter.cpp
#
AI
router
#
Smoke
router
routing/smoke_router/SmokeRouter.cpp
routing/smoke_router/GraphNetwork.cpp
routing/smoke_router/NavigationGraph.cpp
...
...
@@ -339,6 +336,24 @@ set(source_files
routing/smoke_router/cognitiveMap/internnavigationnetwork.cpp
visiLibity/source_code/visilibity.cpp
#AI router
routing/ai_router/AIRouter.cpp
routing/ai_router/BrainStorage.cpp
routing/ai_router/cognitiveMap/associations.cpp
routing/ai_router/cognitiveMap/connection.cpp
routing/ai_router/cognitiveMap/cognitivemap.cpp
routing/ai_router/cognitiveMap/landmark.cpp
routing/ai_router/cognitiveMap/region.cpp
routing/ai_router/cognitiveMap/landmarknetwork.cpp
routing/ai_router/cognitiveMap/internnavigationnetwork.cpp
routing/ai_router/perception/visualsystem.cpp
routing/ai_router/perception/visibleenvironment.cpp
routing/ai_router/perception/cgalgeometry.cpp
routing/ai_router/perception/sign.cpp
routing/ai_router/Cortex.cpp
poly2tri/common/shapes.cpp
poly2tri/sweep/sweep_context.cpp
poly2tri/sweep/advancing_front.cpp
...
...
@@ -385,7 +400,7 @@ set(header_files
#quickest
routing/quickest/QuickestPathRouter.h
#
AI
router
#
Smoke
router
routing/smoke_router/SmokeRouter.h
routing/smoke_router/GraphNetwork.h
routing/smoke_router/NavigationGraph.h
...
...
@@ -411,6 +426,23 @@ set(header_files
routing/smoke_router/cognitiveMap/internnavigationnetwork.h
visiLibity/source_code/visilibity.hpp
#AI router
routing/ai_router/AIRouter.h
routing/ai_router/BrainStorage.h
routing/ai_router/cognitiveMap/associations.h
routing/ai_router/cognitiveMap/connection.cpp
routing/ai_router/cognitiveMap/cognitivemap.h
routing/ai_router/cognitiveMap/landmark.h
routing/ai_router/cognitiveMap/region.h
routing/ai_router/cognitiveMap/landmarknetwork.h
routing/ai_router/cognitiveMap/internnavigationnetwork.h
routing/ai_router/perception/visualsystem.h
routing/ai_router/perception/visibleenvironment.h
routing/ai_router/perception/cgalgeometry.h
routing/ai_router/perception/sign.h
routing/ai_router/Cortex.h
pedestrian/Pedestrian.h
pedestrian/PedDistributor.h
pedestrian/Ellipse.h
...
...
@@ -432,6 +464,7 @@ set(header_files
general/ArgumentParser.h
general/Macros.h
general/randomnumbergenerator.h
geometry/Crossing.h
geometry/NavLine.h
...
...
@@ -483,12 +516,14 @@ set(header_files
)
add_library
(
core STATIC
${
source_files
}
)
find_package
(
ZLIB REQUIRED
)
include_directories
(
${
ZLIB_INCLUDE_DIRS
}
)
add_library
(
cnpy SHARED
"cnpy/cnpy.cpp"
)
target_link_libraries
(
cnpy
${
ZLIB_LIBRARIES
}
)
#add_library ( core SHARED ${source_files} )
#Target
...
...
@@ -507,19 +542,51 @@ if (Boost_FOUND)
# suppress warnings in boost libraries with attribute SYSTEM
include_directories
(
SYSTEM
${
Boost_INCLUDE_DIR
}
)
# todo: is this necessary?
target_link_libraries
(
core
${
Boost_LIBRARIES
}
cnpy
)
endif
()
if
(
GMP_FOUND
)
message
(
STATUS
"GMP FOUND: "
${
GMP_FOUND
}
)
message
(
STATUS
"GMP_LIBRARY: "
${
GMP_LIBRARIES
}
)
message
(
STATUS
"GMP_INCLUDE_DIR: "
${
GMP_INCLUDE_DIR
}
)
include_directories
(
SYSTEM
${
GMP_INCLUDE_DIR
}
)
endif
()
if
(
MPFR_FOUND
)
message
(
STATUS
"MPFR FOUND: "
${
MPFR_FOUND
}
)
message
(
STATUS
"MPFR_LIBRARY: "
${
MPFR_LIBRARIES
}
)
message
(
STATUS
"MPFR_INCLUDE_DIR: "
${
MPFR_INCLUDE_DIR
}
)
include_directories
(
SYSTEM
${
MPFR_INCLUDE_DIR
}
)
#target_link_libraries(jpscore ${MPFR_LIBRARIES})
endif
()
if
(
CGAL_FOUND
)
message
(
STATUS
"CGAL FOUND: "
${
CGAL_FOUND
}
)
message
(
STATUS
"CGAL_LIBRARY_DIRS: "
${
CGAL_LIBRARIES_DIR
}
)
message
(
STATUS
"CGAL_INCLUDE_DIRS: "
${
CGAL_INCLUDE_DIRS
}
)
#message(STATUS "CGAL_LIB_VERSION: " ${CGAL_LIB_VERSION})
message
(
STATUS
"CGAL_libraries: "
${
CGAL_LIBRARY
}
)
#link_directories(${CGAL_LIBRARIES_DIR})
#link_directories(${)
include_directories
(
SYSTEM
${
CGAL_INCLUDE_DIRS
}
)
#message(STATUS "CGAL_3rdparty" ${CGAL_3RD_PARTY_LIBRARIES})
#target_link_libraries(jpscore ${CGAL_LIBRARIES})
endif
()
target_link_libraries
(
jpscore core
)
if
(
WIN32
)
target_link_libraries
(
jpscore core wsock32
)
endif
(
WIN32
)
# if(CGAL_FOUND)
# target_link_libraries (jpscore ${CGAL_CORE_LIBRARY})
# endif(CGAL_FOUND)
target_link_libraries
(
jpscore
${
GMP_LIBRARIES
}
${
MPFR_LIBRARIES
}
${
CGAL_LIBRARY
}
${
CGAL_3RD_PARTY_LIBRARIES
}
)
##if (JPS_AS_A_SERVICE)
#find_package(Protobuf REQUIRED)
...
...
IO/IniFileParser.cpp
View file @
11d6baf6
...
...
@@ -42,6 +42,7 @@
#include "../routing/global_shortest/GlobalRouter.h"
#include "../routing/quickest/QuickestPathRouter.h"
#include "../routing/smoke_router/SmokeRouter.h"
#include "../routing/ai_router/AIRouter.h"
#include "../routing/ff_router/ffRouter.h"
IniFileParser
::
IniFileParser
(
Configuration
*
config
)
...
...
@@ -1101,6 +1102,16 @@ bool IniFileParser::ParseRoutingStrategies(TiXmlNode* routingNode, TiXmlNode* ag
if
(
!
ParseCogMapOpts
(
e
))
return
false
;
}
else
if
((
strategy
==
"AI"
)
&&
(
std
::
find
(
usedRouter
.
begin
(),
usedRouter
.
end
(),
id
)
!=
usedRouter
.
end
())
)
{
Router
*
r
=
new
AIRouter
(
id
,
ROUTING_AI
);
_config
->
GetRoutingEngine
()
->
AddRouter
(
r
);
Log
->
Write
(
"
\n
INFO:
\t
Using AIRouter"
);
///Parsing additional options
if
(
!
ParseAIOpts
(
e
))
return
false
;
}
else
if
((
strategy
==
"ff_global_shortest"
)
&&
(
std
::
find
(
usedRouter
.
begin
(),
usedRouter
.
end
(),
id
)
!=
usedRouter
.
end
())
)
{
//pRoutingStrategies.push_back(make_pair(id, ROUTING_FF_GLOBAL_SHORTEST));
...
...
@@ -1242,6 +1253,67 @@ bool IniFileParser::ParseCogMapOpts(TiXmlNode* routingNode)
return
true
;
}
bool
IniFileParser
::
ParseAIOpts
(
TiXmlNode
*
routingNode
)
{
TiXmlNode
*
sensorNode
=
routingNode
->
FirstChild
();
if
(
!
sensorNode
)
{
Log
->
Write
(
"ERROR:
\t
No sensors found.
\n
"
);
return
false
;
}
/// static_cast to get access to the method 'addOption' of the AIRouter
AIRouter
*
r
=
static_cast
<
AIRouter
*>
(
_config
->
GetRoutingEngine
()
->
GetAvailableRouters
().
back
());
std
::
vector
<
std
::
string
>
sensorVec
;
for
(
TiXmlElement
*
e
=
sensorNode
->
FirstChildElement
(
"sensor"
);
e
;
e
=
e
->
NextSiblingElement
(
"sensor"
))
{
string
sensor
=
e
->
Attribute
(
"description"
);
sensorVec
.
push_back
(
sensor
);
Log
->
Write
(
"INFO:
\t
Sensor <%s> added."
,
sensor
.
c_str
());
}
r
->
addOption
(
"Sensors"
,
sensorVec
);
TiXmlElement
*
cogMap
=
routingNode
->
FirstChildElement
(
"cognitive_map"
);
if
(
!
cogMap
)
{
Log
->
Write
(
"ERROR:
\t
Cognitive Map not specified.
\n
"
);
return
false
;
}
//std::vector<std::string> cogMapStatus;
//cogMapStatus.push_back(cogMap->Attribute("status"));
//Log->Write("INFO: \tAll pedestrian starting with a(n) %s cognitive maps", cogMapStatus[0].c_str());
//r->addOption("CognitiveMap", cogMapStatus);
std
::
vector
<
std
::
string
>
cogMapFiles
;
if
(
!
cogMap
->
Attribute
(
"files"
))
{
Log
->
Write
(
"WARNING:
\t
No input files for the cognitive map specified!"
);
}
else
{
cogMapFiles
.
push_back
(
cogMap
->
Attribute
(
"files"
));
r
->
addOption
(
"CognitiveMapFiles"
,
cogMapFiles
);
}
//Signs
TiXmlElement
*
signs
=
routingNode
->
FirstChildElement
(
"signage"
);
if
(
!
signs
)
{
Log
->
Write
(
"INFO:
\t
No signage specified"
);
}
else
{
r
->
addOption
(
"SignFiles"
,
std
::
vector
<
std
::
string
>
{
signs
->
Attribute
(
"file"
)});
}
return
true
;
}
bool
IniFileParser
::
ParseLinkedCells
(
const
TiXmlNode
&
linkedCellNode
)
{
if
(
linkedCellNode
.
FirstChild
(
"linkedcells"
))
{
...
...
IO/IniFileParser.h
View file @
11d6baf6
...
...
@@ -62,6 +62,8 @@ private:
bool
ParseCogMapOpts
(
TiXmlNode
*
routingNode
);
bool
ParseAIOpts
(
TiXmlNode
*
routingNode
);
bool
ParseLinkedCells
(
const
TiXmlNode
&
linkedCellNode
);
bool
ParseStepSize
(
TiXmlNode
&
stepNode
);
...
...
general/Configuration.h
View file @
11d6baf6
...
...
@@ -37,6 +37,10 @@
#include "../math/OperationalModel.h"
#include "../JPSfire/B_walking_speed/WalkingSpeed.h"
#include "../JPSfire/C_toxicity_analysis/ToxicityAnalysis.h"
//for random numbers
#include "randomnumbergenerator.h"
//This class provides a data container for all configuration parameters.
class
AgentsParameters
;
...
...
@@ -114,6 +118,9 @@ public:
//ff router
_has_specific_goals
=
false
;
_write_VTK_files
=
false
;
//for random numbers
_rdGenerator
=
RandomNumberGenerator
();
}
std
::
shared_ptr
<
WalkingSpeed
>
GetWalkingSpeed
()
{
return
_walkingSpeed
;
};
void
SetWalkingSpeed
(
std
::
shared_ptr
<
WalkingSpeed
>
&
w
)
{
_walkingSpeed
=
w
;
};
...
...
@@ -302,6 +309,8 @@ public:
void
AddAgentsParameters
(
std
::
shared_ptr
<
AgentsParameters
>
agentsParameters
,
int
id
)
{
_agentsParameters
[
id
]
=
agentsParameters
;
};
RandomNumberGenerator
*
GetRandomNumberGenerator
()
const
{
return
&
_rdGenerator
;};
#ifdef _JPS_AS_A_SERVICE
const
bool
GetRunAsService
()
const
{
return
_runAsService
;
};
...
...
@@ -382,6 +391,8 @@ private:
std
::
string
_projectRootDir
;
bool
_showStatistics
;
mutable
RandomNumberGenerator
_rdGenerator
;
FileFormat
_fileFormat
;
std
::
map
<
int
,
std
::
shared_ptr
<
AgentsParameters
>
>
_agentsParameters
;
#ifdef _JPS_AS_A_SERVICE
...
...
general/Macros.h
View file @
11d6baf6
...
...
@@ -95,6 +95,12 @@
// Not-a-Number (NaN)
#define J_NAN std::numeric_limits<double>::quiet_NaN()
//update rate for AI router
#ifndef AI_UPDATE_RATE
#define AI_UPDATE_RATE 5.0 //fps
#endif
enum
RoomState
{
ROOM_CLEAN
=
0
,
ROOM_SMOKED
=
1
...
...
@@ -121,6 +127,7 @@ enum RoutingStrategy {
ROUTING_QUICKEST
,
ROUTING_FROM_FILE
,
ROUTING_SMOKE
,
ROUTING_AI
,
ROUTING_FLOORFIELD
,
ROUTING_FF_GLOBAL_SHORTEST
,
ROUTING_FF_LOCAL_SHORTEST
,
...
...
@@ -297,31 +304,31 @@ inline void ReplaceStringInPlace(std::string& subject, const std::string& search
//**************************************************************
//Text attributes
#define OFF
0 //All attributes off
#define BRIGHT
1 //Bold on
#define OFF 0 //All attributes off
#define BRIGHT 1 //Bold on
// 4 Underscore (on monochrome display adapter only)
#define BLINK
5 //Blink on
#define BLINK 5 //Blink on
// 7 Reverse video on
// 8 Concealed on
// Foreground colors
#define
BLACK
30
#define
CYAN
36
#define
WHITE
37
#define
RED
31
#define
GREEN
32
#define
YELLOW
33
#define
BLUE
34
#define
MAGENTA
35
#define
JPS_BLACK
30
#define
JPS_CYAN
36
#define
JPS_WHITE
37
#define
JPS_RED
31
#define
JPS_GREEN
32
#define
JPS_YELLOW
33
#define
JPS_BLUE
34
#define
JPS_MAGENTA
35
// Background colors
#define
BG_BLACK
40
#define
BG_RED
41
#define
BG_GREEN
42
#define BG_YELLOW 43
#define
BG_BLUE
44
#define
BG_CYAN
47
#define
BG_WHITE
47
#define
JPS_BG_BLACK
40
#define
JPS_BG_RED
41
#define
JPS_BG_GREEN
42
#define
JPS_
BG_YELLOW 43
#define
JPS_BG_BLUE
44
#define
JPS_BG_CYAN
47
#define
JPS_BG_WHITE
47
// Special caracters
#define HOME printf("\033[1;1H"); // cursor up left
...
...
general/randomnumbergenerator.h
0 → 100644
View file @
11d6baf6
#ifndef RANDOMNUMBERGENERATOR_H
#define RANDOMNUMBERGENERATOR_H
#include <random>
class
RandomNumberGenerator
{
public:
//Engine and distribution with random seed
explicit
RandomNumberGenerator
(){
std
::
random_device
rd
;
_randomEngine
=
std
::
mt19937
(
rd
());
_rdDistribution
=
std
::
uniform_real_distribution
<
double
>
(
0
,
1
);}
//Engine and distribution with specific seed
explicit
RandomNumberGenerator
(
int
seed
)
:
_randomEngine
(
std
::
mt19937
(
seed
)),
_rdDistribution
(
std
::
uniform_real_distribution
<
double
>
(
0
,
1
)){}
double
GetRandomRealBetween0and1
(){
return
_rdDistribution
(
_randomEngine
);}
std
::
mt19937
&
GetRandomEngine
(){
return
_randomEngine
;}
void
SetSeed
(
int
seed
){
_randomEngine
=
std
::
mt19937
(
seed
);}
private:
std
::
mt19937
_randomEngine
;
std
::
uniform_real_distribution
<
double
>
_rdDistribution
;
};
#endif // RANDOMNUMBERGENERATOR_H
geometry/Room.cpp
View file @
11d6baf6
...
...
@@ -28,6 +28,10 @@
#include "Room.h"
#include "SubRoom.h"
#include "../IO/OutputHandler.h"
#include <sstream>
#include <memory>
using
namespace
std
;
...
...
@@ -190,6 +194,36 @@ void Room::SetOutputHandler(OutputHandler* oh)
_outputFile
=
oh
;
}
std
::
vector
<
Point
>
Room
::
GetBoundaryVertices
()
const
{
double
xMin
=
FLT_MAX
;
double
yMin
=
FLT_MAX
;
double
xMax
=-
FLT_MAX
;
double
yMax
=-
FLT_MAX
;
for
(
auto
&&
itr_subroom
:
this
->
GetAllSubRooms
())
{
const
std
::
vector
<
Point
>
vertices
=
itr_subroom
.
second
->
GetPolygon
();
for
(
Point
point
:
vertices
)
{
if
(
point
.
_x
>
xMax
)
xMax
=
point
.
_x
;
if
(
point
.
_x
<
xMin
)
xMin
=
point
.
_x
;
if
(
point
.
_y
>
yMax
)
yMax
=
point
.
_y
;
if
(
point
.
_y
<
yMin
)
yMin
=
point
.
_y
;
}
}
return
std
::
vector
<
Point
>
{
Point
(
xMin
,
yMin
),
Point
(
xMin
,
yMax
),
Point
(
xMax
,
yMax
),
Point
(
xMax
,
yMin
)};
}
OutputHandler
*
Room
::
GetOutputHandler
()
const
{
return
_outputFile
;
...
...
geometry/Room.h
View file @
11d6baf6
...
...
@@ -32,6 +32,7 @@
#include <algorithm>
#include <memory>
#include "../general/Macros.h"
#include "../geometry/Point.h"
//forward declarations
class
OutputHandler
;
...
...
@@ -147,6 +148,14 @@ public:
*/
void
AddTransitionID
(
int
ID
);
/**
* @return Vector with the vertices of the geometry's outer boundary rect
*/
std
::
vector
<
Point
>
GetBoundaryVertices
()
const
;
/**
* Debug output for this class
*/
...
...
geometry/SubRoom.cpp
View file @
11d6baf6
...
...
@@ -32,11 +32,15 @@
#include "Obstacle.h"
#include "SubRoom.h"
#include "Transition.h"
#include "Hline.h"
#ifdef _SIMULATOR
#include "../pedestrian/Pedestrian.h"
#endif //_SIMULATOR
#include <cmath>
using
namespace
std
;
/************************************************************
...
...
routing/ai_router/AIRouter.cpp
0 → 100644
View file @
11d6baf6
/**
* \file AIRouter.cpp
* \date Feb 1, 2014
* \version v0.7
* \copyright <2009-2015> Forschungszentrum Jülich GmbH. All rights reserved.
*
* \section License
* This file is part of JuPedSim.
*
* JuPedSim is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* JuPedSim is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with JuPedSim. If not, see <http://www.gnu.org/licenses/>.
*
* \section Description
*
*
**/
#include "AIRouter.h"
#include "../Router.h"
#include "BrainStorage.h"
#include "./cognitiveMap/cognitivemap.h"
//#include "NavigationGraph.h"
//#include "./sensor/SensorManager.h"
#include "../../geometry/SubRoom.h"
#include "../../geometry/NavLine.h"
#include "../../geometry/Building.h"
#include "../../pedestrian/Pedestrian.h"
#include "../../tinyxml/tinyxml.h"
AIRouter
::
AIRouter
()
{
building
=
nullptr
;
// cm_storage=nullptr;
//sensor_manager=nullptr;
}
AIRouter
::
AIRouter
(
int
id
,
RoutingStrategy
s
)
:
Router
(
id
,
s
)
{
building
=
nullptr
;
// cm_storage=nullptr;
//sensor_manager=nullptr;
}
AIRouter
::~
AIRouter
()
{
//delete brain_storage;
//delete sensor_manager;
}
int
AIRouter
::
FindExit
(
Pedestrian
*
p
)
{
if
(
std
::
fmod
(
std
::
roundf
(
p
->
GetGlobalTime
()
*
100
),
std
::
roundf
(
1.0
/
AI_UPDATE_RATE
*
100
))
==
0.0
)
// && p->GetGlobalTime()>0)
{
//Log->Write(std::to_string(p->GetGlobalTime()));
//sensor_manager->execute(p, SensorManager::PERIODIC);
int
status
=
FindDestination
(
p
);
//(*cm_storage)[p]->UpdateSubRoom();
return
status
;
}
return
1
;
}
int
AIRouter
::
FindDestination
(
Pedestrian
*
p
)
{
// Discover doors
//sensor_manager->execute(p, SensorManager::NO_WAY);
//check if there is a way to the outside the pedestrian knows (in the cognitive map)
//--------------------COGMAP----------------------------
//Update isovists
(
*
brain_storage
)[
p
]
->
GetPerceptionAbilities
().
UpdateCurrentEnvironment
();
(
*
brain_storage
)[
p
]
->
GetPerceptionAbilities
().
UpdateSeenEnv
();
// update cogmap
(
*
brain_storage
)[
p
]
->
GetCognitiveMap
().
UpdateMap
();
//Find next appropriate landmark
(
*
brain_storage
)[
p
]
->
GetCognitiveMap
().
FindNextTarget
();
// find possible crossings in seenEnvironment e.g. to proceed to landmark
std
::
vector
<
NavLine
>
navLines
=
(
*
brain_storage
)[
p
]
->
GetPerceptionAbilities
().
GetPossibleNavLines
(
(
*
brain_storage
)[
p
]
->
GetPerceptionAbilities
().
GetSeenEnvironmentAsPointVec
(
building
->
GetRoom
(
p
->
GetRoomID
())));
NavLine
nextNvLine
=
(
*
brain_storage
)[
p
]
->
FindApprCrossing
(
navLines
);
// std::ofstream myfile2;
// std::string str2 = "./isovists/navLinesBefore_pos"+std::to_string(p->GetID())+"_"+std::to_string((int)(std::round(p->GetGlobalTime()*100)))+".txt";
// myfile2.open (str2);
// myfile2 << std::to_string(nextNvLine.GetCentre()._x) << " " << std::to_string(nextNvLine.GetCentre()._y) << std::endl;
// myfile2.close();
// find possible crossings in currentEnv to proceed to nextNvLine
navLines
=
(
*
brain_storage
)[
p
]
->
GetPerceptionAbilities
().
GetPossibleNavLines
(
(
*
brain_storage
)[
p
]
->
GetPerceptionAbilities
().
GetCurrentEnvironmentAsPointVec
());
//Find appropriate visible crossing to reach next app. landmark
nextNvLine
=
(
*
brain_storage
)[
p
]
->
FindApprVisibleCrossing
(
nextNvLine
,
navLines
);
// std::ofstream myfile;
// std::string str = "./isovists/navLines_pos"+std::to_string(p->GetID())+"_"+std::to_string((int)(std::round(p->GetGlobalTime()*100)))+".txt";
// myfile.open (str);
// myfile << std::to_string(nextNvLine.GetCentre()._x) << " " << std::to_string(nextNvLine.GetCentre()._y) << std::endl;
// myfile.close();
p
->
SetExitLine
(
&
nextNvLine
);
return
1
;
}
bool
AIRouter
::
Init
(
Building
*
b
)
{
Log
->
Write
(
"INFO:
\t
Init the Cognitive Map Router Engine"
);
building
=
b
;
LoadRoutingInfos
(
GetRoutingInfoFile
());