|
|
|
@ -28,6 +28,8 @@ struct RobotImp {
|
|
|
|
|
|
|
|
|
|
bool sdk_mode;
|
|
|
|
|
|
|
|
|
|
float x, y, z;
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
CONNECTING_TO_PROXY_PORT,
|
|
|
|
|
SETTING_SDK_CONNECTION,
|
|
|
|
@ -36,6 +38,7 @@ struct RobotImp {
|
|
|
|
|
RESETTING_SUBNODE,
|
|
|
|
|
SUSBCRIBING_SUBNODE,
|
|
|
|
|
SETTING_MOVEMENT_MODE,
|
|
|
|
|
SUBSCRIBING_POSITION_STATUS,
|
|
|
|
|
SENDING_HEARTBEAT,
|
|
|
|
|
WAITING,
|
|
|
|
|
READY,
|
|
|
|
@ -170,6 +173,14 @@ robot_work(Robot robot) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case SUBSCRIBING_POSITION_STATUS:
|
|
|
|
|
{
|
|
|
|
|
add_sub_msg ( &req, robot->seq++, true, 20, 1, DDS_POSITION );
|
|
|
|
|
req_send(robot->client->dev_conn, &req);
|
|
|
|
|
robot->state = WAITING;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case READY:
|
|
|
|
|
{
|
|
|
|
|
if(robot->dirty_wheels) {
|
|
|
|
@ -244,6 +255,8 @@ robot_work(Robot robot) {
|
|
|
|
|
switch(resp.header.cmd) {
|
|
|
|
|
case 0:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
case SET_SDK_CONNECTION_CMD:
|
|
|
|
|
// TODO: Do more with this
|
|
|
|
|
if(resp.resp.sdkconn.retcode) {
|
|
|
|
@ -279,6 +292,13 @@ robot_work(Robot robot) {
|
|
|
|
|
robot->state = STOPPED;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
robot->state = SUBSCRIBING_POSITION_STATUS;
|
|
|
|
|
break;
|
|
|
|
|
case ADD_SUB_MSG_CMD:
|
|
|
|
|
if(resp.resp.sub.retcode) {
|
|
|
|
|
robot->state = STOPPED;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
robot->state = SENDING_HEARTBEAT;
|
|
|
|
|
break;
|
|
|
|
|
case SDK_HEARTBEAT_CMD:
|
|
|
|
@ -288,6 +308,12 @@ robot_work(Robot robot) {
|
|
|
|
|
}
|
|
|
|
|
robot->state = READY;
|
|
|
|
|
break;
|
|
|
|
|
case PUSH_PERIOD_MSG_CMD:
|
|
|
|
|
// assume it is a position status for now
|
|
|
|
|
robot->x = resp.resp.push.position.x;
|
|
|
|
|
robot->y = resp.resp.push.position.y;
|
|
|
|
|
robot->z = resp.resp.push.position.z;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|