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
Does EV3-G not provide a way to specify STOP_ACTION_HOLD when using their Motor, MoveTank, MoveSteering blocks? It doesn't look like they do which seems a little odd.
I am trying to get EV3-G running via wine so that I can check for this kind of stuff but no luck yet
I came across this thread after being tagged in something so hopefully I'm not taking this too far off topic...
Quoting from the table for the yellow blocks:
current_power = m.measure_current_power()
I understand the idea here is to obtain functionality close to EV3-G, and I could live with power and speed being used interchangeably for the green blocks, but this one is quite exceptional.
Measuring "current power" in EV3-G gives you the speed (no relation to current or power at all).
The wording is kind of justifiable in English (current = instantaneous), but if you'd install the German version of EV3-G, you'd literally see "Measure electrical current" (But it still gives you the speed 😄)
tldr; Keep the picture in the table as is, but maybe just write: speed = m.measure_speed()
Totally on topic. The tables show word-for-word in Python, what the EV3-G blocks says just for clarity. The idea is that in the actual implementation, they get cleaned up where appropriate.
If default is hold and the user ctrl-C their program we will leave the motor with power being applied to hold it in place. Thoughts on how we can gracefully set the stop_action to coast when the program exits (without the user coding this into their program)? We could add a __del__ to the Motor class that does this but from googling folks think that implementing a __del__ in python is a horrible sin.
That is why you run your program with brickrun, it stops motors, sound, etc.
__del__ is for releasing unmanaged resources, like file handles, when an object is garbage collected. There is no guarantee when or even if an object is garbage collected, so it cannot be relied upon for anything that must happen.
For all of these on_for_XYZ() functions do we want the power that we pass it to be a percentage of max_speed from -100% to 100% or do we want this to be the actual speed_sp? Make take is they should be a percentage from -100 to 100 but we need to reach a consensus on this.
On one hand, we could switch to our own scientific units; it would make the behavior of "speed" better-defined than if it were a percentage, but that requires documentation and it's easy to miss. On the other hand, using percentages would make the interface dramatically more intuitive for a typical user.
I think it comes down to this question: can we adequately document the special behavior? Where would we put the info?
Activity
ddemidov commentedon Sep 20, 2017
We could merge various
on_for_*methods intoHere
on_forcould be defined asdwalton76 commentedon Sep 20, 2017
Does EV3-G not provide a way to specify
STOP_ACTION_HOLDwhen using their Motor, MoveTank, MoveSteering blocks? It doesn't look like they do which seems a little odd.I am trying to get EV3-G running via wine so that I can check for this kind of stuff but no luck yet
ddemidov commentedon Sep 20, 2017
I think
holdis ev3dev specific.dlech commentedon Sep 20, 2017
brakeis ev3dev-specific.holdin ev3dev == Brake in EV3-G.http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/motors.html#sysfs
laurensvalk commentedon Sep 20, 2017
I came across this thread after being tagged in something so hopefully I'm not taking this too far off topic...
Quoting from the table for the yellow blocks:
I understand the idea here is to obtain functionality close to EV3-G, and I could live with power and speed being used interchangeably for the green blocks, but this one is quite exceptional.
Measuring "current power" in EV3-G gives you the speed (no relation to current or power at all).
The wording is kind of justifiable in English (current = instantaneous), but if you'd install the German version of EV3-G, you'd literally see "Measure electrical current" (But it still gives you the speed 😄)
tldr; Keep the picture in the table as is, but maybe just write: speed = m.measure_speed()
dlech commentedon Sep 20, 2017
Totally on topic. The tables show word-for-word in Python, what the EV3-G blocks says just for clarity. The idea is that in the actual implementation, they get cleaned up where appropriate.
dwalton76 commentedon Sep 20, 2017
If default is
holdand the user ctrl-C their program we will leave the motor with power being applied to hold it in place. Thoughts on how we can gracefully set the stop_action tocoastwhen the program exits (without the user coding this into their program)? We could add a__del__to the Motor class that does this but from googling folks think that implementing a__del__in python is a horrible sin.dlech commentedon Sep 20, 2017
That is why you run your program with
brickrun, it stops motors, sound, etc.__del__is for releasing unmanaged resources, like file handles, when an object is garbage collected. There is no guarantee when or even if an object is garbage collected, so it cannot be relied upon for anything that must happen.dwalton76 commentedon Sep 20, 2017
Does brickman set the stop_action to
coast? If so that sounds good to me. Idlech commentedon Sep 20, 2017
brickruntotally resets the motor, including removing power (setting to to coast)dwalton76 commentedon Sep 20, 2017
For all of these
on_for_XYZ()functions do we want thepowerthat we pass it to be a percentage of max_speed from -100% to 100% or do we want this to be the actualspeed_sp? Make take is they should be a percentage from -100 to 100 but we need to reach a consensus on this.WasabiFan commentedon Sep 20, 2017
On one hand, we could switch to our own scientific units; it would make the behavior of "speed" better-defined than if it were a percentage, but that requires documentation and it's easy to miss. On the other hand, using percentages would make the interface dramatically more intuitive for a typical user.
I think it comes down to this question: can we adequately document the special behavior? Where would we put the info?
dlech commentedon Sep 21, 2017
How about we make the default units % just like EV3-G, plus introduce scaling factor constants for those who want scientific units.
dlech commentedon Sep 21, 2017
But we should name our parameter
speedinstead ofpower😉dwalton76 commentedon Sep 21, 2017
Works for me
ddemidov commentedon Sep 21, 2017
why not
m.run(speed_pct=50),m.run(dps=400), andm.run(rpm=60)? If we definerunaswe could also just use
m.run(50)instead ofm.run(speed_pct=50). Personally, I think this makes a cleaner interface.WasabiFan commentedon Sep 21, 2017
@ddemidov you could still call the run method with one positional argument and it would work as-is (with the version in your code block), right?
ddemidov commentedon Sep 21, 2017
Yes:
dwalton76 commentedon Sep 21, 2017
We have other parameters that need to be passed in though (
speed) so basically everything becomes a positional arg. So the user would do one ofThat looks ok to me...one thing nice about forcing the
arg=syntax is it makes the code very readable