Repository navigation
Fix steering issue - #394
Conversation
|
Is this confirmed to fix the problem? The motor drivers will ignore the speed as per the note on this page:
In other words, we need to invert In regards to the sample from #393, is that the correct calling convention? I don't think we have individual parameters for the two sides' speeds for that function. I think the expected call would use the |
|
There appears to be individual parameters for the MoveTank on_for_rotations method but not the MoveSteering on_for_rotations method. I believe it is the correct calling convention because I read it directly from the develop branch code. Yes, I tested this on my own EV3 and it fixed the problem. I noticed the issue when I tried this code: Then I tried the code below to confirm the issue: After making the change proposed in my pull request, both scripts worked fine. That is, the robot turned 90 degrees as expected. Apologies if I have misinterpreted how it is meant to work. |
There was a problem hiding this comment.
Ah, I see how this works now. I was certainly looking at the wrong motor pair class. This looks good to me! (although, I'm still a bit confused as to why the sign is handled as expected.)
Note before merging: @dwalton76 Do you want to hold off on this until #391 is merged? I expect this'd just mess up our "musical chairs" and we'll need to re-apply this patch manually after that one is merged.
|
Side-note: @dwalton76 Why do we use the absolute run command with a manually-added relative position instead of just using the relative run mode? Did that make implementation of something else easier? |
|
#391 is now in, @gregcowell can you resolve the conflicts, basically just make the same change but to motor.py instead
We could have done it either way, I tend to work with absolute positions out of habit so did it that way. |
|
It took me a minute to wrap my head around how it was breaking, we were getting burned by a double negative (speed and rotations). Fix looks good. |
|
@dwalton yeah, the negative was introduced twice and as a result both motors have the same sign. But shouldn't the sign of the speed be ignored by the motor drivers? If we're now taking the absolute value of the rotation distance, where is the sign being reintroduced? |
|
This output is without the fix in place, this is for a
and debugs show so we determine left_speed and right_speed one of which is negative so then when we calculate left_rotations and right_rotations one of those will also end up negative and we are in the double negative scenario. |
na they will treat a negative speed as rotate in reverse |
|
BTW we really need to enable logging, it makes troubleshooting so much easier |
I don't mind if whether to log or not is configurable (and off by default). Otherwise logs tend to eat up disk space. |
|
If the user program importing the libraries doesn't enable logging then the log calls don't use any disk space. If the user program does enable logging then whether or not it uses disk space depends on where the user tells python to write the logs, default is to print them to STDOUT. |
This is contrary to the info I quoted above from the motor docs. @dlech has this behavior changed in Stretch? |
|
Hmm yeah I see what you mean about the docs. It certainly seems to honor positive vs negative speed in terms of which direction the motor rotates. |
Currently the |
I was wrong there, more debugging shows the negative sign from the speed was used to create a negative position_sp for one motor and positive for the other |
|
OK, I understand what's going on. Inversion is now only done here. |
Fixes #393 (MoveTank on_for_rotations method problem).