A scorer for the ARIAC game. More...
#include <AriacScorer.h>
Public Member Functions | |
AriacScorer () | |
Constructor. More... | |
void | AssignGoal (const ariac::Goal &goal) |
Assign a goal to process. More... | |
ariac::GoalScore | GetCurrentGoalScore () |
Get the score of the current goal. More... | |
ariac::GameScore | GetGameScore () |
Get the current score. More... | |
bool | GetTrayById (const ariac::TrayID_t &trayID, ariac::KitTray &kitTray) |
Get the kit tray with the specified ID. More... | |
bool | IsCurrentGoalComplete () |
Get the score of the current goal. More... | |
void | OnGoalReceived (const osrf_gear::Goal::ConstPtr &goalMsg) |
Callback for receiving goal message. More... | |
void | OnGripperStateReceived (const osrf_gear::VacuumGripperState &stateMsg) |
Callback for receiving gripper state message. More... | |
void | OnTrayInfoReceived (const osrf_gear::KitTray::ConstPtr &trayMsg) |
Callback for receiving tray state message. More... | |
ariac::TrayScore | SubmitTray (const ariac::KitTray &tray) |
Submit tray for scoring and store the result in the goal score. More... | |
ariac::GoalScore | UnassignCurrentGoal (double timeTaken=0.0) |
Stop processing the current goal. More... | |
void | Update (double timeStep=0.0) |
Update the scorer. More... | |
virtual | ~AriacScorer () |
Destructor. More... | |
Static Public Member Functions | |
static void | FillKitFromMsg (const osrf_gear::Kit &kitMsg, ariac::Kit &kit) |
Helper function for filling a Kit from a kit ROS message. More... | |
Protected Member Functions | |
void | ScoreCurrentState () |
Calculate the score for the trays given the objects in them. More... | |
ariac::TrayScore | ScoreTray (const ariac::KitTray &tray) |
Calculate the score for a tray given the type of kit being built. More... | |
Protected Attributes | |
ariac::Goal | currentGoal |
Current goal being monitored. More... | |
ariac::GameScore | gameScore |
The score of the run. More... | |
ariac::GoalScore * | goalScore |
Pointer to the score of the current goal. More... | |
bool | isPartTravelling = false |
Whether or not there is a travelling part in the gripper. More... | |
std::map< ariac::TrayID_t, ariac::KitTray > | kitTrays |
The trays to monitor the score of. More... | |
boost::mutex | kitTraysMutex |
Mutex for protecting the kit trays being monitored. More... | |
ariac::Goal | newGoal |
Goal receivd from goal messages. More... | |
bool | newGoalReceived |
Flag for signalling new goal to process. More... | |
bool | newTrayInfoReceived |
Flag for signalling new tray info to process. More... | |
ariac::ScoringParameters | scoringParameters |
Parameters to use for calculating scores. More... | |
A scorer for the ARIAC game.
Definition at line 36 of file AriacScorer.h.
AriacScorer::AriacScorer | ( | ) |
Constructor.
Definition at line 27 of file AriacScorer.cpp.
|
virtual |
Destructor.
Definition at line 32 of file AriacScorer.cpp.
void AriacScorer::AssignGoal | ( | const ariac::Goal & | goal | ) |
Assign a goal to process.
[in] | goal | The goal. |
Definition at line 293 of file AriacScorer.cpp.
|
static |
Helper function for filling a Kit from a kit ROS message.
Definition at line 317 of file AriacScorer.cpp.
ariac::GoalScore AriacScorer::GetCurrentGoalScore | ( | ) |
Get the score of the current goal.
Definition at line 43 of file AriacScorer.cpp.
ariac::GameScore AriacScorer::GetGameScore | ( | ) |
Get the current score.
[in] | The | time in seconds since the last update. |
Definition at line 37 of file AriacScorer.cpp.
bool AriacScorer::GetTrayById | ( | const ariac::TrayID_t & | trayID, |
ariac::KitTray & | kitTray | ||
) |
Get the kit tray with the specified ID.
[in] | trayID | The ID of the tray to get. |
[in] | kitTray | The kitTray found. |
Definition at line 114 of file AriacScorer.cpp.
bool AriacScorer::IsCurrentGoalComplete | ( | ) |
Get the score of the current goal.
Definition at line 79 of file AriacScorer.cpp.
void AriacScorer::OnGoalReceived | ( | const osrf_gear::Goal::ConstPtr & | goalMsg | ) |
Callback for receiving goal message.
Definition at line 275 of file AriacScorer.cpp.
void AriacScorer::OnGripperStateReceived | ( | const osrf_gear::VacuumGripperState & | stateMsg | ) |
Callback for receiving gripper state message.
Definition at line 334 of file AriacScorer.cpp.
void AriacScorer::OnTrayInfoReceived | ( | const osrf_gear::KitTray::ConstPtr & | trayMsg | ) |
Callback for receiving tray state message.
Definition at line 251 of file AriacScorer.cpp.
|
protected |
Calculate the score for the trays given the objects in them.
Definition at line 85 of file AriacScorer.cpp.
|
protected |
Calculate the score for a tray given the type of kit being built.
Definition at line 136 of file AriacScorer.cpp.
ariac::TrayScore AriacScorer::SubmitTray | ( | const ariac::KitTray & | tray | ) |
Submit tray for scoring and store the result in the goal score.
Definition at line 127 of file AriacScorer.cpp.
ariac::GoalScore AriacScorer::UnassignCurrentGoal | ( | double | timeTaken = 0.0 | ) |
Stop processing the current goal.
[in] | timeTaken | The time spent on the goal. |
Definition at line 308 of file AriacScorer.cpp.
void AriacScorer::Update | ( | double | timeStep = 0.0 | ) |
Update the scorer.
Definition at line 49 of file AriacScorer.cpp.
|
protected |
Current goal being monitored.
Definition at line 103 of file AriacScorer.h.
|
protected |
The score of the run.
Definition at line 124 of file AriacScorer.h.
|
protected |
Pointer to the score of the current goal.
Definition at line 121 of file AriacScorer.h.
|
protected |
Whether or not there is a travelling part in the gripper.
Definition at line 112 of file AriacScorer.h.
|
protected |
The trays to monitor the score of.
Definition at line 97 of file AriacScorer.h.
|
mutableprotected |
Mutex for protecting the kit trays being monitored.
Definition at line 100 of file AriacScorer.h.
|
protected |
Goal receivd from goal messages.
Definition at line 115 of file AriacScorer.h.
|
protected |
Flag for signalling new goal to process.
Definition at line 109 of file AriacScorer.h.
|
protected |
Flag for signalling new tray info to process.
Definition at line 106 of file AriacScorer.h.
|
protected |
Parameters to use for calculating scores.
Definition at line 118 of file AriacScorer.h.