VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
Loading...
Searching...
No Matches
iq_apitypes.h
Go to the documentation of this file.
1/*----------------------------------------------------------------------------*/
2/* */
3/* Copyright (c) Innovation First 2016, All rights reserved. */
4/* */
5/* Module: iq_apitypes.h */
6/* Author: James Pearman */
7/* Created: 20 March 2019 */
8/* */
9/* Revisions: V0.1 */
10/* */
11/*----------------------------------------------------------------------------*/
12
13#ifndef IQ_APITYPES_H_
14#define IQ_APITYPES_H_
15
16#include <stdint.h>
17#include <stdbool.h>
18
19/*-----------------------------------------------------------------------------*/
22/*---------------------------------------------------------------------------*/
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/*----------------------------------------------------------------------------*/
30/*----------------------------------------------------------------------------*/
31// hard coded for SDK as we don't want to include VEX_Api.h
32// same names as V5
33//
34#ifndef IQ_API_H_
35typedef enum {
36 kDeviceTypeNoSensor = 0,
37 kDeviceTypeMotorSensor = 2,
38 kDeviceTypeLedSensor = 3,
39 kDeviceTypeRgbSensor = 4,
40 kDeviceTypeBumperSensor = 5,
41 kDeviceTypeGyroSensor = 6,
42 kDeviceTypeSonarSensor = 7,
43 kDeviceTypeRadioSensor = 8,
44 kDeviceTypeTetherSensor = 9,
45 kDeviceTypeVisionSensor = 11,
46
47 kDeviceTypeGenericSensor = 0x80,
48 kDeviceTypeUserSensor = 0xFF
50#endif
51
52// Some ports will be virtual, some physical, same number as V5 even though we have less
53#define IQ_MAX_DEVICE_PORTS 32
54typedef IQ_DeviceType IQ_DeviceTypeBuffer[IQ_MAX_DEVICE_PORTS];
55
56/*----------------------------------------------------------------------------*/
58/*----------------------------------------------------------------------------*/
59
60// subject to change
61typedef enum {
62 kVisionModeNormal = 0,
63 kVisionModeMixed = 1,
64 kVisionModeLineDetect = 2,
65 kVisionTypeTest = 3
67
68typedef enum {
69 kVisionTypeNormal = 0,
70 kVisionTypeColorCode = 1,
71 kVisionTypeLineDetect = 2
72} IQVisionBlockType;
73
74// White balance
75typedef enum {
76 kVisionWBNormal = 0,
77 kVisionWBStart = 1,
78 kVisionWBManual = 2
79} IQVisionWBMode;
80
81// LED control, from V5 or by the vision sensor
82typedef enum {
83 kVisionLedModeAuto = 0,
84 kVisionLedModeManual = 1
85} IQVisionLedMode;
86
87// Wifi mode
88typedef enum {
89 kVisionWifiModeOff = 0,
90 kVisionWifiModeOn = 1
91} IQVisionWifiMode;
92
93// signature should be 40 bytes and is the same data
94// as sent to the vision sensor
95
96// if bit0 is now set you know signature is read back
97#define VISION_SIG_FLAG_STATUS (1<<0)
98
99
100typedef struct __attribute(( packed )) _IQ_DeviceVisionObject {
101 uint16_t signature;
102 IQVisionBlockType type;
103 uint16_t xoffset;
104 uint16_t yoffset;
105 uint16_t width;
106 uint16_t height;
107 uint16_t angle;
108} IQ_DeviceVisionObject;
109
110// Color structure, used for LED and white balance
111typedef struct __attribute(( packed )) _IQ_DeviceVisionRgb {
112 uint8_t red;
113 uint8_t green;
114 uint8_t blue;
115 uint8_t brightness;
116} IQ_DeviceVisionRgb;
117
118//
119// local copies of the external vision structures on IQ
120//
121typedef struct __attribute__ ((__packed__))
122{
123 uint16_t ID;
124 uint8_t XPos;
125 uint8_t YPos;
126 uint8_t Width;
127 uint8_t Height;
128 uint16_t Angle;
129} IQ_VisionDetectionObj;
130
131typedef struct __attribute__ ((__packed__))
132{
133 uint8_t id;
134 float range;
135 int32_t uMin;
136 int32_t uMax;
137 int32_t uMean;
138 int32_t vMin;
139 int32_t vMax;
140 int32_t vMean;
141 uint32_t mRgb;
142 uint32_t mType;
143} IQ_VisionDetectionSettings;
144
145
146#ifdef __cplusplus
147}
148#endif
149#endif /* IQ_APITYPES_H_*/
IQVisionMode
IQ Vision sensor definitions
Definition iq_apitypes.h:61
struct __attribute((packed)) _IQ_DeviceVisionObject
IQ_DeviceType
IQ Device type definitions
Definition iq_apitypes.h:35