9 changed files with 200 additions and 108 deletions
-
59components/xy_robot_ctrl_module/xy_robot_ctrl_module.cpp
-
19components/xy_robot_ctrl_module/xy_robot_ctrl_module.hpp
-
66components/zcancmder/cmd/basic_bean.hpp
-
78components/zcancmder/cmd/c1006_module_cmd.hpp
-
13components/zcancmder/zcanreceiver.cpp
-
5components/zcancmder/zcanreceiver.hpp
-
8components/zcancmder_module/zcan_basic_order_module.cpp
-
51components/zcancmder_module/zcan_xy_robot_module.cpp
-
9components/zcancmder_module/zcan_xy_robot_module.hpp
@ -1,10 +1,53 @@ |
|||
#include "zcan_xy_robot_module.hpp"
|
|||
using namespace iflytop; |
|||
|
|||
void ZCANXYRobotCtrlModule::initialize(ZCanCmder* cancmder, int id) { |
|||
m_cancmder = cancmder; |
|||
m_id = id; |
|||
void ZCANXYRobotCtrlModule::initialize(ZCanCmder* cancmder, int id, XYRobotCtrlModule* xyRobotCtrlModule) { |
|||
m_cancmder = cancmder; |
|||
m_id = id; |
|||
m_xyRobotCtrlModule = xyRobotCtrlModule; |
|||
cancmder->registerListener(this); |
|||
} |
|||
|
|||
void ZCANXYRobotCtrlModule::onRceivePacket(CanPacketRxBuffer* rxcmd) { |
|||
|
|||
printf("ZCANXYRobotCtrlModule::onRceivePacket %d %d\n", rxcmd->get_cmdheader()->cmdid, rxcmd->get_cmdheader()->subcmdid); |
|||
PROCESS_PACKET(kcmd_xy_robot_ctrl_enable, m_id) { //
|
|||
errorcode = m_xyRobotCtrlModule->enable(cmd->enable); |
|||
} |
|||
END_PROCESS_PACKET(); |
|||
PROCESS_PACKET(kcmd_xy_robot_ctrl_stop, m_id) { //
|
|||
errorcode = m_xyRobotCtrlModule->stop(); |
|||
} |
|||
END_PROCESS_PACKET(); |
|||
PROCESS_PACKET(kcmd_xy_robot_ctrl_move_to_zero, m_id) { //
|
|||
errorcode = m_xyRobotCtrlModule->move_to_zero(); |
|||
} |
|||
END_PROCESS_PACKET(); |
|||
PROCESS_PACKET(kcmd_xy_robot_ctrl_move_to_with_calibrate, m_id) { //
|
|||
errorcode = m_xyRobotCtrlModule->move_to_with_calibrate(cmd->x, cmd->y); |
|||
} |
|||
END_PROCESS_PACKET(); |
|||
PROCESS_PACKET(kcmd_xy_robot_ctrl_move_to, m_id) { //
|
|||
errorcode = m_xyRobotCtrlModule->move_to(cmd->x, cmd->y); |
|||
} |
|||
END_PROCESS_PACKET(); |
|||
PROCESS_PACKET(kcmd_xy_robot_ctrl_move_by, m_id) { //
|
|||
errorcode = m_xyRobotCtrlModule->move_by(cmd->dx, cmd->dy); |
|||
} |
|||
END_PROCESS_PACKET(); |
|||
PROCESS_PACKET(kcmd_xy_robot_ctrl_read_status, m_id) { //
|
|||
errorcode = m_xyRobotCtrlModule->read_status(&ack->module_statu, &ack->x, &ack->y); |
|||
} |
|||
END_PROCESS_PACKET(); |
|||
PROCESS_PACKET(kcmd_xy_robot_ctrl_set_acc, m_id) { //
|
|||
errorcode = m_xyRobotCtrlModule->set_acc(cmd->acc); |
|||
} |
|||
END_PROCESS_PACKET(); |
|||
PROCESS_PACKET(kcmd_xy_robot_ctrl_set_dec, m_id) { //
|
|||
errorcode = m_xyRobotCtrlModule->set_dec(cmd->dec); |
|||
} |
|||
END_PROCESS_PACKET(); |
|||
PROCESS_PACKET(kcmd_xy_robot_ctrl_set_speed, m_id) { //
|
|||
errorcode = m_xyRobotCtrlModule->set_speed(cmd->speed); |
|||
} |
|||
END_PROCESS_PACKET(); |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue