AriacScorer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 /*
18  * Desc: ARIAC scorer.
19  * Author: Deanna Hood
20  */
21 #ifndef _ROS_ARIAC_SCORER_HH_
22 #define _ROS_ARIAC_SCORER_HH_
23 
24 #include <map>
25 #include <string>
26 
27 #include <ros/ros.h>
28 
29 #include "osrf_gear/ARIAC.hh"
30 #include "osrf_gear/AriacKitTray.h"
31 #include <osrf_gear/Goal.h>
32 #include <osrf_gear/KitTray.h>
33 #include "osrf_gear/VacuumGripperState.h"
34 
37 {
39  public: AriacScorer();
40 
42  public: virtual ~AriacScorer();
43 
45  public: void Update(double timeStep = 0.0);
46 
51 
54  public: bool IsCurrentGoalComplete();
55 
59 
62  public: void AssignGoal(const ariac::Goal & goal);
63 
67  public: ariac::GoalScore UnassignCurrentGoal(double timeTaken = 0.0);
68 
73  public: bool GetTrayById(const ariac::TrayID_t & trayID, ariac::KitTray & kitTray);
74 
76  public: ariac::TrayScore SubmitTray(const ariac::KitTray & tray);
77 
79  protected: ariac::TrayScore ScoreTray(const ariac::KitTray & tray);
80 
82  protected: void ScoreCurrentState();
83 
85  public: static void FillKitFromMsg(const osrf_gear::Kit & kitMsg, ariac::Kit & kit);
86 
88  public: void OnGoalReceived(const osrf_gear::Goal::ConstPtr & goalMsg);
89 
91  public: void OnTrayInfoReceived(const osrf_gear::KitTray::ConstPtr & trayMsg);
92 
94  public: void OnGripperStateReceived(const osrf_gear::VacuumGripperState &stateMsg);
95 
97  protected: std::map<ariac::TrayID_t, ariac::KitTray> kitTrays;
98 
100  protected: mutable boost::mutex kitTraysMutex;
101 
104 
106  protected: bool newTrayInfoReceived;
107 
109  protected: bool newGoalReceived;
110 
112  protected: bool isPartTravelling = false;
113 
115  protected: ariac::Goal newGoal;
116 
119 
122 
125 
126 };
127 #endif
128 
Class to store information about a goal.
Definition: ARIAC.hh:291
void AssignGoal(const ariac::Goal &goal)
Assign a goal to process.
std::string TrayID_t
Definition: ARIAC.hh:32
bool isPartTravelling
Whether or not there is a travelling part in the gripper.
Definition: AriacScorer.h:112
void ScoreCurrentState()
Calculate the score for the trays given the objects in them.
Definition: AriacScorer.cpp:85
bool newGoalReceived
Flag for signalling new goal to process.
Definition: AriacScorer.h:109
std::map< ariac::TrayID_t, ariac::KitTray > kitTrays
The trays to monitor the score of.
Definition: AriacScorer.h:97
void Update(double timeStep=0.0)
Update the scorer.
Definition: AriacScorer.cpp:49
void OnGripperStateReceived(const osrf_gear::VacuumGripperState &stateMsg)
Callback for receiving gripper state message.
static void FillKitFromMsg(const osrf_gear::Kit &kitMsg, ariac::Kit &kit)
Helper function for filling a Kit from a kit ROS message.
ariac::GoalScore UnassignCurrentGoal(double timeTaken=0.0)
Stop processing the current goal.
ariac::Goal newGoal
Goal receivd from goal messages.
Definition: AriacScorer.h:115
The score of a tray.
Definition: ARIAC.hh:36
bool newTrayInfoReceived
Flag for signalling new tray info to process.
Definition: AriacScorer.h:106
ariac::GoalScore * goalScore
Pointer to the score of the current goal.
Definition: AriacScorer.h:121
void OnTrayInfoReceived(const osrf_gear::KitTray::ConstPtr &trayMsg)
Callback for receiving tray state message.
The parameters used for scoring the competition.
Definition: ARIAC.hh:178
ariac::ScoringParameters scoringParameters
Parameters to use for calculating scores.
Definition: AriacScorer.h:118
bool IsCurrentGoalComplete()
Get the score of the current goal.
Definition: AriacScorer.cpp:79
The score of a competition run.
Definition: ARIAC.hh:128
ariac::GameScore gameScore
The score of the run.
Definition: AriacScorer.h:124
void OnGoalReceived(const osrf_gear::Goal::ConstPtr &goalMsg)
Callback for receiving goal message.
ariac::TrayScore SubmitTray(const ariac::KitTray &tray)
Submit tray for scoring and store the result in the goal score.
virtual ~AriacScorer()
Destructor.
Definition: AriacScorer.cpp:32
A scorer for the ARIAC game.
Definition: AriacScorer.h:36
ariac::GoalScore GetCurrentGoalScore()
Get the score of the current goal.
Definition: AriacScorer.cpp:43
bool GetTrayById(const ariac::TrayID_t &trayID, ariac::KitTray &kitTray)
Get the kit tray with the specified ID.
The score of a goal.
Definition: ARIAC.hh:68
Class to store information about a kit.
Definition: ARIAC.hh:266
ariac::TrayScore ScoreTray(const ariac::KitTray &tray)
Calculate the score for a tray given the type of kit being built.
boost::mutex kitTraysMutex
Mutex for protecting the kit trays being monitored.
Definition: AriacScorer.h:100
AriacScorer()
Constructor.
Definition: AriacScorer.cpp:27
ariac::Goal currentGoal
Current goal being monitored.
Definition: AriacScorer.h:103
ariac::GameScore GetGameScore()
Get the current score.
Definition: AriacScorer.cpp:37
Class to store information about a kit tray.
Definition: AriacKitTray.h:25


osrf_gear
Author(s):
autogenerated on Wed Sep 7 2016 03:48:12