RCL - RoboCLuedo  v1.0
Francesco Ganci - S4143910 - Experimental Robotics Lab - Assignment 1
cluedo_oracle.cpp File Reference

The referee of the game. More...

#include "ros/ros.h"
#include "std_msgs/Empty.h"
#include "robocluedo_msgs/Hint.h"
#include "robocluedo_msgs/CheckSolution.h"
#include <vector>
#include <string>
#include <random>
#include <fstream>
#include <algorithm>
+ Include dependency graph for cluedo_oracle.cpp:

Go to the source code of this file.

Macros

#define PUBLISHER_HINT   "/hint"
 
#define SUBSCRIBER_HINT_SIGNAL   "/hint_signal"
 
#define SERVICE_CHECK_SOLUTION   "/check_solution"
 
#define PATH_PARAMETER_SERVER_WHERE   "cluedo_path_where"
 
#define PATH_PARAMETER_SERVER_WHO   "cluedo_path_who"
 
#define PATH_PARAMETER_SERVER_WHAT   "cluedo_path_what"
 
#define MAX_NUM_HINTS   2
 default maximum number of hint IDs More...
 
#define MAX_SIZE_HINT   10
 maximum number of hints inside each ID More...
 
#define OUTLABEL   "[cluedo_oracle] "
 
#define OUTLOG(msg)   ROS_INFO_STREAM( OUTLABEL << msg )
 
#define OUTERR(msg)   OUTLOG( "ERROR: " << msg )
 
#define LOGSQUARE(str)   "[" << str << "] "
 

Functions

bool importDataFrom (std::string path, std::vector< std::string > &list)
 import entities from file More...
 
std::string chooseHintFrom (std::vector< std::string > &list)
 choose randomly a hint from a list More...
 
void hintCallback (const std_msgs::EmptyConstPtr &emptySignal)
 subscriber to SUBSCRIBER_HINT_SIGNAL and publisher of PUBLISHER_HINT More...
 
bool checkSolutionCallback (robocluedo_msgs::CheckSolution::Request &hyp, robocluedo_msgs::CheckSolution::Response &misterySolved)
 implementation of service SERVICE_CHECK_SOLUTION More...
 
void generateMystery (std::vector< std::string > list_who, std::vector< std::string > list_where, std::vector< std::string > list_what, int tot_hints)
 generate the solution of the case and the hints More...
 
int main (int argc, char *argv[])
 ROS node main - cluedo_oracle. More...
 

Variables

std::vector< std::string > hints_who
 vector of hints - who More...
 
std::vector< std::string > hints_where
 vector of hints - where More...
 
std::vector< std::string > hints_what
 vector of hints - what More...
 
robocluedo_msgs::Hint solution_who
 SOLUTION - who killed Dr Black. More...
 
robocluedo_msgs::Hint solution_where
 SOLUTION - where Dr Black was killed. More...
 
robocluedo_msgs::Hint solution_what
 SOLUTION - what's the murder weapon. More...
 
std::vector< robocluedo_msgs::Hint > mysterylist
 shuffled list of hypotheses More...
 

Detailed Description

The referee of the game.

ROS Node Name
  • cluedo_oracle
Authors
Francesco Ganci (S4143910)
Version
v1.0

Description:

This node implements a referee for the game: it prepares the hints and the mystery, then sends the hints to the robot and checks the hypotheses from the robot.

UML component
(See RoboCLuedo – COMP – UML Components Diagram the overal architecture, for further informations)

Publishers:

Subscribers:

Services:

Parameters:

Todo:
expose the value MAX_SIZE_HINT o the parameter server as done with MAX_NUM_HINTS.

Definition in file cluedo_oracle.cpp.