#ifndef CHEETAH_SOFTWARE_GRAPHSEARCH_H #define CHEETAH_SOFTWARE_GRAPHSEARCH_H #include #include "cppTypes.h" struct ContactState { union { bool contact[4]; struct { bool fr, fl, rr, rl; }; }; ContactState(bool _fr, bool _fl, bool _rr, bool _rl) { fr = _fr; fl = _fl; rr = _rr; rl = _rl; } ContactState() { } }; struct DefaultGaits { std::vector trotting, standing; }; struct InputTrajectoryState { Vec2 p; Vec2 v; float theta; }; struct FootplanFootState { Vec2 p; bool contact; float stateTime; }; struct FootplanState { float t; Vec2 pBase; FootplanFootState feet[4]; }; struct FootplanStats { u64 nodesVisited; u64 maxMemory; FootplanStats() { reset(); } void reset() { nodesVisited = 0; maxMemory = 0; } }; struct FootplanGoal { Vec2 goalPos; }; using FootplanStateCost = float (*)(FootplanState&, FootplanGoal&); using FootplanTransitionCost = float (*)(FootplanState&, FootplanState&, FootplanGoal&); namespace FootplanCosts { float distanceToGoal(FootplanState& state, FootplanGoal& goal); } // cheetah._bodyLength = 0.19 * 2; // cheetah._bodyWidth = 0.049 * 2; class FootstepPlanner { public: FootstepPlanner(bool verbose); void reset(); void buildInputTrajectory(float duration, float dt, InputTrajectoryState x0, float omega); void planFixedEvenGait(std::vector& gait, float gait_period); std::vector& getInitialTrajectory() { return _inputTrajectory; } void addCost(FootplanStateCost cost) { _stateCosts.push_back(cost); } void addCost(FootplanTransitionCost cost) { _transitionCosts.push_back(cost); } FootplanGoal& getGoal() { return _goal; } DefaultGaits defaults; private: bool _verbose; FootplanStats _stats; FootplanGoal _goal; std::vector _stateCosts; std::vector _transitionCosts; std::vector _inputTrajectory; }; #endif //CHEETAH_SOFTWARE_GRAPHSEARCH_H