Browse Source

修改变量名并将日志等级默认调整到ELOG_LVL_VERBOSE

paint_robot_new-v1.5
Lizongdi 2 weeks ago
parent
commit
8abd77074c
  1. 2
      library/common/include/elog_cfg.h
  2. 32
      project/paint_robot_new/paint_robot_new.c

2
library/common/include/elog_cfg.h

@ -33,7 +33,7 @@
/* enable log output. */
#define ELOG_OUTPUT_ENABLE
/* setting static output log level. range: from ELOG_LVL_ASSERT to ELOG_LVL_VERBOSE */
#define ELOG_OUTPUT_LVL ELOG_LVL_INFO
#define ELOG_OUTPUT_LVL ELOG_LVL_VERBOSE
/* enable assert check */
// #define ELOG_ASSERT_ENABLE
/* buffer size for every line's log */

32
project/paint_robot_new/paint_robot_new.c

@ -49,9 +49,9 @@ static PV_struct_define g_stPV;
static IV_struct_define g_stIV;
static int g_RB_State = 0; // 机器人状态,1表示处于竖直行走模式下
static int g_Paint_State = -1; // 喷枪状态,0表示打开,1表示关闭
static int angle_protect_lock = 0; // 为1表示角度异常,触发停车逻辑Move_Halt_AngleError
static int g_angle_protect_lock = 0; // 为1表示角度异常,触发停车逻辑Move_Halt_AngleError
static int g_ipaintOffCount = 0; // Move_Halt_AngleError中的计时,即角度偏移超过多少时间触发停枪
static int Is_All_Button_Reset = 0; // 1表示按钮正常工作,0表示需要复位
static int g_Is_All_Button_Reset = 0; // 1表示按钮正常工作,0表示需要复位
/*----------------------------------------------*
* 常量定义 *
@ -81,7 +81,7 @@ static void Move_Halt_AngleError(void)
return;
}
if (1 == angle_protect_lock)
if (1 == g_angle_protect_lock)
{
if (Rd_GetTime() - uiLastTime >= 600 * g_stCV.Paint_Gun_Shutdown_Distance / g_stIV.RobotMoveSpeed)
{
@ -99,7 +99,7 @@ static void Move_Halt_AngleError(void)
if(Rd_GetTime() - g_ipaintOffCount > 1000)
{
MsgCenter_SendTo(MODULE_NAME_CUSTOM, COMMON_CMD_STOP_ALL, NULL, 0);//先关枪
angle_protect_lock = 1;
g_angle_protect_lock = 1;
return;
}
}
@ -263,15 +263,15 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
RD_MEMCPY(&g_stMK32, pstMsg->m_aucData, sizeof(g_stMK32));
}
if (Is_All_Button_Reset == 0)
if (g_Is_All_Button_Reset == 0)
{
if (g_stMK32.CH4_SA == 0 && g_stMK32.CH5_SB == 0 && g_stMK32.CH6_SC == 0
&& g_stMK32.CH7_SD == 0 && g_stMK32.IsOnline == 1)
{
Is_All_Button_Reset = 1;
g_Is_All_Button_Reset = 1;
}
}
else if (Is_All_Button_Reset == 1)
else if (g_Is_All_Button_Reset == 1)
{
MsgCenter_SendTo(MODULE_NAME_DAEMON, DAEMON_SET_BUTTON_RESET, NULL, 0);
}
@ -283,7 +283,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
MsgCenter_SendTo(MODULE_NAME_MOTOR, MOTOR_POWER_DISABLE, NULL, 0);
MsgCenter_SendTo(MODULE_NAME_RBCORE, RBCORE_CMD_STOP_ALL, NULL, 0);
g_RB_State = 0;
Is_All_Button_Reset = 0;
g_Is_All_Button_Reset = 0;
break;
}
@ -294,7 +294,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
&& (g_stMK32.CH6_SC != -1000) )
{
g_stIV.IsWorking = 0;
angle_protect_lock = 0; // 遥控器复位认为打开角度锁
g_angle_protect_lock = 0; // 遥控器复位认为打开角度锁
g_ipaintOffCount = 0;
}
else
@ -355,7 +355,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
}
}
if (0 == angle_protect_lock)
if (0 == g_angle_protect_lock)
{
// 开关喷枪
if (g_stPV.RunMode == 1)
@ -397,7 +397,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
}
else if (g_stPV.RunMode == 2 || g_stPV.RunMode == 3)
{
if (0 == angle_protect_lock)
if (0 == g_angle_protect_lock)
{
BHBF_straight_drive_Cmd stCmd = {
.m_iMode = 1,
@ -418,7 +418,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
}
else if (g_stPV.RunMode == 2 || g_stPV.RunMode == 3)
{
if (0 == angle_protect_lock)
if (0 == g_angle_protect_lock)
{
BHBF_straight_drive_Cmd stCmd = {
.m_iMode = -1,
@ -452,7 +452,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
}
else if (g_stPV.RunMode == 2 || g_stPV.RunMode == 3)
{
if (0 == angle_protect_lock)
if (0 == g_angle_protect_lock)
{
BHBF_straight_drive_Cmd stCmd = {
.m_iMode = 1,
@ -472,7 +472,7 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
}
else if (g_stPV.RunMode == 2 || g_stPV.RunMode == 3)
{
if (0 == angle_protect_lock)
if (0 == g_angle_protect_lock)
{
BHBF_straight_drive_Cmd stCmd = {
.m_iMode = -1,
@ -523,8 +523,8 @@ static void Custom_ModuleHandler(const Msg_t *pstMsg)
lua_print("PV Info\n");
lua_print("{%d, %d, %d, %d, %d, %ld}\n",
g_stPV.RunMode, g_stPV.RobotSpeed, g_stPV.LaneChangeDistance, (int)g_stPV.Vertical_Calibration, g_stPV.IV_IsRestart_Notified, (long long)g_stPV.TimeStamp);
lua_print("g_RB_State = %d\ng_Paint_State = %d\nangle_protect_lock = %d\ng_ipaintOffCount = %d\nIs_All_Button_Reset = %d\n",
g_RB_State, g_Paint_State, angle_protect_lock, g_ipaintOffCount, Is_All_Button_Reset);
lua_print("g_RB_State = %d\ng_Paint_State = %d\ng_angle_protect_lock = %d\ng_ipaintOffCount = %d\ng_Is_All_Button_Reset = %d\n",
g_RB_State, g_Paint_State, g_angle_protect_lock, g_ipaintOffCount, g_Is_All_Button_Reset);
break;
}
default:

Loading…
Cancel
Save