|
@ -7,7 +7,7 @@ |
|
|
using namespace iflytop; |
|
|
using namespace iflytop; |
|
|
#define TAG "CMD"
|
|
|
#define TAG "CMD"
|
|
|
|
|
|
|
|
|
void ScriptCmderEq20Servomotor::initialize(CmdScheduler* cmdScheduler) { |
|
|
|
|
|
|
|
|
void ScriptCmderEq20Servomotor::initialize(CmdSchedulerV2* cmdScheduler) { |
|
|
m_cmdScheduler = cmdScheduler; |
|
|
m_cmdScheduler = cmdScheduler; |
|
|
ZASSERT(m_cmdScheduler != nullptr); |
|
|
ZASSERT(m_cmdScheduler != nullptr); |
|
|
regcmd(); |
|
|
regcmd(); |
|
@ -48,7 +48,7 @@ static void cmd_dump_ack(Eq20ServoMotor::servo_internal_status_t ack) { // |
|
|
ZLOGI(TAG, "encoder_battery_warning:%d", ack.data.sbit.encoder_battery_warning); |
|
|
ZLOGI(TAG, "encoder_battery_warning:%d", ack.data.sbit.encoder_battery_warning); |
|
|
ZLOGI(TAG, "encoder_battery_report :%d", ack.data.sbit.encoder_battery_report); |
|
|
ZLOGI(TAG, "encoder_battery_report :%d", ack.data.sbit.encoder_battery_report); |
|
|
} |
|
|
} |
|
|
//static bool streq(const char* a, const char* b) { return strcmp(a, b) == 0; }
|
|
|
|
|
|
|
|
|
// static bool streq(const char* a, const char* b) { return strcmp(a, b) == 0; }
|
|
|
|
|
|
|
|
|
void ScriptCmderEq20Servomotor::regmodule(int id, Eq20ServoMotor* robot) { |
|
|
void ScriptCmderEq20Servomotor::regmodule(int id, Eq20ServoMotor* robot) { |
|
|
ZASSERT(moduler.find(id) == moduler.end()); |
|
|
ZASSERT(moduler.find(id) == moduler.end()); |
|
@ -57,24 +57,24 @@ void ScriptCmderEq20Servomotor::regmodule(int id, Eq20ServoMotor* robot) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void ScriptCmderEq20Servomotor::regcmd() { |
|
|
void ScriptCmderEq20Servomotor::regcmd() { |
|
|
REG_CMD___NO_ACK("eq20_", enable, "(id,en)", 2, con->getBool(2)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", move_to, "(id,pos,rpm,acctime)", 4, con->getInt(2), con->getInt(3), con->getInt(4)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", move_by, "(id,pos,rpm,acctime)", 4, con->getInt(2), con->getInt(3), con->getInt(4)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", rotate, "(id,rpm,acctime)", 3, con->getInt(2), con->getInt(3)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", move_to_zero_forward, "(id,lookzeropoint_rpm,findzero_edge_rpm,lookzeropoint_acc_time)", 4, con->getInt(2), con->getInt(3), con->getInt(4)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", move_to_zero_backward, "(id,lookzeropoint_rpm,findzero_edge_rpm,lookzeropoint_acc_time)", 4, con->getInt(2), con->getInt(3), con->getInt(4)); |
|
|
|
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", enable, "(id,en)", 2, con.getBool(2)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", move_to, "(id,pos,rpm,acctime)", 4, con.getInt(2), con.getInt(3), con.getInt(4)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", move_by, "(id,pos,rpm,acctime)", 4, con.getInt(2), con.getInt(3), con.getInt(4)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", rotate, "(id,rpm,acctime)", 3, con.getInt(2), con.getInt(3)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", move_to_zero_forward, "(id,lookzeropoint_rpm,findzero_edge_rpm,lookzeropoint_acc_time)", 4, con.getInt(2), con.getInt(3), con.getInt(4)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", move_to_zero_backward, "(id,lookzeropoint_rpm,findzero_edge_rpm,lookzeropoint_acc_time)", 4, con.getInt(2), con.getInt(3), con.getInt(4)); |
|
|
REG_CMD___NO_ACK("eq20_", stop, "(id)", 1); |
|
|
REG_CMD___NO_ACK("eq20_", stop, "(id)", 1); |
|
|
REG_CMD_WITH_ACK("eq20_", get_pos, "(id)", 1, int32_t, ack); |
|
|
REG_CMD_WITH_ACK("eq20_", get_pos, "(id)", 1, int32_t, ack); |
|
|
REG_CMD_WITH_ACK("eq20_", get_servo_internal_state, "(id)", 1, Eq20ServoMotor::servo_internal_status_t, ack); |
|
|
REG_CMD_WITH_ACK("eq20_", get_servo_internal_state, "(id)", 1, Eq20ServoMotor::servo_internal_status_t, ack); |
|
|
REG_CMD_WITH_ACK("eq20_", get_io_state, "(id)", 1, int32_t, ack); |
|
|
REG_CMD_WITH_ACK("eq20_", get_io_state, "(id)", 1, int32_t, ack); |
|
|
|
|
|
|
|
|
REG_CMD_WITH_ACK("eq20_", read_pn, "(id,pnadd)", 2, int32_t, con->getInt(2), ack); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", write_pn, "(id,pnadd,value)", 3, con->getInt(2), con->getInt(3)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", write_pn_bit, "(id,pnadd,off,value)", 4, con->getInt(2), con->getInt(3), con->getInt(4)); |
|
|
|
|
|
REG_CMD_WITH_ACK("eq20_", read_pn_bit, "(id,pnadd,off)", 3, int32_t, con->getInt(2), con->getInt(3), ack); |
|
|
|
|
|
|
|
|
REG_CMD_WITH_ACK("eq20_", read_pn, "(id,pnadd)", 2, int32_t, con.getInt(2), ack); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", write_pn, "(id,pnadd,value)", 3, con.getInt(2), con.getInt(3)); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", write_pn_bit, "(id,pnadd,off,value)", 4, con.getInt(2), con.getInt(3), con.getInt(4)); |
|
|
|
|
|
REG_CMD_WITH_ACK("eq20_", read_pn_bit, "(id,pnadd,off)", 3, int32_t, con.getInt(2), con.getInt(3), ack); |
|
|
|
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", write_reg, "(id,regadd,value)", 3, con->getInt(2), con->getInt(3)); |
|
|
|
|
|
REG_CMD_WITH_ACK("eq20_", read_reg, "(id,regadd)", 2, int32_t, con->getInt(2), ack); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", write_reg_bit, "(id,regadd,off,value)", 4, con->getInt(2), con->getInt(3), con->getInt(4)); |
|
|
|
|
|
REG_CMD_WITH_ACK("eq20_", read_reg_bit, "(id,regadd,off)", 3, int32_t, con->getInt(2), con->getInt(3), ack); |
|
|
|
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", write_reg, "(id,regadd,value)", 3, con.getInt(2), con.getInt(3)); |
|
|
|
|
|
REG_CMD_WITH_ACK("eq20_", read_reg, "(id,regadd)", 2, int32_t, con.getInt(2), ack); |
|
|
|
|
|
REG_CMD___NO_ACK("eq20_", write_reg_bit, "(id,regadd,off,value)", 4, con.getInt(2), con.getInt(3), con.getInt(4)); |
|
|
|
|
|
REG_CMD_WITH_ACK("eq20_", read_reg_bit, "(id,regadd,off)", 3, int32_t, con.getInt(2), con.getInt(3), ack); |
|
|
} |
|
|
} |