Integrate new message into robo easy

master
PgSocks 7 months ago
parent 72b9a2ba92
commit 4d11e5b66f

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

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

@ -36,6 +36,7 @@ struct RobotImp {
RESETTING_SUBNODE, RESETTING_SUBNODE,
SUSBCRIBING_SUBNODE, SUSBCRIBING_SUBNODE,
SETTING_MOVEMENT_MODE, SETTING_MOVEMENT_MODE,
SUBSCRIBING_GIMBAL_STATUS,
SENDING_HEARTBEAT, SENDING_HEARTBEAT,
WAITING, WAITING,
READY, READY,
@ -170,6 +171,14 @@ robot_work(Robot robot) {
break; 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: case READY:
{ {
if(robot->dirty_wheels) { if(robot->dirty_wheels) {
@ -279,6 +288,17 @@ robot_work(Robot robot) {
robot->state = STOPPED; robot->state = STOPPED;
break; 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; robot->state = SENDING_HEARTBEAT;
break; break;
case SDK_HEARTBEAT_CMD: case SDK_HEARTBEAT_CMD:

Loading…
Cancel
Save