fix shaking

This commit is contained in:
acki
2026-03-09 19:17:35 +01:00
parent 74dde8d228
commit e47964b8af
4 changed files with 7 additions and 4 deletions

View File

@@ -63,7 +63,7 @@ public:
float preciseAngleFinal = 0.017f;
float preciseAngle = 0.39f;
float precisePosFinal = 0.0005f;
float precisePosFinal = 0.001f;
float precisePos2 = 0.02f;
float precisePos = 0.1f;

View File

@@ -25,8 +25,9 @@ public:
float y;
float theta;
bool active;
bool isAtPosition;
Point(uint8_t id = 0, StatePoint state = StatePoint::INTERMEDIAIRE, float x = 0.0, float y = 0.0, float theta = 0.0, bool active = false);
Point(uint8_t id = 0, StatePoint state = StatePoint::INTERMEDIAIRE, float x = 0.0, float y = 0.0, float theta = 0.0, bool active = false, bool isAtPosition = false);
};
#endif /* INC_POINT_H_ */

View File

@@ -141,8 +141,10 @@ void DiffBot::update(float dt_actual)
bool isAtPoint = (dist < (targets[index].state == FINAL ? precisePosFinal : precisePos));
if (isAtPoint) {
if (isAtPoint || targets[index].isAtPosition) {
if (targets[index].state == FINAL) {
targets[index].isAtPosition = true;
float finalAngleErr = normalizeAngle(targets[index].theta - pos.theta);
if (std::fabs(finalAngleErr) <= preciseAngleFinal) {

View File

@@ -2,5 +2,5 @@
#include "point.h"
Point::Point(uint8_t id, StatePoint state, float x, float y, float theta, bool active) : id(id), state(state), x(x), y(y), theta(theta), active(active) {
Point::Point(uint8_t id, StatePoint state, float x, float y, float theta, bool active, bool isAtPosition) : id(id), state(state), x(x), y(y), theta(theta), active(active), isAtPosition(isAtPosition) {
}