Interesting observation on motor runs #2022
Replies: 2 comments 6 replies
-
PXL_20250603_181748298.3.mp4I have noticed something very similar. I am testing a very simple program which has the drivebase go straight back, then hold 250ms, then straight forward. After the hold, one motor always starts just a moment before the other, causing a waggle. It's always the same motor, so the waggle is always in the same direction. If I switch the motors to each other's ports, the waggle then goes in the opposite direction, so I wonder if it might something inside the motor itself that's responsible? |
Beta Was this translation helpful? Give feedback.
-
|
By default, all drive base motions use Stop.HOLD. When you do subsequent movements, it will continue to adjust. Since the motors can wiggle around a bit, this can appear to cause some movement, but it is generally better for performance overall. Basically, it is able to make additional corrections the next time it gets moving. If you'd rather not have this, you can use Stop.COAST. Or just call drivebase.stop(). You generally shouldn't reset or reinitialize motors. If it appears to help here, that is likely because resetting them will happen to also coast them. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Our team has noticed this for a while and hasn't have good solution to resolve it.
Here is the code:
It is simply make a 90 degree turn and back a small distance(50mm). What we observed is when it backs, the 2 motors don't run at the same time, there is always one starting earlier which causes the motor swing a little bit instead of moving straight. Our guess is the PID kicks in but the distance is too small to make it fully work, so you can see that small swing at the beginning.
Here is the video:
Turn and Move
However, if we move the turn and just let the robot go back, even with a small distance (same 50mm), it can go straight without that swing. Then we guess it is because of the turn prior to the straight. There must be something introduced by the turn function to the motor that makes the PID kicks in with a huge initial error it thinks it should correct.
And we changed our code to this:
It basically adds the motor close and re-initiate then create a new drive base. It magically resolves the problem.
Here is the video: Turn and move with motor resetting
Hope it can help other teams. Also could someone help to explain this to us and let us know if there is better way to do it?
Beta Was this translation helpful? Give feedback.
All reactions