mirror of
https://github.com/modelec/odo_STM32.git
synced 2026-01-18 16:27:25 +01:00
new message
This commit is contained in:
@@ -91,7 +91,7 @@ void USB_Comm_Process(void) {
|
|||||||
float p, i, d, v_min, v_max;
|
float p, i, d, v_min, v_max;
|
||||||
if (Comm_GetPID(pid, p, i, d, v_min, v_max)) {
|
if (Comm_GetPID(pid, p, i, d, v_min, v_max)) {
|
||||||
char response[64];
|
char response[64];
|
||||||
snprintf(response, sizeof(response), "SET;PID;%.4f;%.4f;%.4f;%.4f,%.4f\n", p, i, d, v_min, v_max);
|
snprintf(response, sizeof(response), "SET;PID;%.4f;%.4f;%.4f;%.4f;%.4f\n", p, i, d, v_min, v_max);
|
||||||
USB_Comm_Send(response);
|
USB_Comm_Send(response);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -133,14 +133,14 @@ void USB_Comm_Process(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char response[128];
|
char response[128];
|
||||||
snprintf(response, sizeof(response), "SET;WAYPOINT;%d,%d,%.4f,%.4f,%.4f,%d\n", id, type, x, y, theta, active);
|
snprintf(response, sizeof(response), "SET;WAYPOINT;%d;%d;%.4f;%.4f;%.4f;%d\n", id, type, x, y, theta, active);
|
||||||
USB_Comm_Send(response);
|
USB_Comm_Send(response);
|
||||||
}
|
}
|
||||||
else if (strcmp(token, "MOTOR") == 0) {
|
else if (strcmp(token, "MOTOR") == 0) {
|
||||||
float l, r;
|
float l, r;
|
||||||
Comm_GetPWM(l, r);
|
Comm_GetPWM(l, r);
|
||||||
char response[64];
|
char response[64];
|
||||||
snprintf(response, sizeof(response), "SET;MOTOR;%.2f,%.2f\n", l, r);
|
snprintf(response, sizeof(response), "SET;MOTOR;%.2f;%.2f\n", l, r);
|
||||||
USB_Comm_Send(response);
|
USB_Comm_Send(response);
|
||||||
}
|
}
|
||||||
else if (strcmp(token, "ACTION") == 0) {
|
else if (strcmp(token, "ACTION") == 0) {
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ void DiffBot::update(float dt) {
|
|||||||
motor.stop(true);
|
motor.stop(true);
|
||||||
|
|
||||||
char log[32];
|
char log[32];
|
||||||
sprintf(log, "SET;WAYPOINT;%d\n", index);
|
sprintf(log, "SET;WAYPOINT;REACH;%d\n", index);
|
||||||
CDC_Transmit_FS((uint8_t*)log, strlen(log));
|
CDC_Transmit_FS((uint8_t*)log, strlen(log));
|
||||||
|
|
||||||
resetPID();
|
resetPID();
|
||||||
@@ -165,7 +165,7 @@ void DiffBot::update(float dt) {
|
|||||||
if (std::fabs(dx) < precisePos && std::fabs(dy) < precisePos) {
|
if (std::fabs(dx) < precisePos && std::fabs(dy) < precisePos) {
|
||||||
|
|
||||||
char log[32];
|
char log[32];
|
||||||
sprintf(log, "SET;WAYPOINT;%d\n", index);
|
sprintf(log, "SET;WAYPOINT;REACH;%d\n", index);
|
||||||
CDC_Transmit_FS((uint8_t*)log, strlen(log));
|
CDC_Transmit_FS((uint8_t*)log, strlen(log));
|
||||||
|
|
||||||
targets[index].active = false;
|
targets[index].active = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user