1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
#ifndef __MYRO_H__
#define __MYRO_H__
/** @file
* This header defines general robot opitions, as well as the construction,
* of a global robot variable. The global robot is created upon calling
* connect and destroyed upon calling disconnect.
*/
#include <Scribbler.h>
extern Scribbler robot;
/** @defgroup myro_general General Myro Commands
* This group contains general Myro Commands which are general "helper"
* functions, but don't use the robot or picture functions.
* @{
*/
/// Connect the global robot
void connect(std::string port="");
/// Disconnect the global robot
void disconnect();
/** @defgroup myro_general General Myro Commands
* This group contains general Myro Commands which are general "helper"
* functions, but don't use the robot or picture functions.
* @{
*/
/**
* Like sleep, but takes an argument of seconds,
* and can take a fraction of seconds.
*
* @param time The number of seconds to wait
*/
void wait(double time);
/**
* Returns true until start_time ammount of time has passed.
*
* For use in loops that you would like to run for longer then a certain number
* of minutes.
*/
bool timeRemaining(double start_time);
/**
* Returns the time, in seconds, since the epoch.
*/
double currentTime();
/**
* Returns a random number in the range of 0.0 and 1.0
*/
double randomNumber();
/**
* Pop open a dialog box asking the user to answer a question.
*
* First, give askQuestion a string that is the question, if nothing else is
* given, Yes/No are the answers, otherwise any number of strings is given as
* answers.
*
* @param question Is the question to ask.
* @param answerString is a string representing the answers, separated by the
* "seperator" character. By default it is a ","
* @param seperator The separator to tokenize the answerString with. This is provided
* in case you would want a comma in one of your answers.
* @param trim_whitespace Default true, will strip all whitespace from around answers
*/
std::string askQuestion(std::string question, std::string answerString="Yes,No",
char seperator=',', bool trim_whitespace=true);
/**
* Alternative version of askQuestion, which takes a vector of the possible
* answers.
*
* @param question The question to ask.
* @param answers A vector of strings which are the possible answers to the
* question. If an empty vector is provided, then the defaults are "Yes"
* and "No"
*/
std::string askQuestionVector(std::string question, std::vector<std::string> answers);
/// @}
#endif // __MYRO_H__
|