[Snek] Is EV3 port of Snek a good idea?

Mikhail Gusarov dottedmag at dottedmag.net
Sat Feb 8 12:45:04 PST 2020


Hi,

On 8 Feb 2020, at 20:54, Keith Packard wrote:

> Maybe expose a function which selects absolute position mode and use
> setpower to select the position? Or just expose a new function,
> setposition, which does that? I could add setposition to other Snek
> ports and have it use -1 .. 1 to set position relative to the center
> location for power functions motors?

setposition() sounds good.

Note that EV3 tachos (or at least the driver) keep the history of 
rotations,
so one can end up with position 4.5, and setposition(0) will cause motor
to rotate back 4 and half times. Sounds cheesy, but quite useful not to 
get
a whole extra/missing rotation when the position is around -1..1 
discontinuity
point, especially given the proclivity of motors to overshoot a bit.

> Probably not setpower, that's confusing. All of the current functions
> take a single value as that avoids any question about order, so
> maybe separate functions? I think there's a parallel here with the
> pull-up/pull-down configuration functions, perhaps those can be a 
> guide:

ok, I'll do 4 functions to set the mode.

>> # Gyroscope
>>
>> XXX Not even started on this yet.
>
> I assume that's measuring rotation rates? Should use the same units as
> the motor speed setting
>
> This looks really cool!

Current angular speed and cumulative rotation measured from reset:
http://docs.ev3dev.org/projects/lego-linux-drivers/en/ev3dev-stretch/sensor_data.html#lego-ev3-gyro-sensor

I suppose there is no point in selecting the mode to report only angle 
or only speed
if there is a mode to report both, so I'll set GYRO-G&A on start and 
won't
expose any configuration about it.

New versions of the sensor seem to support 2 axes, but I have an old 
version,
so I won't even try to make it work, as I can't test it anyway.

-- 
Misha


More information about the Snek mailing list