-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSimulator2d.hpp
More file actions
50 lines (39 loc) · 817 Bytes
/
Simulator2d.hpp
File metadata and controls
50 lines (39 loc) · 817 Bytes
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
#ifndef RAIC2018_SIMULATOR2D_HPP
#define RAIC2018_SIMULATOR2D_HPP
#include "Simulator.hpp"
struct Robot2d
{
P pos;
P vel;
Robot2d(){}
Robot2d(const MyRobot &r) {
vel = r.body.vel.xz();
pos = r.body.pos.xz();
}
void tick(P targetVel)
{
tick(targetVel, false);
}
void tickInv(P targetVel)
{
tick(targetVel, true);
}
private:
void tick(P targetVel, bool inv);
};
F computeDist(F vel, F targetVel, bool inv);
struct Trajectory2d
{
Robot2d robot2d;
std::vector<P> vel;
int flyT;
int nitroTicks = 0;
bool found = false;
P lastVel;
bool find(const P &targetPos, const P &targetVel, int targetT);
int len() const
{
return (int) vel.size() + flyT;
}
};
#endif //RAIC2018_SIMULATOR2D_HPP