You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BaseRegulatedMotor.getTachoCount() flips to negative? #670
Next week, I am going to review the history about the usage of polarity and I will reply.
Maybe exist a way to improve the quality of data, but data data is provided by the EV3Dev runtime.
It is a Bug in the implementation.
I have fixed it. I am going to verify the solution with a System Test with the EV3.
The reason to use Polarity is historical. In the code exist 2 classes: BaseRegulatedMotor & BasicMotor. In Basic motor, exist a protected method to upgrade the state.
Note to thread pools: I think we will have to cache and/or share them, because native threads could be quite expensive regarding both their startup time and memory footprint. However I have no data yet to back this up. Maybe the JVM is clever and caches this behind the scenes and the effect also may not be dramatic.
Activity
JakubVanek commentedon Jun 18, 2019
Hi,
this seems to be caused by the use of the polarity parameter:
ev3dev-lang-java/src/main/java/ev3dev/actuators/lego/motors/BaseRegulatedMotor.java
Lines 134 to 141 in 9d02a05
ev3dev-lang-java/src/main/java/ev3dev/actuators/lego/motors/BaseRegulatedMotor.java
Lines 149 to 156 in 9d02a05
Instead of doing the inversion (which should be set to 'normal'), a negative speed_sp/duty_cycle_sp should be written.
Regards,
Jakub
jabrena commentedon Sep 1, 2019
Hi @salamanders, I was checking your information. The information from tacho is returned by the runtime.
ev3dev-lang-java/src/main/java/ev3dev/actuators/lego/motors/BaseRegulatedMotor.java
Lines 112 to 118 in 9e5c269
Next week, I am going to review the history about the usage of polarity and I will reply.
Maybe exist a way to improve the quality of data, but data data is provided by the EV3Dev runtime.
10 remaining items
jabrena commentedon Sep 2, 2019
It is a Bug in the implementation.
I have fixed it. I am going to verify the solution with a System Test with the EV3.
The reason to use Polarity is historical. In the code exist 2 classes:
BaseRegulatedMotor&BasicMotor. In Basic motor, exist a protected method to upgrade the state.http://www.lejos.org/ev3/docs/lejos/hardware/motor/BaseRegulatedMotor.html
http://www.lejos.org/nxt/nxj/api/lejos/nxt/BasicMotor.html
http://www.lejos.org/nxt/nxj/api/lejos/nxt/BasicMotor.html#updateState(int)
Forward has a polarity
Backward has inverse polarity
Another reason is about the consistency. The speed in many examples in LeJOS are positive. Using polarity, always the speed is positive.
Tomorrow, I will create a small example to verify that tachoMotor has a consistent value when the motor is running forward or backward.
Thanks @salamanders & @JakubVanek
I continue
salamanders commentedon Sep 3, 2019
Fantastic - thank you so much!
jabrena commentedon Sep 3, 2019
Defining a TestSample to review the changes in branch: #670
jabrena commentedon Sep 3, 2019
@salamanders
Take a look the logs:
And sourcecode:
jabrena commentedon Sep 3, 2019
Creating a PR.
jabrena commentedon Sep 3, 2019
Example refactored with Java 8+ syntax:
JakubVanek commentedon Sep 4, 2019
Note to thread pools: I think we will have to cache and/or share them, because native threads could be quite expensive regarding both their startup time and memory footprint. However I have no data yet to back this up. Maybe the JVM is clever and caches this behind the scenes and the effect also may not be dramatic.