|
|
@ -28,8 +28,6 @@ struct RobotImp {
|
|
|
|
|
|
|
|
|
|
|
|
bool sdk_mode;
|
|
|
|
bool sdk_mode;
|
|
|
|
|
|
|
|
|
|
|
|
float x, y, z;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
enum {
|
|
|
|
CONNECTING_TO_PROXY_PORT,
|
|
|
|
CONNECTING_TO_PROXY_PORT,
|
|
|
|
SETTING_SDK_CONNECTION,
|
|
|
|
SETTING_SDK_CONNECTION,
|
|
|
@ -38,7 +36,6 @@ struct RobotImp {
|
|
|
|
RESETTING_SUBNODE,
|
|
|
|
RESETTING_SUBNODE,
|
|
|
|
SUSBCRIBING_SUBNODE,
|
|
|
|
SUSBCRIBING_SUBNODE,
|
|
|
|
SETTING_MOVEMENT_MODE,
|
|
|
|
SETTING_MOVEMENT_MODE,
|
|
|
|
SUBSCRIBING_POSITION_STATUS,
|
|
|
|
|
|
|
|
SENDING_HEARTBEAT,
|
|
|
|
SENDING_HEARTBEAT,
|
|
|
|
WAITING,
|
|
|
|
WAITING,
|
|
|
|
READY,
|
|
|
|
READY,
|
|
|
@ -173,14 +170,6 @@ robot_work(Robot robot) {
|
|
|
|
break;
|
|
|
|
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:
|
|
|
|
case READY:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(robot->dirty_wheels) {
|
|
|
|
if(robot->dirty_wheels) {
|
|
|
@ -255,8 +244,6 @@ robot_work(Robot robot) {
|
|
|
|
switch(resp.header.cmd) {
|
|
|
|
switch(resp.header.cmd) {
|
|
|
|
case 0:
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SET_SDK_CONNECTION_CMD:
|
|
|
|
case SET_SDK_CONNECTION_CMD:
|
|
|
|
// TODO: Do more with this
|
|
|
|
// TODO: Do more with this
|
|
|
|
if(resp.resp.sdkconn.retcode) {
|
|
|
|
if(resp.resp.sdkconn.retcode) {
|
|
|
@ -292,13 +279,6 @@ robot_work(Robot robot) {
|
|
|
|
robot->state = STOPPED;
|
|
|
|
robot->state = STOPPED;
|
|
|
|
break;
|
|
|
|
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;
|
|
|
|
robot->state = SENDING_HEARTBEAT;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case SDK_HEARTBEAT_CMD:
|
|
|
|
case SDK_HEARTBEAT_CMD:
|
|
|
@ -308,12 +288,6 @@ robot_work(Robot robot) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
robot->state = READY;
|
|
|
|
robot->state = READY;
|
|
|
|
break;
|
|
|
|
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;
|
|
|
|
return 1;
|
|
|
|