Browse Source

【编译通过】当前雷赛电机速度全局还没赋值

master
Lizongdi 4 days ago
parent
commit
7ac8b1f580
  1. 6
      diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c
  2. 20
      diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c
  3. 13
      diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/main.c
  4. 7
      diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c

6
diaoerqiege/BHBF_Robot_Lifting_Lug/Core/BASE/Src/MSP/msp_LeiSai_485.c

@ -42,7 +42,7 @@ void LS_485Motor_loop()
&LS_485Motors_handler->TxCount, LS_485Motors_slave_id, 0x6208, 0x02);//PR1为速度模式
LS_485Motors_handler->AddSendList(LS_485Motors_handler,
LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, OneLineWaitTime,
LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, 50,
NULL);
speedModeSet=0;
@ -52,14 +52,14 @@ void LS_485Motor_loop()
&LS_485Motors_handler->TxCount, LS_485Motors_slave_id, 0x620B, LS_485Motors_Speed);//PR1速度
LS_485Motors_handler->AddSendList(LS_485Motors_handler,
LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, OneLineWaitTime,
LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, 50,
NULL);
MB_WriteHoldingReg(&LS_485Motors_handler->Tx_Buf,
&LS_485Motors_handler->TxCount, LS_485Motors_slave_id, 0x6002, 0x11);//PR1运行
LS_485Motors_handler->AddSendList(LS_485Motors_handler,
LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, OneLineWaitTime,
LS_485Motors_handler->Tx_Buf, LS_485Motors_handler->TxCount, 50,
NULL);

20
diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/FSM.c

@ -145,28 +145,34 @@ void Mode_Control()
}
extern uint8_t Pin2;
extern uint8_t Pin3;
extern uint8_t Test1;
void IO_Control()
{
GF_BSP_GPIO_SetIO(4, 1);
//GF_BSP_GPIO_SetIO(4, 1);
if(StrongGrindingMachineCurrentState == STRONG_GRINDING_MACHINE_MOTION_STATE)
{
GF_BSP_GPIO_SetIO(5, 0);
//GF_BSP_GPIO_SetIO(5, 0);
}
else if(StrongGrindingMachineCurrentState == STRONG_GRINDING_MACHINE_HALT_STATE)
{
GF_BSP_GPIO_SetIO(5, 1);
//GF_BSP_GPIO_SetIO(5, 1);
}
else{
}
Pin2 = GF_BSP_GPIO_ReadIO(2);
Pin3 = GF_BSP_GPIO_ReadIO(3);
Test1 = GF_BSP_GPIO_ReadIO(3);
if (!Test1)
{
GF_BSP_GPIO_SetIO(5, 0);
}
else
{
GF_BSP_GPIO_SetIO(5, 1);
}
}
void Automatic_Init()

13
diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/main.c

@ -154,7 +154,7 @@ int main(void)
MX_LPUART1_UART_Init();
MX_ADC2_Init();
/* USER CODE BEGIN 2 */
GF_BSP_GPIO_SetIO(5,1);
//GF_BSP_GPIO_SetIO(5,1);
DLT_LOG_ENABLE_LEVEL=0;//7 send all information 0 send nothing
Error_Detect_Intialzie(3000);//every 1 seconds
HAL_Delay(5000);
@ -276,9 +276,9 @@ void CV_GV_Init()
strong_grinding_machine_cmd = 0;
// 电��默认关闭
GF_BSP_GPIO_SetIO(3, 1);
GF_BSP_GPIO_SetIO(4, 1);
//GF_BSP_GPIO_SetIO(4, 1);
// 冷�通气�默认关闭,动作与主轴�步
GF_BSP_GPIO_SetIO(5, 1);
//GF_BSP_GPIO_SetIO(5, 1);
//Error Config
SystemErrorData= &GV.SystemErrorData;//send to upper computer
@ -338,10 +338,13 @@ void GF_Robot_Init()
SlideMotor_Controller_intialize_CAN2(&FD_CAN_2_Handler);//雷赛电机
//SlideMotor_Controller_intialize_CAN2(&FD_CAN_2_Handler);//雷赛电机
// �?光测�传感器�?115200
zhr29_200_laser_sensor_intialize(&RS_485_3_UART_Handler);
//zhr29_200_laser_sensor_intialize(&RS_485_3_UART_Handler);
// 雷赛485电机
LS_485Motors_intialize(&RS_485_3_UART_Handler);
// 强磨�
strong_grinding_machine_intialize(&RS_485_2_UART_Handler);

7
diaoerqiege/BHBF_Robot_Lifting_Lug/Core/Src/robot_state.c

@ -360,7 +360,7 @@ const uint32_t up_limit = 6200;
const uint8_t down_limit = 0;
uint8_t Pin2 = -1; //上限位,为0表示限位触发
uint8_t Pin3 = -1; //下限位,为0表示限位触发
uint8_t Test1 = 0;
int32_t KinfePosition = 1000; // 初始化为一个不合理的大值,等于1000时显示为未标定
int StrongSingleShotFlag = 0;
@ -371,11 +371,6 @@ extern uint8_t Mode_Init;// 初始化时第一次升刀的流程
static void LimitDownPosition(void)
{
if (!Pin3)
{
GV.LS_FrontEnd_Motor.Target_Velcity = 0;
}
if (GV.LS_FrontEnd_Motor.Real_Position - KinfePosition >= SAFE_MOTOR_COUNT)
{
GV.LS_FrontEnd_Motor.Target_Velcity = 0; // 电机脉冲数急停

Loading…
Cancel
Save