ziyan_perception.h
5.6 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/**
********************************************************************
* @file ziyan_perception.h
* @brief This is the header file for "ziyan_perception.c", defining the structure and
* (exported) function prototypes.
*
* @copyright (c) 2021 ZIYAN. All rights reserved.
*
* All information contained herein is, and remains, the property of ZIYAN.
* The intellectual and technical concepts contained herein are proprietary
* to ZIYAN and may be covered by U.S. and foreign patents, patents in process,
* and protected by trade secret or copyright law. Dissemination of this
* information, including but not limited to data and other proprietary
* material(s) incorporated within the information, in any form, is strictly
* prohibited without the express written consent of ZIYAN.
*
* If you receive this source code without ZIYAN’s authorization, you may not
* further disseminate the information, and you must immediately remove the
* source code and notify ZIYAN of its removal. ZIYAN reserves the right to pursue
* legal actions against you for any loss(es) or damage(s) caused by your
* failure to do so.
*
*********************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef ZIYAN_PERCEPTION_H
#define ZIYAN_PERCEPTION_H
/* Includes ------------------------------------------------------------------*/
#include "ziyan_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Exported constants --------------------------------------------------------*/
#define IMAGE_MAX_DIRECTION_NUM 6
#define ZIYAN_PERCEPTION_INTRINSICS_PARAM_ARRAY_NUM 9
#define ZIYAN_PERCEPTION_ROTATION_PARAM_ARRAY_NUM 9
#define ZIYAN_PERCEPTION_TRANSLATION_PARAM_ARRAY_NUM 3
/* Exported types ------------------------------------------------------------*/
/**
* @bref Perception camera direction
*/
typedef enum {
ZIYAN_PERCEPTION_RECTIFY_DOWN = 0,
ZIYAN_PERCEPTION_RECTIFY_FRONT = 1,
ZIYAN_PERCEPTION_RECTIFY_REAR = 2,
ZIYAN_PERCEPTION_RECTIFY_UP = 3,
ZIYAN_PERCEPTION_RECTIFY_LEFT = 4,
ZIYAN_PERCEPTION_RECTIFY_RIGHT = 5
} E_ZiyanPerceptionDirection;
/**
* @bref Perception camera design location
*/
typedef enum {
RECTIFY_DOWN_LEFT = 1,
RECTIFY_DOWN_RIGHT = 2,
RECTIFY_FRONT_LEFT = 3,
RECTIFY_FRONT_RIGHT = 4,
RECTIFY_REAR_LEFT = 5,
RECTIFY_REAR_RIGHT = 6,
RECTIFY_UP_LEFT = 21,
RECTIFY_UP_RIGHT = 22,
RECTIFY_LEFT_LEFT = 23,
RECTIFY_LEFT_RIGHT = 24,
RECTIFY_RIGHT_LEFT = 25,
RECTIFY_RIGHT_RIGHT = 26
} E_ZiyanPerceptionCameraPosition;
#pragma pack(1)
/**
* @bref Perception camera ram image info
*/
typedef struct {
uint32_t index;
uint8_t direction;
uint8_t bpp;
uint32_t width;
uint32_t height;
} T_ZiyanPerceptionRawImageInfo;
/**
* @bref Perception camera image info
*/
typedef struct {
T_ZiyanPerceptionRawImageInfo rawInfo;
uint16_t dataId;
uint16_t sequence;
//see enum E_ZiyanPerceptionCamPosition
uint32_t dataType;
uint64_t timeStamp;
} T_ZiyanPerceptionImageInfo;
/**
* @bref Perception camera parameters
*/
typedef struct {
uint8_t direction;
float leftIntrinsics[ZIYAN_PERCEPTION_INTRINSICS_PARAM_ARRAY_NUM];
float rightIntrinsics[ZIYAN_PERCEPTION_INTRINSICS_PARAM_ARRAY_NUM];
float rotationLeftInRight[ZIYAN_PERCEPTION_ROTATION_PARAM_ARRAY_NUM];
float translationLeftInRight[ZIYAN_PERCEPTION_TRANSLATION_PARAM_ARRAY_NUM];
} T_ZiyanPerceptionCameraParameters;
/**
* @bref Perception camera parameters packet
*/
typedef struct {
uint32_t timeStamp;
uint32_t directionNum;
T_ZiyanPerceptionCameraParameters cameraParameters[IMAGE_MAX_DIRECTION_NUM];
} T_ZiyanPerceptionCameraParametersPacket;
#pragma pack()
/**
* @bref Callback type to receive stereo camera image
*/
typedef void(*ZiyanPerceptionImageCallback)(T_ZiyanPerceptionImageInfo imageInfo, uint8_t *imageRawBuffer,
uint32_t bufferLen);
/* Exported functions --------------------------------------------------------*/
/**
* @brief Initialize the perception module.
* @note The interface initialization needs to be after ZiyanCore_Init.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanPerception_Init(void);
/**
* @brief Deinitialize the perception module.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanPerception_Deinit(void);
/**
* @brief Subscribe the raw images of both stereo cameras in the same direction. Default frequency at 20 Hz.
* @param direction: direction to specify the direction of the subscription. Ref to E_ZiyanPerceptionDirection
* @param callback callback to observer the stereo camera image and info.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanPerception_SubscribePerceptionImage(E_ZiyanPerceptionDirection direction,
ZiyanPerceptionImageCallback callback);
/**
* @brief Unsubscribe the raw image of both stereo cameras in the same direction.
* @param direction: direction to specify the direction of the subscription. Ref to E_ZiyanPerceptionDirection
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanPerception_UnsubscribePerceptionImage(E_ZiyanPerceptionDirection direction);
/**
* @brief Get the internal and external parameters of all stereo cameras.
* @return Execution result.
*/
T_ZiyanReturnCode ZiyanPerception_GetStereoCameraParameters(T_ZiyanPerceptionCameraParametersPacket *packet);
#ifdef __cplusplus
}
#endif
#endif // ZIYAN_PERCEPTION_H
/************************ (C) COPYRIGHT ZIYAN Innovations *******END OF FILE******/