aboutsummaryrefslogtreecommitdiff
path: root/include/libsurvive/poser.h
blob: 4894acf0a106559df388ade2fb534461505424a5 (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
#ifndef _LSPOSER_H
#define _LSPOSER_H

#include "survive_types.h"

typedef enum PoserType_t
{
	POSERDATA_NONE = 0,
	POSERDATA_IMU,
	POSERDATA_LIGHT,		//Single lighting event.  
	POSERDATA_FULL_SCENE, 	//Full, statified X, Y sweep data for both lighthouses.
} PoserType;

struct PoserData
{
	PoserType pt;
	uint8_t data[0];
};

struct PoserDataIMU
{
	PoserType pt;
	uint8_t datamask;  //0 = accel present, 1 = gyro present, 2 = mag present.
	FLT accel[3];
	FLT gyro[3];
	FLT mag[3];
};

struct PoserDataLight
{
	PoserType pt;
	int sensor_id;
	int acode;			//OOTX Code associated with this sweep. base_station = acode >> 2;  axis = acode & 1;
	uint32_t timecode;  //In object-local ticks.
	FLT length;			//In seconds
	FLT angle;			//In radians from center of lighthouse.
};

struct PoserDataFullScene
{
	PoserType pt;

	//If "lengths[...]" < 0, means not a valid piece of sweep information.
	FLT  lengths[SENSORS_PER_OBJECT][NUM_LIGHTHOUSES][2];
	FLT  angles [SENSORS_PER_OBJECT][NUM_LIGHTHOUSES][2];  //2 Axes

	struct PoserDataIMU lastimu;
};

//When you register your posers using the internal system, 
typedef int (*PoserCB)( struct SurviveObject * so, struct PoserData * pd );


#endif