add Encoder and PID control and Abstacle control

This commit is contained in:
2025-07-03 00:29:57 +08:00
parent 0361cd17af
commit a635b6d5eb
49 changed files with 9072 additions and 7610 deletions

View File

@@ -128,8 +128,14 @@ void HCBle_ParseAndHandleFrame(const char *frame)
if (sscanf(frame, "#{\"leftSpeed\":%d,\"rightSpeed\":%d}$", &left, &right) == 2) {
cmd.LeftSpeed = left;
cmd.RightSpeed = right;
// <20><><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD>
target_rpm_L = map_speed_to_rpm(cmd.LeftSpeed);
target_rpm_R = map_speed_to_rpm(cmd.RightSpeed);
HCBle_SendData("left=%d, right=%d\r\n", cmd.LeftSpeed, cmd.RightSpeed);
// HCBle_SendData("left=%d, right=%d\r\n", left, right);
DriveBOTH(cmd.LeftSpeed,cmd.RightSpeed); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return;
}