-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabstractrobot.h
96 lines (80 loc) · 2.79 KB
/
abstractrobot.h
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
89
90
91
92
93
94
95
96
/**
* @file abstractrobot.h
* @brief C++ Interface: abstractrobot
*
* @details Holds the abstract class AbstractRobot which all the robots inherit.
*
* @author Margus Ernits
* @author Mauno Pihelgas
* @author Erik Kaju
*/
#ifndef ABSTRACTROBOT_H
#define ABSTRACTROBOT_H
//#include "log.h"
#include "camera.h"
#include "config.h"
#include "image.h"
#include "comm.h"
#include "view.h"
//todo move to abstract neve - once we have it
#define MC_DATA_BALL_SENSOR 0
#define MC_DATA_REMOTE_SIGNAL 1
#define MC_DATA_ROBOT_SELECTOR 8
#define MC_DATA_FIELD_SELECTOR 9
#define MC_DATA_START_BUTTON 10
#define MC_DATA_EZ_RC 11
#define MC_DATA_MYXA_RPM 12
#define MC_DATA_LIDAR_DISTANCE 13
#define MC_DATA_ROLLER_STATE 14
/**
* @brief This abstract class holds functions that are common to all robots.
* @author Margus Ernits, Mauno Pihelgas, Erik Kaju
*/
//TODO Aadresside ja kommunikatsiooni vaheline vastavustabel
class AbstractRobot{
public:
AbstractRobot();
~AbstractRobot();
/// @brief Virtual function which can be over-ridden within an inhereting class (individual robots).
virtual void go()=0;
/// @deprecated This function is deprecated. Use requestSensors(int nr) instead.
int requestSensors();
/**
* @brief Sends a read request for all sensor values from the numbered (@a nr) serial device
* @param nr - Serial device number
* @return 0 | 1 (0 = SUCCESS, 1 = FAILURE)
* @see Equivalent to getAnalogs(int nr)
*/
int requestSensors(int nr);
/// @deprecated This function is deprecated. Use getSensorsResponse(int nr) instead.
int getSensorsResponse();
/**
* @brief Writes serial device responce into two arrays: analog[8] and digital[8].
* @param nr - Serial device number
* @return 0 | 1 (0 = SUCCESS, 1 = FAILURE)
* @see Equivalent to getAnalogs(int nr)
*/
int getSensorsResponse(int nr);
/// @deprecated This function is deprecated. Use setDcMotor(int motor, int speed, int nr) instead.
void setDcMotor(int motor, int speed);
/**
* @brief Sends the new @a speed value of a given @a motor to the numbered (@a nr) serial device.
* @param motor - Number of the DC motor on the serial device (valid input: 0-4)
* @param speed - Motor speed value
* @param nr - Serial device number
* @see For more detailed information see: http://robot.itcollege.ee/wiki/index.php/ServoBasic_kontroller
*/
void setDcMotor(int motor, int speed, int nr);
void setOmni(int dirDeg, int velocityBody, int velocityAngular);
void setThrowerCommand(int requestedRpm, int precision);
int microcontrollerData[16]; ///< Holds all the analog sensor values retrieved by Comm::readSerialMulti(char addr, int * microcontrollerData, int nr)
protected:
//Camera camera;
Comm * com;
Image * image;
View * view;
public:
IplImage* _img;
private:
};
#endif