Add gimbal control message

This commit is contained in:
2023-02-21 15:19:20 -06:00
parent 2258812fc2
commit 0b238ce048
6 changed files with 70 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#pragma once
#include "message.h"
#include <stdbool.h>
#include <stdint.h>
static const uint8_t GIMBAL_HOST = 4;
static const uint8_t GIMBAL_INDEX = 0;
#define GIMBAL_CTRL_SPEED_CMD 0x0C04
void
gimbal_ctrl_speed (
union Request* req,
uint16_t seq,
bool ack,
int16_t p,
int16_t y,
int16_t r );
+26
View File
@@ -168,6 +168,30 @@ struct PACKED SetChassisWheelSpeedResp
struct Footer footer;
};
struct PACKED GimbalCtrlSpeedReq
{
struct Header header;
// Values between -360 and 360
union {
int16_t yrp[3];
struct {
int16_t yaw;
int16_t roll;
int16_t pitch;
};
};
// Always 0xDC
uint8_t ctrl;
struct Footer footer;
};
struct PACKED GimbalCtrlSpeedResp
{
struct Header header;
int8_t retcode;
struct Footer footer;
};
struct PACKED SetWheelSpeedReq
{
struct Header header;
@@ -236,6 +260,7 @@ union Request {
struct SetRobotModeReq mvmode;
struct SubNodeResetReq subnodereset;
struct SubscribeAddNodeReq subnodeadd;
struct GimbalCtrlSpeedReq gimbspeed;
};
union Response {
struct Header header;
@@ -249,6 +274,7 @@ union Response {
struct SetRobotModeResp mvmode;
struct SubNodeResetResp subnodereset;
struct SubscribeAddNodeResp subnodeadd;
struct GimbalCtrlSpeedResp gimbspeed;
};
union Message {
struct Header header;
+1
View File
@@ -7,6 +7,7 @@ typedef struct Client* Client;
#include "message.h"
#include "chassis.h"
#include "sdk.h"
#include "gimbal.h"
Client client_new();
void client_connect(Client client);