|
|
|
|
@ -9,8 +9,8 @@ |
|
|
|
|
#include "McuShell.h" |
|
|
|
|
#include "Shell.h" |
|
|
|
|
|
|
|
|
|
#define RS_CMD_DRIVE_PREFIX "rs sendcmd 0x01 drive " |
|
|
|
|
#define RS_CMD_TURN_PREFIX "rs sendcmd 0x01 turn " |
|
|
|
|
#define RS_CMD_DRIVE_PREFIX "drive " |
|
|
|
|
#define RS_CMD_TURN_PREFIX "turn " |
|
|
|
|
#define BUF_SIZE 50 |
|
|
|
|
|
|
|
|
|
/* Sets the robot to automatic / manual mode */ |
|
|
|
|
@ -19,12 +19,12 @@ bool Robo_Wrapper_SetMode(bool automatic){ |
|
|
|
|
/* tbd */ |
|
|
|
|
}else{ |
|
|
|
|
/* set speed to zero */ |
|
|
|
|
Robo_Wrapper_Nav_Move(0); |
|
|
|
|
unsigned char response[128]; |
|
|
|
|
SHELL_SendToRobotAndGetResponse((const unsigned char*)"drive speed 0 0", response, sizeof(response)); |
|
|
|
|
/* set mode to speed */ |
|
|
|
|
unsigned char cmd[BUF_SIZE] = RS_CMD_DRIVE_PREFIX; |
|
|
|
|
unsigned char response[128]; |
|
|
|
|
McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)"mode speed"); |
|
|
|
|
SHELL_SendToESPAndGetResponse(cmd, response, sizeof(response)); |
|
|
|
|
SHELL_SendToRobotAndGetResponse(cmd, response, sizeof(response)); |
|
|
|
|
McuShell_SendStr(response, McuShell_GetStdio()->stdOut); |
|
|
|
|
} |
|
|
|
|
return true; |
|
|
|
|
@ -37,7 +37,7 @@ bool Robo_Wrapper_Nav_Turn(int16_t angle){ |
|
|
|
|
unsigned char angleA[5] = ""; |
|
|
|
|
McuUtility_Num16sToStr(angleA, sizeof(angleA), angle); |
|
|
|
|
McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)angleA); |
|
|
|
|
SHELL_SendToESPAndGetResponse(cmd, response, sizeof(response)); |
|
|
|
|
SHELL_SendToRobotAndGetResponse(cmd, response, sizeof(response)); |
|
|
|
|
McuShell_SendStr(response, McuShell_GetStdio()->stdOut); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
@ -52,7 +52,7 @@ bool Robo_Wrapper_Nav_Move(int16_t speed){ |
|
|
|
|
McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)speedA); |
|
|
|
|
McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)" "); |
|
|
|
|
McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)speedA); |
|
|
|
|
SHELL_SendToESPAndGetResponse(cmd, response, sizeof(response)); |
|
|
|
|
SHELL_SendToRobotAndGetResponse(cmd, response, sizeof(response)); |
|
|
|
|
McuShell_SendStr(response, McuShell_GetStdio()->stdOut); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
@ -62,7 +62,7 @@ bool Robo_Wrapper_Nav_Stop(void){ |
|
|
|
|
unsigned char cmd[BUF_SIZE] = RS_CMD_DRIVE_PREFIX; |
|
|
|
|
unsigned char response[128]; |
|
|
|
|
McuUtility_strcat(cmd, sizeof(cmd), (unsigned char*)"mode stop"); |
|
|
|
|
SHELL_SendToESPAndGetResponse(cmd, response, sizeof(response)); |
|
|
|
|
SHELL_SendToRobotAndGetResponse(cmd, response, sizeof(response)); |
|
|
|
|
McuShell_SendStr(response, McuShell_GetStdio()->stdOut); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|