-
Notifications
You must be signed in to change notification settings - Fork 0
/
rummy_nose_sim.cpp
130 lines (112 loc) · 3.16 KB
/
rummy_nose_sim.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include "rummy_simulation.hpp"
#include "stat/trajectory_stat.hpp"
#include "stat/clean_trajectory_stat.hpp"
#include "stat/kick_stat.hpp"
#include "stat/speed_stat.hpp"
#include "stat/pose_stat.hpp"
#include <iostream>
struct RummySimuParams : public simu::simulation::defaults::RummySimuParams {
};
struct RummyIndividualParams : public simu::simulation::defaults::RummyIndividualParams {
};
#define NUM_FISH 2
int main()
{
using namespace simu;
using namespace simulation;
using namespace stat;
// init simu
RummySimuParams params;
params.sim_time = 150000;
// params.timestep = 0.12;
params.timestep = 0.1;
params.num_fish = NUM_FISH;
RummySimulation sim(params);
// init indu params
RummyIndividualParams iparams;
if (NUM_FISH == 1) {
// interactions
iparams.perceived_agents = 0;
iparams.perceived_agents = 1;
iparams.gamma_rand = 0.3;
iparams.gamma_wall = 0.23;
iparams.gamma_sym = 0.;
iparams.gamma_asym = 0.;
iparams.dw = 6.;
iparams.dc = 0.7;
iparams.alpha_w = 0.;
iparams.gamma_attraction = 0.3;
iparams.gamma_alignment = 0.3;
// kicks
iparams.vmean = 43.;
iparams.vmin = 1.;
iparams.vmem = 0.9;
iparams.vmem12 = 0.0;
iparams.vcut = 30.;
iparams.taumean = 0.525;
iparams.taumin = 0.2;
iparams.tau0 = 0.8;
}
else if (NUM_FISH == 2) {
// interactions
iparams.perceived_agents = 1;
iparams.gamma_rand = 0.3;
iparams.gamma_wall = 0.23;
iparams.gamma_sym = 0.;
iparams.gamma_asym = 0.;
iparams.dw = 6.;
iparams.dc = 0.7;
iparams.alpha_w = 0.;
iparams.gamma_attraction = 0.3;
iparams.gamma_alignment = 0.3;
// kicks
iparams.vmean = 40.;
iparams.vmin = 1.;
iparams.vmem = 0.9;
iparams.vmem12 = 0.5;
iparams.vcut = 35.;
iparams.taumean = 0.525;
iparams.taumin = 0.2;
iparams.tau0 = 0.8;
}
else if (NUM_FISH == 5) {
// interactions
iparams.perceived_agents = 1;
iparams.gamma_rand = 0.3;
iparams.gamma_wall = 0.23;
iparams.gamma_sym = 0.;
iparams.gamma_asym = 0.;
iparams.dw = 6.;
iparams.dc = 1.0;
iparams.alpha_w = 0.;
iparams.gamma_attraction = 0.37;
iparams.gamma_alignment = 0.3;
// kicks
iparams.vmean = 43.;
iparams.vmin = 1.;
iparams.vmem = 0.9;
iparams.vmem12 = 0.5;
iparams.vcut = 34.;
iparams.taumean = 0.525;
iparams.taumin = 0.2;
iparams.tau0 = 0.8;
}
else {
#ifndef NUM_FISH
#warning "NUM_FISH not defined"
#endif
assert(false);
}
auto fish = sim.fish();
for (auto f : fish) {
f->params() = iparams;
}
// add stats
sim.add_stat(std::make_shared<TrajectoryStat>())
.add_stat(std::make_shared<CleanTrajectoryStat>())
.add_stat(std::make_shared<KickStat>())
.add_stat(std::make_shared<SpeedStat>())
.add_stat(std::make_shared<PoseStat>());
sim.spin();
return 0;
}