Add more messages

This commit is contained in:
2023-02-02 01:14:29 -06:00
parent 07a0d7eca7
commit 1eca1b25e7
4 changed files with 223 additions and 11 deletions
+82
View File
@@ -92,6 +92,78 @@ struct PACKED SetSystemLedResp {
struct Footer footer;
};
struct PACKED SubscribeAddNodeReq
{
struct Header header;
uint8_t hostbyte;
uint32_t sub_vision; // always 0x03000000
struct Footer footer;
};
struct PACKED SubscribeAddNodeResp
{
struct Header header;
uint8_t retcode; // 0x00 or 0x50 are acceptable here
uint8_t hostbyte;
struct Footer footer;
};
struct PACKED SubNodeResetReq
{
struct Header header;
uint8_t hostbyte;
struct Footer footer;
};
struct PACKED SubNodeResetResp
{
struct Header header;
uint8_t retcode;
struct Footer footer;
};
struct PACKED SetRobotModeReq
{
struct Header header;
uint8_t mode;
struct Footer footer;
};
struct PACKED SetRobotModeResp
{
struct Header header;
uint8_t retcode;
struct Footer footer;
};
struct PACKED ChassisSpeedModeReq
{
struct Header header;
float speed[3];
struct Footer footer;
};
struct PACKED ChassisSpeedModeResp
{
struct Header header;
int8_t retcode;
struct Footer footer;
};
struct PACKED SetChassisWheelSpeedReq
{
struct Header header;
int8_t wheel_speed[4];
struct Footer footer;
};
struct PACKED SetChassisWheelSpeedResp
{
struct Header header;
int8_t retcode;
struct Footer footer;
};
struct PACKED SetWheelSpeedReq
{
struct Header header;
@@ -143,6 +215,11 @@ union Request {
struct SetSdkModeReq sdkmode;
struct SetSystemLedReq led;
struct SetWheelSpeedReq wheel;
struct SetChassisWheelSpeedReq chswheel;
struct ChassisSpeedModeReq chsspeed;
struct SetRobotModeReq mvmode;
struct SubNodeResetReq subnodereset;
struct SubscribeAddNodeReq subnodeadd;
};
union Response {
struct Header header;
@@ -150,6 +227,11 @@ union Response {
struct SetSdkModeResp sdkmode;
struct SetSystemLedResp led;
struct SetWheelSpeedResp wheel;
struct SetChassisWheelSpeedResp chswheel;
struct ChassisSpeedModeResp chsspeed;
struct SetRobotModeResp mvmode;
struct SubNodeResetResp subnodereset;
struct SubscribeAddNodeResp subnodeadd;
};
union Message {
struct Header header;
+46
View File
@@ -14,3 +14,49 @@ set_wheel_speed (
int16_t w2,
int16_t w3,
int16_t w4 );
static const uint8_t SET_CHASSIS_WHEEL_SPEED_CMDID = 0x26;
void
set_chassis_wheel_speed (
Client session,
int8_t w1,
int8_t w2,
int8_t w3,
int8_t w4 );
static const uint8_t CHASSIS_SPEED_MODE_CMDID = 0x21;
void
chassis_speed_mode (
Client session,
float x,
float y,
float z );
static const uint8_t SET_ROBOT_MODE_CMDID = 0x46;
enum MOVEMENTMODE {
MOVEMENTMODE_FREE,
MOVEMENTMODE_GIMBAL_LEAD,
MOVEMENTMODE_CHASSIS_LEAD
};
void
set_robot_mode (
Client session,
enum MOVEMENTMODE mode );
// cmdset 0x48
static const uint8_t SUBNODE_RESET_CMDID = 0x02;
void
subnode_reset (
Client session );
// cmdset 0x48
static const uint8_t SUBSCRIBE_ADD_NODE_CMDID = 0x01;
void
subscribe_add_node (
Client session );