Integrate new message into robo easy

master
PgSocks 8 months ago
parent 72b9a2ba92
commit 4d11e5b66f

@ -134,7 +134,6 @@ add_sub_msg (
union Request* req,
uint16_t seq,
bool ack,
uint8_t node_id,
uint8_t msg_id,
uint8_t freq,
uint64_t subject_uuid );

@ -102,12 +102,11 @@ add_sub_msg (
union Request* req,
uint16_t seq,
bool ack,
uint8_t node_id,
uint8_t msg_id,
uint8_t freq,
uint64_t subject_uuid ) {
req->sub.node_id = node_id;
req->sub.node_id = host2byte(CLIENT_HOST, CLIENT_INDEX);
req->sub.msg_id = msg_id;
req->sub.reserved = 0; // NOTE: Always 0
req->sub.sub_mode = 0; // NOTE: Always 0

@ -36,6 +36,7 @@ struct RobotImp {
RESETTING_SUBNODE,
SUSBCRIBING_SUBNODE,
SETTING_MOVEMENT_MODE,
SUBSCRIBING_GIMBAL_STATUS,
SENDING_HEARTBEAT,
WAITING,
READY,
@ -170,6 +171,14 @@ robot_work(Robot robot) {
break;
}
case SUBSCRIBING_GIMBAL_STATUS:
{
add_sub_msg ( &req, robot->seq++, true, 21, 1, DDS_GIMBAL_BASE );
req_send(robot->client->sdk_conn, &req);
robot->state = WAITING;
break;
}
case READY:
{
if(robot->dirty_wheels) {
@ -279,6 +288,17 @@ robot_work(Robot robot) {
robot->state = STOPPED;
break;
}
robot->state = SUBSCRIBING_GIMBAL_STATUS;
break;
case ADD_SUB_MSG_CMD:
if(resp.resp.sub.retcode) {
robot->state = STOPPED;
break;
}
if(resp.resp.sub.ack_node_id != host2byte(CLIENT_HOST, CLIENT_INDEX)) {
robot->state = STOPPED;
break;
}
robot->state = SENDING_HEARTBEAT;
break;
case SDK_HEARTBEAT_CMD:

Loading…
Cancel
Save