|
|
@ -19,6 +19,7 @@ |
|
|
|
#include "sdk\components/step_motor_ctrl_module/zcan_master_step_motor_ctrl_module.hpp"
|
|
|
|
#include "sdk\components/xy_robot_ctrl_module/xy_robot_script_cmder_module.hpp"
|
|
|
|
#include "sdk\components/xy_robot_ctrl_module/zcan_xy_robot_master_module.hpp"
|
|
|
|
#include "sdk\components\mini_servo_motor\mini_servo_motor_ctrl_module.hpp"
|
|
|
|
// #include "sdk\components\scriptcmder_module\xy_robot_script_cmder_module.hpp"
|
|
|
|
// #include "sdk\components\zcancmder_master_module/zcan_master_step_motor_ctrl_module.hpp"
|
|
|
|
// #include "sdk\components\zcancmder_master_module\zcan_xy_robot_master_module.hpp"
|
|
|
@ -126,26 +127,35 @@ static StepMotor45::cfg_t cfg6 = { |
|
|
|
.driverPinMirror = true, |
|
|
|
}; |
|
|
|
|
|
|
|
namespace iflytop { |
|
|
|
/*******************************************************************************
|
|
|
|
* 代码 * |
|
|
|
* 基础组件 * |
|
|
|
*******************************************************************************/ |
|
|
|
namespace iflytop { |
|
|
|
StepMotor45 g_step_motor45[7]; |
|
|
|
StepMotor g_step_motor[10]; |
|
|
|
ZCanCommnaderMaster m_zcanCommnaderMaster; |
|
|
|
CmdScheduler cmdScheduler; |
|
|
|
XYRobotScriptCmderModule xyRobotScriptCmderModule; |
|
|
|
StepMotorCtrlScriptCmderModule stepMotorCtrlScriptCmderModule; |
|
|
|
ZCanCommnaderMaster m_zcanCommnaderMaster; |
|
|
|
CmdScheduler g_cmdScheduler; |
|
|
|
ModbusBlockHost g_modbusblockhost; |
|
|
|
FeiTeServoMotor g_feiteservomotor_bus; |
|
|
|
|
|
|
|
I_XYRobotCtrlModule* g_xyrobotctrlmodule = nullptr; |
|
|
|
I_StepMotorCtrlModule* g_stepmotorctrlmodule = nullptr; |
|
|
|
/*******************************************************************************
|
|
|
|
* 本地设备 * |
|
|
|
*******************************************************************************/ |
|
|
|
StepMotor45 g_step_motor45[7]; |
|
|
|
Eq20ServoMotor g_main_servo_motor; |
|
|
|
MiniRobotCtrlModule g_mini_servo[5]; |
|
|
|
/*******************************************************************************
|
|
|
|
* CAN设备 * |
|
|
|
*******************************************************************************/ |
|
|
|
I_XYRobotCtrlModule* g_xyrobotctrlmodule = nullptr; |
|
|
|
I_StepMotorCtrlModule* g_z_step_motor = nullptr; |
|
|
|
|
|
|
|
ModbusBlockHost g_modbusblockhost; |
|
|
|
Eq20ServoMotor g_eq20servomotor; |
|
|
|
FeiTeServoMotor g_feiteservomotor; |
|
|
|
/*******************************************************************************
|
|
|
|
* 串口指令 * |
|
|
|
*******************************************************************************/ |
|
|
|
StepMotorCtrlScriptCmderModule g_script_zmotor; |
|
|
|
XYRobotScriptCmderModule g_script_xyrobot; |
|
|
|
|
|
|
|
} // namespace iflytop
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
void regfn() { |
|
|
|
// setzero
|
|
|
|
// set4095
|
|
|
@ -205,6 +215,7 @@ void regfn() { |
|
|
|
}); |
|
|
|
#endif
|
|
|
|
} |
|
|
|
#endif
|
|
|
|
|
|
|
|
extern "C" { |
|
|
|
extern DMA_HandleTypeDef hdma_usart3_rx; |
|
|
@ -225,13 +236,18 @@ void Main::run() { |
|
|
|
|
|
|
|
auto* cfg = m_zcanCommnaderMaster.createCFG(); |
|
|
|
m_zcanCommnaderMaster.init(cfg); |
|
|
|
g_cmdScheduler.initialize(&DEBUG_UART, 1000); |
|
|
|
g_feiteservomotor_bus.initialize(&huart3, &hdma_usart3_rx, &hdma_usart3_tx); |
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
g_xyrobotctrlmodule = zcancmder_master::create_xyrobot_ctrl_module(&m_zcanCommnaderMaster, 1); |
|
|
|
// g_xyrobotctrlmodule->enable(false);
|
|
|
|
|
|
|
|
g_stepmotorctrlmodule = zcancmder_master::create_zcan_master_step_motor_ctrl_module(&m_zcanCommnaderMaster, 1); |
|
|
|
// g_stepmotorctrlmodule->rotate(300000, 0, [this](int32_t end) {});
|
|
|
|
|
|
|
|
cmdScheduler.initialize(&DEBUG_UART, 1000); |
|
|
|
cmdScheduler |
|
|
|
xyRobotScriptCmderModule.initialize(&cmdScheduler); |
|
|
|
xyRobotScriptCmderModule.regXYRobot(1, g_xyrobotctrlmodule); |
|
|
|
|
|
|
@ -240,7 +256,6 @@ void Main::run() { |
|
|
|
|
|
|
|
regfn(); |
|
|
|
|
|
|
|
#if 0
|
|
|
|
int i = 1; |
|
|
|
g_step_motor[i++].initialize(11, 10000, &m_IflytopCanMaster); |
|
|
|
g_step_motor[i++].initialize(12, 10000, &m_IflytopCanMaster); |
|
|
@ -280,7 +295,7 @@ void Main::run() { |
|
|
|
#endif
|
|
|
|
while (true) { |
|
|
|
OSDefaultSchduler::getInstance()->loop(); |
|
|
|
cmdScheduler.schedule(); |
|
|
|
g_cmdScheduler.schedule(); |
|
|
|
osDelay(1); |
|
|
|
} |
|
|
|
} |