wip
This commit is contained in:
@@ -53,10 +53,14 @@ void TripControllerClass::Stop() {
|
||||
MotorsController->SetMoveSpeed({0 , 0});
|
||||
}
|
||||
|
||||
void TripControllerClass::RotateToHeading(double heading, uint timeout) {
|
||||
void TripControllerClass::RotateToHeading(double heading, uint timeout = 0) {
|
||||
int16_t delta = angle_difference(Compass->GetHeading(), heading);
|
||||
int16_t lastDelta = delta;
|
||||
|
||||
if (timeout <= 0) {
|
||||
timeout = 10000 + abs(delta) * 100;
|
||||
}
|
||||
|
||||
u_int32_t startTime = millis();
|
||||
while ((delta < -10 || delta > 10 || abs(delta) < abs(lastDelta)) && millis() <= startTime + timeout)
|
||||
{
|
||||
@@ -71,12 +75,16 @@ void TripControllerClass::RotateToHeading(double heading, uint timeout) {
|
||||
}
|
||||
}
|
||||
|
||||
void TripControllerClass::GoTo(geo_pos &pos, u_int8_t speed, uint timeout) {
|
||||
void TripControllerClass::GoTo(geo_pos &pos, u_int8_t speed, uint timeout = 0) {
|
||||
geo_pos origin = GnssService->GetPosition();
|
||||
double bearing = bearing_to(origin, pos);
|
||||
double distance = distance_to(origin, pos);
|
||||
log_d("Bearing : %.1f distance : %.2f");
|
||||
|
||||
if (timeout <= 0 && speed > 0) {
|
||||
timeout = 30000 + (distance / speed) * 2000000;
|
||||
}
|
||||
|
||||
uint32_t startTime = millis();
|
||||
|
||||
RotateToHeading(bearing, min(timeout, 20000u));
|
||||
|
||||
8
work.gcode
Normal file
8
work.gcode
Normal file
@@ -0,0 +1,8 @@
|
||||
G0 X-146 Y-882
|
||||
G1 X-4798 Y2497
|
||||
G1 X-11560 Y-6810
|
||||
G1 X-4495 Y-11850
|
||||
G1 X1089 Y-6304
|
||||
G1 X-2298 Y-3843
|
||||
G1 X-146 Y-882
|
||||
M30
|
||||
Reference in New Issue
Block a user