3 #include "configurator.h"
19 return ExecutionInfo(currentVertex, gv, currentTask, controlGoal, been, m_plan);
35 virtual Disturbance getDisturbance(TransitionSystem&g, vertexDescriptor v, b2World & world,
const Direction & dir,
const b2Transform& start);
48 virtual void backtrack(std::vector <vertexDescriptor>& evaluation_q, std::vector <vertexDescriptor>&priority_q, std::set<vertexDescriptor>& closed, std::vector <vertexDescriptor>& plan_prov, vertexDescriptor module_src=MOVING_VERTEX, vertexDescriptor startRecycle=MOVING_VERTEX);
58 virtual std::vector <vertexDescriptor>
splitTask(vertexDescriptor v, Direction d, vertexDescriptor src=TransitionSystem::null_vertex());
70 virtual bool propagateD(vertexDescriptor v1, vertexDescriptor v0, std::set<vertexDescriptor>*closed=NULL, StateMatcher::MATCH_TYPE match=StateMatcher::_FALSE);
73 void planPriority(TransitionSystem&, vertexDescriptor);
77 void adjust_rw_task(
const vertexDescriptor&, TransitionSystem &,
Task*,
const b2Transform &);
91 virtual VertexMatch
hardMatch(
State s, Direction dir=Direction::UNDEFINED, StateMatcher::MATCH_TYPE match_type=StateMatcher::_TRUE,
StateDifference * _sd=NULL);
105 virtual VertexMatch
findMatch(
State s, Direction dir=Direction::UNDEFINED, StateMatcher::MATCH_TYPE match_type=StateMatcher::_TRUE,
StateDifference * _sd=NULL, vertexDescriptor src=TransitionSystem::null_vertex());
116 virtual std::vector<vertexDescriptor>
explorer(vertexDescriptor v, TransitionSystem&g, b2World &w);
142 std::pair <edgeDescriptor, bool>
add_vertex_retro(vertexDescriptor &src, vertexDescriptor &v1,
Edge edge=
Edge(),
bool topDown=0);
145 std::vector <Direction>
getExploredDirections(vertexDescriptor v,
const std::vector<Direction>& directions);
152 return v==currentVertex && (!m_plan.empty()||!currentTask.
is_over());
164 virtual void transitionMatrix(vertexDescriptor v, Direction d, vertexDescriptor src);
175 void applyTransitionMatrix(vertexDescriptor v0, Direction d,
bool ended, vertexDescriptor src, std::vector<vertexDescriptor>& plan_prov);
185 void addToPriorityQueue(vertexDescriptor v, std::vector<vertexDescriptor>& queue,
const std::set <vertexDescriptor>& closed);
192 void shift_states(TransitionSystem &,
const std::vector<vertexDescriptor>&,
const b2Transform &);
195 vertexDescriptor get_explore_start(TransitionSystem &);
219 std::vector<Direction>::iterator
get_next_option(vertexDescriptor v, vertexDescriptor src, std::vector<vertexDescriptor> full_plan);
236 virtual bool recycle_plan(vertexDescriptor v, vertexDescriptor &v0, vertexDescriptor & task_start, StateMatcher::MATCH_TYPE &matchType,
237 b2Transform & shift_start, b2Transform& sk_first_start, std::pair<edgeDescriptor, bool>&edge,
238 std::vector<vertexDescriptor> &plan_prov, Direction t_get_direction){
254 std::pair<State, Edge>
simulation_setup(b2World& w,
Task & t, vertexDescriptor v0, b2Transform shift, b2Transform &start, std::vector<Direction>v0_options);
285 std::pair<edgeDescriptor, bool>
setup_match_edge(VertexMatch &match, vertexDescriptor &v0, vertexDescriptor & v1,
const Edge& k, Direction direction,
bool changedMatch);
293 virtual std::vector <vertexDescriptor>
task_vertices(vertexDescriptor v, std::pair<bool, edgeDescriptor>* ep=NULL);
313 vertexDescriptor
getRecyclingStart(vertexDescriptor v, vertexDescriptor v1, vertexDescriptor taskStart);
320 std::vector <edgeDescriptor>
inEdges(vertexDescriptor v, Direction d = UNDEFINED);
322 virtual bool closeVertex(std::set<vertexDescriptor> & closed, vertexDescriptor v);
334 std::pair<edgeDescriptor, bool>
addEdgeRetrospectively(vertexDescriptor v, vertexDescriptor &v1,
const State & s_tmp,std::pair<edgeDescriptor, bool> first_edge, Direction d,
float linearSpeed);
346 void correctQueue(std::vector<vertexDescriptor>& queue, vertexDescriptor v, vertexDescriptor startRecycle,
int planProvSize);
360 void abandonPlan(std::vector<vertexDescriptor>& planProv, vertexDescriptor v0, vertexDescriptor v1);
377 vertexDescriptor lastAdded=TransitionSystem::null_vertex();
389 void addToEvaluationQueue(std::vector <vertexDescriptor>& evaluationQueue, vertexDescriptor v1, TransitionSystem & g, vertexDescriptor v);
391 void reset(vertexDescriptor v=TransitionSystem::null_vertex()){
404 virtual StateMatcher::MATCH_TYPE desiredMatch() {
405 return StateMatcher::MATCH_TYPE::ABSTRACT;
417 virtual bool shouldPartiallyExplore(
const std::vector<edgeDescriptor>& oe, std::pair<bool, edgeDescriptor> ve);
425 virtual bool canReassignOutcome(vertexDescriptor v);
427 virtual float customSimulationStep(vertexDescriptor v=TransitionSystem::null_vertex());
430 bool hasPlanFinished(){
431 return m_plan.empty() && currentTask.
is_over();
Definition: configurator.h:17
virtual void init(Task _task=Task())
Initialises configurator.
Definition: configurator.cpp:19
Information about what the configurator is doing (current Task, current vertex), what it wants to do ...
Definition: planner.h:48
Adds and removes vertices from the evaluation queue.
Definition: focused.h:375
void addToEvaluationQueue(std::vector< vertexDescriptor > &evaluationQueue, vertexDescriptor v1, TransitionSystem &g, vertexDescriptor v)
Adds to evaluation queue: if the vertex represents a successful task, it is added to the end of the q...
Definition: focused.cpp:816
Configurator that only replans if the current task fails.
Definition: focused.h:8
std::pair< edgeDescriptor, bool > addEdgeRetrospectively(vertexDescriptor v, vertexDescriptor &v1, const State &s_tmp, std::pair< edgeDescriptor, bool > first_edge, Direction d, float linearSpeed)
Adds edge retrospectively (used in split task)
Definition: focused.cpp:741
virtual void transitionMatrix(vertexDescriptor v, Direction d, vertexDescriptor src)
Definition: focused.cpp:311
virtual std::vector< vertexDescriptor > explorer(vertexDescriptor v, TransitionSystem &g, b2World &w)
Constructs transition system using a Box2D simulation combined with an A* graph expansion algorithm.
Definition: focused.cpp:78
void adjustProbability(const edgeDescriptor &e)
Adjusts the probability that a continuous state (edge target) will occur after taking a discrete stat...
Definition: focused.cpp:764
std::pair< edgeDescriptor, bool > add_vertex_retro(vertexDescriptor &src, vertexDescriptor &v1, Edge edge=Edge(), bool topDown=0)
Adds vertices retroactively (e.g. after a state is split)
Definition: focused.cpp:12
void explore_plan(b2World &) override
Explores and plan.
Definition: focused.cpp:569
virtual std::vector< vertexDescriptor > splitTask(vertexDescriptor v, Direction d, vertexDescriptor src=TransitionSystem::null_vertex())
Split tasks into sub-states of fixed length.
Definition: focused.cpp:157
void applyTransitionMatrix(vertexDescriptor v0, Direction d, bool ended, vertexDescriptor src, std::vector< vertexDescriptor > &plan_prov)
Sets permitted transitions out of a state, formally combines jump guard J and guard Psi.
Definition: focused.cpp:362
virtual bool recycle_plan(vertexDescriptor v, vertexDescriptor &v0, vertexDescriptor &task_start, StateMatcher::MATCH_TYPE &matchType, b2Transform &shift_start, b2Transform &sk_first_start, std::pair< edgeDescriptor, bool > &edge, std::vector< vertexDescriptor > &plan_prov, Direction t_get_direction)
Does not recycle.
Definition: focused.h:236
void enforce_edge()
Used to make sure that there is always a connection between DUMMY/MOVING to the next in plan - useful...
Definition: focused.cpp:830
void abandonPlan(std::vector< vertexDescriptor > &planProv, vertexDescriptor v0, vertexDescriptor v1)
Clears plan vector, sets current task to change and clears current vertices.
Definition: focused.cpp:781
void visitedDirectionsPushBack(vertexDescriptor v, std::vector< Direction > &visitedDirections, Direction direction)
Pushes directions visited at this iteration (not using phi) to input vector.
Definition: focused.cpp:282
virtual VertexMatch findMatch(State s, Direction dir=Direction::UNDEFINED, StateMatcher::MATCH_TYPE match_type=StateMatcher::_TRUE, StateDifference *_sd=NULL, vertexDescriptor src=TransitionSystem::null_vertex())
Searches transition System for a match to a state provided. Continuous states are matched,...
Definition: focused.cpp:503
std::vector< Direction > getExploredDirections(vertexDescriptor v, const std::vector< Direction > &directions)
Definition: focused.cpp:291
vertexDescriptor getRecyclingStart(vertexDescriptor v, vertexDescriptor v1, vertexDescriptor taskStart)
Returns the vertex from which to start recycling plan.
Definition: focused.cpp:713
std::pair< State, Edge > simulation_setup(b2World &w, Task &t, vertexDescriptor v0, b2Transform shift, b2Transform &start, std::vector< Direction >v0_options)
Sets up for simulation.
Definition: focused.cpp:596
void resetPhi()
Resets all vertices evaluation function phi to a default unitialised value of 10.
Definition: focused.cpp:20
ExecutionInfo package_info(vertexDescriptor gv=TransitionSystem::null_vertex(), bool been=false)
Package task/goal execution details into an Execution Info instance.
Definition: focused.h:18
void addToPriorityQueue(vertexDescriptor v, std::vector< vertexDescriptor > &queue, const std::set< vertexDescriptor > &closed)
Adds vertexDescriptor to priority queue according to a custom heuristic.
Definition: focused.cpp:414
virtual void removeExploredTransitions(vertexDescriptor v)
Definition: focused.cpp:301
virtual void backtrack(std::vector< vertexDescriptor > &evaluation_q, std::vector< vertexDescriptor > &priority_q, std::set< vertexDescriptor > &closed, std::vector< vertexDescriptor > &plan_prov, vertexDescriptor module_src=MOVING_VERTEX, vertexDescriptor startRecycle=MOVING_VERTEX)
Iterates through vertices, if they result in crash, it splits the tasks and recalculates evaluation f...
Definition: focused.cpp:217
virtual bool canPropagate(vertexDescriptor v)
propagates only if the previous vertex
Definition: focused.cpp:255
std::pair< edgeDescriptor, bool > setup_match_edge(VertexMatch &match, vertexDescriptor &v0, vertexDescriptor &v1, const Edge &k, Direction direction, bool changedMatch)
Given a valid match, sets up the edge with the previous vertex Creates new edge if it doesn't exist,...
Definition: focused.cpp:635
virtual std::vector< Direction > partiallyExplorativeOptions(std::pair< bool, edgeDescriptor > ve)
Assigns options to vertex which has in previous iteration been expanded. Assigns direction of success...
Definition: focused.cpp:791
virtual bool propagateD(vertexDescriptor v1, vertexDescriptor v0, std::set< vertexDescriptor > *closed=NULL, StateMatcher::MATCH_TYPE match=StateMatcher::_FALSE)
Propagate a disturbance backwards to all states representing the same task (max 1)
Definition: focused.cpp:264
virtual Disturbance getDisturbance(TransitionSystem &g, vertexDescriptor v, b2World &world, const Direction &dir, const b2Transform &start)
Use attention window to find if any previously avoided obstacle is in the way of the goal,...
Definition: focused.cpp:37
virtual std::vector< vertexDescriptor > task_vertices(vertexDescriptor v, std::pair< bool, edgeDescriptor > *ep=NULL)
Rerturns all the vertices making up a task.
Definition: focused.cpp:644
std::pair< edgeDescriptor, bool > add_vertex_now(const vertexDescriptor &src, vertexDescriptor &v1, Disturbance obs, Edge edge=Edge(), bool topDown=0)
Adds state after discovering it in exploration.
Definition: focused.cpp:4
void adjust_goal_expectation() override
Uses tracking information to adjust the position of the goal relative to the robot.
Definition: focused.h:436
void reassign_direction(vertexDescriptor bestNext, Direction &direction)
Reassigns direction as the direction of the bext task to expand next in explorer.
Definition: focused.cpp:606
std::vector< edgeDescriptor > inEdges(vertexDescriptor v, Direction d=UNDEFINED)
Returns a vector of all the in-edges of vertex.
Definition: focused.cpp:694
void correctQueue(std::vector< vertexDescriptor > &queue, vertexDescriptor v, vertexDescriptor startRecycle, int planProvSize)
Edits.
Definition: focused.cpp:755
virtual VertexMatch hardMatch(State s, Direction dir=Direction::UNDEFINED, StateMatcher::MATCH_TYPE match_type=StateMatcher::_TRUE, StateDifference *_sd=NULL)
Searches transition System for a match to a state provided. Continuous states are matched,...
Definition: focused.cpp:435
virtual bool shouldPartiallyExplore(const std::vector< edgeDescriptor > &oe, std::pair< bool, edgeDescriptor > ve)
Psi guard: should only current task be simulated?
Definition: focused.cpp:835
std::vector< Direction >::iterator get_next_option(vertexDescriptor v, vertexDescriptor src, std::vector< vertexDescriptor > full_plan)
Returns an iterator to the next option representing a discrete Task transition. If v is in the plan,...
virtual bool preventTransition(vertexDescriptor v)
Definition: focused.h:151
void pre_explore()
Prepares transitionsystem for exploration: clears all edges of q0 with states that aren't the current...
Definition: focused.cpp:555
virtual Robot makeRobot(b2World &w, const Task &task)
Makes the robot object in the world with the given start position and task.
Definition: focused.cpp:810
Robot class for Box2D simulation.
Definition: robot.h:18
Definition: graphTools.h:453
A closed hybrid control loop. It has an initial disturbance representing the continuous state and a d...
Definition: task.h:47
bool is_over()
If task has finished executing.
Definition: task.h:369
Definition: disturbance.h:113
Edges connecting states in the transition system.
Definition: graphTools.h:40
Contains the differences between the contiuous components of two hybrid states.
Definition: graphTools.h:143
Hybrid states in the transition system.
Definition: graphTools.h:69