summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/modules/interpreter/position_tracker.h
blob: 7a5781f0a7c00fb0aeaa372cc67c963a15902f52 (plain)
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
#ifndef _POSITION_TRACKER_H
#define _POSITION_TRACKER_H

#include "../../stdafx.h"

class Position_Tracker : public IO_Module
{
public:
	Position_Tracker()
	{
		this->parent = NULL;
		this->moduleId = 0;
		this->positionX = 0;
		this->positionY = 0;
		this->orientation = 0;
	}

	Position_Tracker(uint32 trackerId)
	{
		this->parent = NULL;
		this->moduleId = trackerId;
		this->positionX = 0;
		this->positionY = 0;
		this->orientation = 0;
	}

protected:
	float positionX;
	float positionY;
	float orientation;

public:
	void Update();

	// Sets the current position; x and y in mm
	void SetPosition(int newPositionX, int newPositionY, float newOrientation) {
		positionX = newPositionX*(TICKS_PER_CM/10.0f);
		positionY = newPositionY*(TICKS_PER_CM/10.0f);
		orientation = easyAngle(newOrientation);
	}

	// returns x-koordinate in mm
	int16 GetPositionX() 
	{
		return (int16)((positionX*10.0f)/TICKS_PER_CM);
	}

	// returns y-koordinate in mm
	int16 GetPositionY() 	
	{
		return (int16)((positionY*10.0f)/TICKS_PER_CM);
	}

	// returns orientation
	float GetOrientation()
	{
		return orientation;
	}
};

#endif