mirror of
https://github.com/modelec/odo_STM32.git
synced 2026-03-18 21:30:38 +01:00
fix shaking
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user