Add message fragment queue to easy robo API for vision info

This commit is contained in:
2023-09-05 13:43:15 -05:00
parent 103086b1a4
commit 94363b56f5
8 changed files with 242 additions and 0 deletions
+25
View File
@@ -38,3 +38,28 @@ stream_ctrl (
enum STREAMRESOLUTION res,
enum STREAMCTRL ctrl );
static const uint8_t VISION_HOST = 17;
static const uint8_t VISION_INDEX = 7;
#define VISION_DETECT_ENABLE_CMD 0xA30A
#define VISION_DETECT_ENABLE_PERSON 2
#define VISION_DETECT_ENABLE_GESTURE 4
#define VISION_DETECT_ENABLE_LINE 16
#define VISION_DETECT_ENABLE_MARKER 32
#define VISION_DETECT_ENABLE_ROBOT 128
void
vision_enable (
union Request* req,
uint16_t seq,
bool ack );
#define VISION_DETECT_INFO_CMD 0xA40A
enum VISIONTYPE {
VISIONTYPE_SHOULDER,
VISIONTYPE_PERSON,
VISIONTYPE_GESTURE,
VISIONTYPE_LINE,
VISIONTYPE_MARKER,
VISIONTYPE_ROBOT
};
+15
View File
@@ -316,6 +316,19 @@ struct PACKED VisionDetectInfo {
struct VisionRect rects[];
};
struct PACKED VisionDetectEnableReq {
struct Header header;
uint16_t type;
struct Footer footer;
};
struct PACKED VisionDetectEnableResp {
struct Header header;
uint8_t retcode;
uint16_t error;
struct Footer footer;
};
union Request {
struct Header header;
struct SetSdkConnectionReq sdkconn;
@@ -331,6 +344,7 @@ union Request {
struct GimbalCtrlSpeedReq gimbspeed;
struct BlasterFireReq blaster;
struct StreamCtrlReq stream;
struct VisionDetectEnableReq enablevision;
};
union Response {
struct Header header;
@@ -347,6 +361,7 @@ union Response {
struct GimbalCtrlSpeedResp gimbspeed;
struct BlasterFireResp blaster;
struct StreamCtrlResp stream;
struct VisionDetectEnableResp enablevision;
};
union Push {
struct VisionDetectInfo vision;
+17
View File
@@ -1,11 +1,28 @@
#pragma once
#include "message.h"
#include <stdbool.h>
// Handle for the high level robot interface
struct RobotImp;
typedef struct RobotImp* Robot;
#define FRAGMENT_MESSAGE 1
#define FRAGMENT_RECTANGLE 2
#define FRAGMENT_LINE 3
#define FRAGMENT_MARKER 4
struct Fragment {
int type;
union {
union Message message;
struct VisionRect rect;
};
};
int robot_poll(Robot robot, struct Fragment* fragment);
/*
* Return a handle to the high level robot interface, or NULL on error.
*/