Stop.COAST_SMART #1637
Replies: 3 comments 4 replies
-
|
It's probably a bit easier to see what this does by using a single motor. from pybricks.parameters import Direction, Port, Stop
from pybricks.pupdevices import Motor
motor = Motor(Port.A, Direction.CLOCKWISE)
while True:
# Try this out to compare hold, normal coast/brake and smart/coast/brake
motor.run_angle(500, 90, Stop.COAST)With When What I'll add some more notes about drivebases later. |
Beta Was this translation helpful? Give feedback.
-
|
Is there a concern with the default hold mode??? Well, I guess I would say that I am concerend that we aren't making the most of it. Last year we only used Stop.BRAKE and Stop.None (Stop.None was a late-add in the season and BOY was it helpful!). I remember doing some testing early in the season last year and for whatever reason we decided that Stop.BRAKE would be most useful for us. The season is over and we are getting ready to start programming for our base class for next year and I want to make sure we are doing it right. I don't know how familiar you are with FLL, but one thing that we do (and really, ALL teams do) is when the robot comes back from doing a mission, we quickly reconfigure the robot, get it in place and relaunch it. Most of the time, we do try to launch from square on the wall, but sometimes we do not for speed reasons. We don't want to waste time with a turn. So, imagine this use case. The robot is driving back to base, say on heading 210. We need to turn the robot around (by hand) to 42 degrees, and then relaunch it (after reconfiguring it). So, is it possible for the robot to know that instead of placing it at 42 degrees, that it is actually sitting at 44 degrees and as soon as I press the button and relaunch the robot, it will correct itself to 42 degrees and complete that drive? Is this something already built in, or would I have to program that? Or is that just a bad idea (gyro drift comes to mind)? By the way, this may also play into the use case: This whole transition I described can take somewhere between 2 and 10 seconds. So when the robot is drivivng back, we grab it as soon as it is legal and start getting ready for the next launch. So, we could be agressively turning the robot by hand while the robot thinks it is still driving (usually in the air, but I think you get the picture). We time it so the drive ends soon after getting into base, but I do wonder if that period where the robots thinks it is still driving but it actually isn't will impact our improved/proposed relaunch capability. I'm going to start doing some testing this week, but hearing from you how it is supposed to work, or how it could work, is very helpful! |
Beta Was this translation helpful? Give feedback.
-
|
Any chance of adding COAST_SMART into block coding? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
If I understand correctly, this would be a use case for COAST_SMART: Drive some distance, Stop with COAST_SMART, make a turn in place (say + 45), again using COAST_SMART and then driving some more to the final destination, and ending with COAST or BRAKE. The idea being that while I am driving the first leg, when I stop, I may not be pointed exactly on the heading that the robot was on at the start of that drive. Assuming that drive was the first thing the robot does, so the gyro would be reset to 0. Perhaps when I end, the actual heading of the robot was 2 degrees. Ideally it would be zero, but there are always inaccuracies. So when I go to do the next maneuver, turn +45, if everything was perfect, the robot would need to turn 45 degrees. But since the robot ended up at +2, and I used COAST_SMART, the robot will know that it only needs to turn 43 degrees. And since the turn in place also used COAST_SMART, if that turn overshoots by 3 degrees, the second drive command will know that it needs to correct by coming left 3 degrees and staying steady at +45.
Did I understand that correctly?
If so, what are the limitations of COAST_SMART? What happens if I drive using COAST_SMART, then instead of turning or doing something else with the drivebase, I do a wait()? Or something with the medium motors? Or set some variables and do some math? Does the next python command have to be another drivebase command for COAST_SMART to work? Or does that not matter? What about resetting the gyro heading in between movements? Or the motor encoders? Does it still know the accumulated error?
And can you explain this in a bit more detail, maybe with an example: "This will apply only if the current angle is less than twice the configured position tolerance." Because if my current angle is 45 degrees, and the position tolerance is 11 degrees, well that won't work because 45 is more than twice the position tolerance. And how do negative angles figure into the this? Because if I was at -45 degrees, then that would be less that twice to position tolerance.
Any other tips or tricks to using COAST_SMART like a boss? How about tweaking the position tolerance?
Beta Was this translation helpful? Give feedback.
All reactions