19 #include <core/sim/scene.h> 20 #include <core/sim/car.h> 21 #include <core/sim/track.h> 22 #include <core/properties.h> 30 PROPERTY(car_x,
float, 0,
"Car x coordinate");
31 PROPERTY(car_y,
float, 0,
"Car y coordinate");
32 PROPERTY(car_vx,
float, 0,
"Car velocity (x component)");
33 PROPERTY(car_vy,
float, 0,
"Car velocity (y component)");
34 PROPERTY(car_dir,
float, 0,
"Heading angle");
35 PROPERTY(distance,
int, 0,
"Track distance from the start (one lap is 1.0)");
40 static constexpr
float kWidth = 50;
41 static constexpr
float kHeight = 20;
44 explicit Scene(
const sim::Track* track,
const CarTrack* domain);
46 const SceneVariables* variables()
const override {
return &variables_; }
48 const Config* config()
const override {
return &domain_->config(); }
50 sim::Car* car() {
return car_.get(); }
52 const sim::Track* track()
const {
return track_; }
54 const CarTrack* domain()
const {
return domain_; }
57 float fitness()
const;
59 void preStep()
override;
60 void postStep(
float dt)
override;
63 void updateVariables();
69 unique_ptr<sim::Car> car_;
71 SceneVariables variables_;
72 const sim::Track* track_ =
nullptr;
73 const CarTrack* domain_ =
nullptr;
High-level physics scene abstraction.
Definition: scene.h:42
Definition: domain.cpp:28
The foundation for data structures supporting runtime reflection.
Definition: properties.h:388