19 #include <core/sim/scene.h> 20 #include <core/sim/drone.h> 21 #include <core/properties.h> 32 PROPERTY(drone_x,
float, 0,
"Drone x coordinate");
33 PROPERTY(drone_y,
float, 0,
"Drone y coordinate");
34 PROPERTY(drone_vx,
float, 0,
"Drone velocity (x component)");
35 PROPERTY(drone_vy,
float, 0,
"Drone velocity (y component)");
36 PROPERTY(drone_dir,
float, 0,
"Heading angle");
37 PROPERTY(target_angle,
float, 0,
"Angle between drone direction and target");
42 explicit Scene(
const b2Vec2& target_velocity,
const DroneVision* domain);
44 const SceneVariables* variables()
const override {
return &variables_; }
46 const Config* config()
const override {
return &domain_->config(); }
48 Drone* drone() {
return drone_.get(); }
50 const DroneVision* domain()
const {
return domain_; }
53 float fitness()
const {
return fitness_; }
55 void postStep(
float dt)
override;
58 b2Body* createTarget(
const b2Vec2& pos,
const b2Vec2& v,
float radius);
60 void createRoundDebris(
const b2Vec2& pos,
float radius);
61 void createBoxDebris(
const b2Vec2& pos,
float width,
float height);
63 void createColumnFixture(b2Body* body,
const b2Vec2& pos,
const b2Color& color);
64 void createLight(b2Body* body,
const b2Vec2& pos,
const b2Color& color);
66 void updateVariables();
69 float aimAngle()
const;
72 b2Body* target_ =
nullptr;
74 unique_ptr<Drone> drone_;
75 SceneVariables variables_;
76 const DroneVision* domain_ =
nullptr;
77 default_random_engine rnd_{ random_device{}() };
High-level physics scene abstraction.
Definition: scene.h:42
Definition: domain.cpp:27
The foundation for data structures supporting runtime reflection.
Definition: properties.h:388