Bratmobile
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Configurator Class Referenceabstract
Inheritance diagram for Configurator:
Inheritance graph
[legend]
Collaboration diagram for Configurator:
Collaboration graph
[legend]

Public Member Functions

 Configurator (Task _task)
 
virtual void init (Task _task=Task())
 Initialises configurator. More...
 
virtual bool Spawner ()
 Calls functions to explore the state space and extract a plan. More...
 
int getIteration ()
 
void addIteration (int i=1)
 
void assignDisturbanceToTask (const Disturbance &d, Task &t)
 
void dummy_vertex (vertexDescriptor src)
 
simResult simulate (Task t, b2World &w)
 Simulates this task, includes creating the robot object. More...
 
virtual float remainingSimulationTime (const Task *const t=NULL)
 
void estimate_current_vertex ()
 
void printPlan (std::vector< vertexDescriptor > *p=NULL)
 
std::pair< edgeDescriptor, bool > addVertex (const vertexDescriptor &src, vertexDescriptor &v1, Edge edge=Edge(), bool topDown=0)
 Add state to the cognitive map and set next state Task direction and options. More...
 
virtual void explore_plan (b2World &)=0
 Explores and plan.
 
void start ()
 
void stop ()
 
void registerInterface (LIDAR_In *, Motor_Out *)
 
virtual void change_task ()
 changes tasks executing on the robot
 
void update_graph (TransitionSystem &g, const TrackingResult &tr)
 
float approximate_angle (float angle, Direction d, simResult::resultType outcome)
 Approximating angle to divisors of pi/2. More...
 
virtual void adjust_goal_expectation ()
 Uses tracking information to adjust the position of the goal relative to the robot.
 
std::pair< bool, Direction > getOppositeDirection (Direction d)
 
void adjust_simulated_task (const vertexDescriptor &v, Task &t)
 If Task. More...
 
void register_controller (Controller *controller)
 
Controllerget_controller ()
 
void register_tracker (Tracker *_tracker)
 registers and initialises the tracker to the goal
 
Trackerget_tracker () const
 
Motor_Outget_motor_interface ()
 
LIDAR_Inget_lidar_interface ()
 
void register_planner (Planner *_p)
 
void setSimulationStep (float f)
 
void register_logger (Logger *l)
 
void register_goalChanger (GoalChanger *gc)
 
virtual Robot makeRobot (b2World &world, const b2Transform &start)
 Makes the robot object in the world with the given start position and task. More...
 
bool areInterfacesSetUp (Configurator *c=NULL)
 
void assignBodyFeatures (Task &t, const BodyFeatures &bf)
 Assigns body features to the disturbance of a task (NOTE: affordance and validity of the disturbance will remain the same) More...
 
void assignDimensions (Task &t, float halfLength, float halfWidth)
 Assigns dimensions to the disturbance of a task (NOTE: pose, affordance and validity of the disturbance will remain the same) More...
 
void register_worldBuilder (WorldBuilder *wb)
 
b2Transform get_start (const Task *const t)
 
Direction get_direction (const Task *const t)
 

Static Public Member Functions

static void run (Configurator *)
 Spawns tasks, creates plans, tracks task and controls real-world task switching option to run in thread. Thread can be used if planning time might exceed 200ms (LIDAR sampling rate) but doesn't have to be.
 
static void MulT (const b2Transform &B, Task &task)
 Matrix multiply by transpose.
 
static void InvMul (const b2Transform &B, Task &task)
 Matrix multiply by transpose.
 
static void InvMul_ (const b2Transform &B, Task &task)
 Matrix multiply by transpose.
 
static void Mul (const b2Transform &B, Task &task)
 Matrix multiplication.
 

Protected Attributes

int iteration =0
 
int simulatedTasks =0
 
Task currentTask
 
Controllertask_controller =NULL
 
Trackertracker =NULL
 
LIDAR_Inci =NULL
 
Motor_Outcontrol =NULL
 
Plannerplanner =NULL
 
Loggerlogger =NULL
 
bool running =0
 
std::thread * LIDAR_thread =NULL
 
float simulationStep =2*std::max(ROBOT_HALFLENGTH, ROBOT_HALFWIDTH)
 
std::chrono::high_resolution_clock::time_point previousTimeScan
 
GoalChangergoal_changer =NULL
 
std::vector< vertexDescriptor > m_plan
 
std::vector< vertexDescriptor > current_vertices
 
Task controlGoal
 
CoordinateContainer data2fp
 
TransitionSystem transitionSystem =TransitionSystem(1)
 
WorldBuilderworldBuilder =new WorldBuilder()
 
vertexDescriptor currentVertex =MOVING_VERTEX
 
edgeDescriptor movingEdge =edgeDescriptor()
 
edgeDescriptor currentEdge =movingEdge
 

Member Function Documentation

◆ addVertex()

std::pair< edgeDescriptor, bool > Configurator::addVertex ( const vertexDescriptor &  src,
vertexDescriptor &  v1,
Edge  edge = Edge(),
bool  topDown = 0 
)

Add state to the cognitive map and set next state Task direction and options.

Parameters
srcsource state
v1new state
edgeconnecting edge between src->v1
topDownflag determining whether state v1 has been simulated already or not

◆ adjust_simulated_task()

void Configurator::adjust_simulated_task ( const vertexDescriptor &  v,
Task t 
)

If Task.

Parameters
tcorresponds to current Task, change its end criteria so that it is only simulated for the remainder of the end criteria
vsource vertex for the task
ttask reference

◆ approximate_angle()

float Configurator::approximate_angle ( float  angle,
Direction  d,
simResult::resultType  outcome 
)

Approximating angle to divisors of pi/2.

Parameters
anglethe angle to approximate
dthe direction of the robot
outcomethe outcome of the last simulation

◆ assignBodyFeatures()

void Configurator::assignBodyFeatures ( Task t,
const BodyFeatures bf 
)

Assigns body features to the disturbance of a task (NOTE: affordance and validity of the disturbance will remain the same)

Parameters
tthe task
bfbody features

◆ assignDimensions()

void Configurator::assignDimensions ( Task t,
float  halfLength,
float  halfWidth 
)

Assigns dimensions to the disturbance of a task (NOTE: pose, affordance and validity of the disturbance will remain the same)

Parameters
tthe task
halfLength
halfWidth

◆ estimate_current_vertex()

void Configurator::estimate_current_vertex ( )
Parameters
gthe cognitive map
tthe task which is currently being executed on the robot

◆ getOppositeDirection()

std::pair< bool, Direction > Configurator::getOppositeDirection ( Direction  d)
Returns
std::pair <bool, Direction>(opposite exists, opposite direction)

◆ init()

void Configurator::init ( Task  _task = Task())
virtual

Initialises configurator.

Parameters
_taskthe new overarching goal

◆ makeRobot()

Robot Configurator::makeRobot ( b2World &  world,
const b2Transform &  start 
)
virtual

Makes the robot object in the world with the given start position and task.

Parameters
world
start
taskWithGoal
Returns
Robot

Reimplemented in DiscreteConfigurator, and AttentiveConfigurator.

◆ simulate()

simResult Configurator::simulate ( Task  t,
b2World &  w 
)

Simulates this task, includes creating the robot object.

Parameters
tthe task (should already be initialised)
wthe world (should already contain any objects aside from the robot)
Returns
simResult

◆ Spawner()

bool Configurator::Spawner ( )
virtual

Calls functions to explore the state space and extract a plan.

Returns
true
false

◆ update_graph()

void Configurator::update_graph ( TransitionSystem &  g,
const TrackingResult tr 
)

@brieF updates the cognitive map and goal by applying a 2D transform, and sets current task Di to the observed disturbance in the tracking result

Parameters
gthe cognitive map
trthe tracking result

The documentation for this class was generated from the following files: