Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OCSR
UMANS
Commits
7763be11
Commit
7763be11
authored
Apr 10, 2020
by
VAN TOLL Wouter
Browse files
Merge master into GUI
parents
f5beef8a
ab558227
Changes
8
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
7763be11
...
...
@@ -20,7 +20,7 @@
cmake_minimum_required
(
VERSION 2.8
)
project
(
UMANS
)
set
(
CMAKE_CXX_STANDARD 1
4
)
set
(
CMAKE_CXX_STANDARD 1
7
)
#set(EXECUTABLE_OUTPUT_PATH bin/${CMAKE_BUILD_TYPE})
...
...
@@ -51,7 +51,7 @@ endif (UMANS_USE_MULTITHREADING)
# === Linux compatibility compiler option
if
(
NOT MSVC
)
add_definitions
(
-
fPIC
)
add_definitions
(
-
O3 -lstdc++fs -fPIC -shared
)
endif
()
# === Engine project: a static library that performs the simulation
...
...
src/Engine/CostFunctions/FOEAvoidance.cpp
View file @
7763be11
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
�
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
...
...
src/Engine/CostFunctions/TtcaDca.cpp
View file @
7763be11
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
�
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
...
...
@@ -236,7 +236,7 @@ Vector2D TtcaDca::GetGradient(const Vector2D& velocity, Agent* agent, const Worl
GradS
+=
GradThS_movement
.
second
;
// clamp the change in angle
//GradTh = clamp(GradTh, -1.f, 1.f);
//GradTh = clamp
Vector
(GradTh, -1.f, 1.f);
Vector2D
Gradient
;
...
...
src/Engine/core/crowdSimulator.h
View file @
7763be11
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettré
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
�
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
...
...
@@ -62,7 +62,7 @@ public:
/// This affects whether or not the program will try to print progress information to the console.</param>
/// <returns>A pointer to new CrowdSimulator object, or nullptr if the loading failed for any reason.</returns>
static
CrowdSimulator
*
FromConfigFile
(
const
std
::
string
&
filename
,
bool
isConsoleApplication
);
/// <summary>Destroys this CrowdSimulator object.</summary>
~
CrowdSimulator
();
...
...
src/Engine/core/policy.cpp
View file @
7763be11
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettré
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
�
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
...
...
@@ -61,10 +61,10 @@ Vector2D Policy::ComputeNewVelocity(Agent* agent, WorldBase * world)
}
// clamp to a maximum acceleration
acceleration
=
clamp
(
acceleration
,
agent
->
getMaximumAcceleration
());
acceleration
=
clamp
Vector
(
acceleration
,
agent
->
getMaximumAcceleration
());
// use this to compute a new velocity, clamped to a maximum speed
return
clamp
(
currentVelocity
+
acceleration
*
dt
,
agent
->
getMaximumSpeed
());
return
clamp
Vector
(
currentVelocity
+
acceleration
*
dt
,
agent
->
getMaximumSpeed
());
}
Vector2D
Policy
::
getAccelerationFromGradient
(
Agent
*
agent
,
WorldBase
*
world
)
...
...
src/Engine/tools/vector2D.h
View file @
7763be11
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
�
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
...
...
@@ -238,7 +238,7 @@ inline bool isPointRightOfLine(const Vector2D& p, const Vector2D& la, const Vect
#pragma endregion
inline
Vector2D
clamp
(
const
Vector2D
&
v
,
float
maxLength
)
inline
Vector2D
clamp
Vector
(
const
Vector2D
&
v
,
float
maxLength
)
{
float
mag
=
v
.
magnitude
();
if
(
mag
<=
maxLength
)
...
...
src/Library/APIFunctions.cpp
View file @
7763be11
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettré
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
�
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
...
...
@@ -26,9 +26,12 @@
#include
<core/crowdSimulator.h>
#include
<algorithm>
#include
<omp.h>
#include
<cstring>
#include
<string>
#include
<clocale>
extern
"C"
{
extern
"C"
{
CrowdSimulator
*
cs
;
AgentData
*
agentData
;
size_t
agentDataSize
;
...
...
@@ -43,12 +46,17 @@ extern "C" {
API_FUNCTION
bool
StartSimulation
(
const
char
*
configFileName
,
int
numberOfThreads
)
{
std
::
setlocale
(
LC_NUMERIC
,
"en_US.UTF-8"
);
omp_set_num_threads
(
numberOfThreads
);
// initialize a new crowd simulation; we'll fill it with the contents of the given config file
cs
=
CrowdSimulator
::
FromConfigFile
(
configFileName
,
false
);
if
(
cs
==
nullptr
)
{
return
false
;
}
cs
->
GetWorld
()
->
SetNumberOfThreads
(
numberOfThreads
);
...
...
@@ -196,4 +204,4 @@ extern "C" {
return
true
;
}
}
\ No newline at end of file
}
src/Library/APIFunctions.h
View file @
7763be11
/* UMANS: Unified Microscopic Agent Navigation Simulator
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
é
** Copyright (C) 2018-2020 Inria Rennes Bretagne Atlantique - Rainbow - Julien Pettr
�
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
...
...
@@ -23,12 +23,11 @@
#ifdef WIN32
#define API_FUNCTION __declspec(dllexport)
#else
#define API_FUNCTION
__attribute__((visibility("default")))
#define API_FUNCTION
#endif
#endif
extern
"C"
{
extern
"C"
{
/// <summary>A struct that describes the status of a single agent in the simulation.
/// This struct is used for communication between the UMANS library and external applications.</summary>
struct
AgentData
...
...
@@ -52,7 +51,7 @@ extern "C"
/// <summary>Sets up a simulation based on a configuration file.
/// After this function call, the simulation will be ready for its first time step.</summary>
/// <returns>true if the operation was successful; false otherwise, e.g. if the configuration file is invalid.</returns>
API_FUNCTION
bool
StartSimulation
(
const
char
*
configFileName
,
int
nrThreads
);
API_FUNCTION
bool
StartSimulation
(
const
char
*
configFileName
,
int
nrThreads
);
/// <summary>Gets the step size of the simulation, in seconds.</summary>
/// <param ref="result_dt">[out] Will store the step size of the simulation.</param>
...
...
Write
Preview
Supports
Markdown
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