kebhr / scratch3-tello

Let's fly Tello with Scratch 3.0 !
https://scratch3-tello.app/
Other
86 stars 34 forks source link

Drone command buffer acts weird #20

Closed Rubiksmath closed 1 year ago

Rubiksmath commented 1 year ago

I can't say for sure if this is an issue with the drone itself or the version of the scratch 3 tello I am using, but putting fairly simple code like when I press right arrow, move some amount of distance to the right results in unintended outcomes. It takes off fine and I can press right arrow and it moves right, however because I pressed right for more than 1 frame and the drone takes more than 1 frame to move it just executes that command over and over and over and over until it hits a wall or it runs out of commands that have built up in the queue. I've tried using clear command queue but that seems to cause it to ignore a lot of commands. Perhaps it is an issue with how I am coding it and the scratch code has to be more complex, but all I really want to achieve as as follows: a pretty intuitive keyboard control that when you use arrow keys it moves the direction you press until you let go and is then able to respond to you pressing another direction pretty quickly. If that isn't possible due to limitations in the drone, then I understand.

kebhr commented 1 year ago

@Rubiksmath Currently, what you are trying to implement cannot be done with Scratch3-Tello. As you write, drone movement commands, no matter how short the distance, require many frames. This is because when you send one move command, the drone moves, stops, and waits until the next command is ready to be executed. However, it is not possible to keep pressing right, but if you only press right for a moment, it will work as expected.

kebhr commented 1 year ago

I close this issue due to inactivity. Please reopen it if you still facing the problem.