Limiting factors for decreasing the distance between hook and carrot. #41
Replies: 1 comment 1 reply
-
Hi Andreas, that's a great question! It took me some time to wrap my head around this concept and the decisions that lead to its implementation a while ago. But I think I remember: Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
I made some experiments with different Hook/Carrot Distances and discovered, that the smaller the carrot to hook distance is, the better the robot drives the path especially for curves:
![telegram-cloud-photo-size-4-5857354425964806242-y](https://private-user-images.githubusercontent.com/129860214/274847988-e89d854b-7037-4048-83bf-0f83714411a7.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNzkzMzcsIm5iZiI6MTczOTA3OTAzNywicGF0aCI6Ii8xMjk4NjAyMTQvMjc0ODQ3OTg4LWU4OWQ4NTRiLTcwMzctNDA0OC04M2JmLTBmODM3MTQ0MTFhNy5qcGc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQwNTMwMzdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0wOGM1YTgyYjRmMTBhMTZmOWQzOWQ2MzQyYmUyYWRlMTIzYWU3NTRiNTdlZTE0M2Y5ZTFjM2M5YzQ0NzM4MDdlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.2XTPvzCqpLAGumrO717_Bmy2MMSf06xHisCV1Zqn82U)
So in which scenarios should we choose a bigger carrot_distance?
Currently the only reason that I could find, seems to be a problem with the carrot.move() method in this line:
while hook.distance(self.offset_point) < distance:
The carrot is moved until the configured distance between carrot and hook is reached again.
But if the robot is driving faster, the drivers update interval of 100ms can be enough for the robot to drive two times the distance between hook and carrot and in that case the move() condition of the carrot is fulfilled, but the other way around.
This results in the robot switches between driving forward and backward in small intervals:
![image](https://private-user-images.githubusercontent.com/129860214/274852813-30809f8d-ab39-4027-ad62-438edd085a4f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNzkzMzcsIm5iZiI6MTczOTA3OTAzNywicGF0aCI6Ii8xMjk4NjAyMTQvMjc0ODUyODEzLTMwODA5ZjhkLWFiMzktNDAyNy1hZDYyLTQzOGVkZDA4NWE0Zi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQwNTMwMzdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iM2M4MWVhM2YzNWI3MGYyODI1YTJjMTI4MTkxNmIyNzgyOWUzZmU0MzEyMzZjNWEyMmQ2NGIyNjkxYTJlOGEzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.fJ8LlHo-f_Ny4Z1FIyXgFDTw7m6ELVn00uVDvf2rg5I)
This is the only limiting factor for decreasing the distance between carrot and hook that I could find.
Is there any other?
If not, I would suggest to adjust the logic in the carrot.move() method.
I can also try to find a solution and may create a pull request.
But before that, I want to make sure, that it makes sense.
Beta Was this translation helpful? Give feedback.
All reactions