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