Bratmobile
Classes | Public Member Functions | Protected Attributes | Friends | List of all members
Task Class Reference
Collaboration diagram for Task:
Collaboration graph
[legend]

Classes

struct  Action
 
class  Listener
 

Public Member Functions

Task::Action getAction () const
 
AffordanceIndex getAffIndex ()
 
Direction H (Disturbance ob, Direction d, bool topDown=0)
 Agent transfer function H which generates a motor output (Action) in response to a disturbance. More...
 
void setEndCriteria (const Angle &angle=SAFE_ANGLE, const Distance &distance=BOX2DRANGE)
 
void setEndCriteria (const Distance &distance)
 
void setEndCriteria (const EndCriteria &ec)
 
EndedResult checkEnded (b2Transform robotTransform=b2Transform_zero, Direction dir=UNDEFINED, bool relax=0, b2Body *robot=NULL, std::pair< bool, b2Transform > use_start=std::pair< bool, b2Transform >(1, b2Transform_zero))
 Check if this task has ended based on state information (default are info for the task which calls the method) More...
 
EndedResult checkEnded (const State &n, Direction dir=UNDEFINED, bool relax=false, std::pair< bool, b2Transform > use_start=std::pair< bool, b2Transform >(1, b2Transform_zero))
 Check if a state represents the end of this task. More...
 
bool checkEnded (const b2PolygonShape &box, const b2Transform &robot_pose=b2Transform_zero, Disturbance *dist_obs=NULL)
 Uses a virtual sensor (attention window) to determine whether the task has ended or not. More...
 
 Task (Direction d)
 
 Task (Disturbance ob, Direction d, b2Transform _start=b2Transform(b2Vec2(0.0, 0.0), b2Rot(0.0)), bool topDown=0)
 
simResult bumping_that (b2World &_world, int iteration, b2Body *, float remaining=SIM_DURATION)
 Executes this task in a Box2D simulation. More...
 
EndCriteria getEndCriteria (const Disturbance &)
 
EndCriteria getEndCriteria ()
 
bool endCriteria_met (Angle &, Distance &)
 
b2Transform from_Di (const b2Transform *custom_start=NULL, Disturbance *d_obs=NULL)
 
void set_change (bool b)
 
bool get_change ()
 
bool is_over ()
 If task has finished executing. More...
 
Disturbanceget_disturbance_ptr ()
 Get a pointer to the disturbance. More...
 
const Disturbanceget_disturbance () const
 
void setMotorStep (int i)
 
int & getMotorStep ()
 
b2Transform getStart ()
 
b2Transform & getStartRef ()
 
Direction get_direction ()
 
void set_direction (Direction d)
 

Protected Attributes

char planFile [250]
 
bool debug_k =false
 
bool change =0
 
b2Transform start =b2Transform_zero
 
EndCriteria endCriteria
 
Direction direction = DEFAULT
 
int motorStep =0
 
AffordanceIndex affordance =NONE
 
Action action
 
Disturbance disturbance
 

Friends

class Configurator
 

Member Function Documentation

◆ bumping_that()

simResult Task::bumping_that ( b2World &  _world,
int  iteration,
b2Body *  robot,
float  remaining = SIM_DURATION 
)

Executes this task in a Box2D simulation.

Parameters
_worldbox2d world
iterationconfigurator iteration (for logging)
remaining(simulation duration in seconds)
Returns
simResult

◆ checkEnded() [1/3]

EndedResult Task::checkEnded ( b2Transform  robotTransform = b2Transform_zero,
Direction  dir = UNDEFINED,
bool  relax = 0,
b2Body *  robot = NULL,
std::pair< bool, b2Transform >  use_start = std::pair <bool,b2Transform>(1, b2Transform_zero) 
)

Check if this task has ended based on state information (default are info for the task which calls the method)

Parameters
robotTransformthe robot's pose to evaluate
dirthe direction of the task being carried out
relaxapply a larger threshold to check whehter a goal was reached
robotrobot box2d body
use_startuse a custom start for the task
Returns
EndedResult

◆ checkEnded() [2/3]

bool Task::checkEnded ( const b2PolygonShape &  box,
const b2Transform &  robot_pose = b2Transform_zero,
Disturbance dist_obs = NULL 
)

Uses a virtual sensor (attention window) to determine whether the task has ended or not.

Parameters
boxthe sensor
robot_pose
dist_obspointer to the observed disturbance (the disturbance as it was at the beginning of the task, or as it was expected)
Returns
true
false

◆ checkEnded() [3/3]

EndedResult Task::checkEnded ( const State n,
Direction  dir = UNDEFINED,
bool  relax = false,
std::pair< bool, b2Transform >  use_start = std::pair <bool,b2Transform>(1, b2Transform_zero) 
)

Check if a state represents the end of this task.

Parameters
nthe state
dirthe direction of the task being carried out
relaxapply a larger threshold to check whehter a goal was reached
use_startuse a custom start for the task
Returns
EndedResult

◆ get_disturbance_ptr()

Disturbance* Task::get_disturbance_ptr ( )
inline

Get a pointer to the disturbance.

Returns
Disturbance*

◆ H()

Direction Task::H ( Disturbance  ob,
Direction  d,
bool  topDown = 0 
)

Agent transfer function H which generates a motor output (Action) in response to a disturbance.

Parameters
obthe disturbance
dtop-down instruction on how to generate the Action. DEFAULT with no top down control generates a reflex
topDownwhether the input direction should be used as is (true) or to generate a reflex (false)
Returns
Direction

NB: only generates default turns if absolute angle of the disturbance is larger than .1rad

◆ is_over()

bool Task::is_over ( )
inline

If task has finished executing.

Returns
true if step==0 or if manually set to change
false

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