ev3dev-lang-python icon indicating copy to clipboard operation
ev3dev-lang-python copied to clipboard

SPIKE discussion

Open dwalton76 opened this issue 6 years ago • 8 comments

There are some specs available here. Highlights from the docs on the hub:

• The Hub is powered by a 100MHz M4 320 KB RAM 1M FLASH processor • 32 MB of memory for programs, sound, and content • Embedded MicroPython operating system • Provides an open platform for advanced users and third-parties

I have no experience with embedded MicroPython as an OS but it sounds interesting. I am curious how responsive it will be with only a 100Mhz CPU but it isn't booting a full linux OS so who knows maybe it will be reasonable.

Anyway, it would be cool if someday one could use the ev3dev-lang-python module to write programs for spike.

dwalton76 avatar Apr 06 '19 18:04 dwalton76

The board in the video at https://micropython.org/ is only 166Mhz but looks pretty snappy in the video.

fast start-up time from boot to loading of first script (150 microseconds to get to boot.py, on PYBv1.1 running at 168MHz)

dwalton76 avatar Apr 06 '19 18:04 dwalton76

I spoke to David a little about SPIKE and ev3dev a few weeks ago. He said he would like to keep ev3dev focused on being a linux distribution which makes sense. At some point I may create a SPIKE repo that is a micropython library the builds on the SPIKE micropython OS. I imagine that library could use a fair bit of the MoveTank (and its child classes) code from here but if I end up doing that I will just do a cut-n-paste and attribute credit/license to ev3dev-lang-python.

dwalton76 avatar Jun 08 '19 17:06 dwalton76

SPIKE is shipping now so reopening this issue for a couple of days for some discussion. The idea is create a repo here on github with micropython code that enhances what one can do with SPIKE. I imagine the code here at ev3dev-Lang-python will be a good source of inspiration for some things and close to cut-n-paste for others. I plan on starting with MoveTank, I will port it to run on SPIKE.

Questions:

  • anyone interested in working on this with me? @WasabiFan @ddemidov @dlech
  • what to name this repo? spike-dev comes to mind but I would only name it that if @dlech did not mind. Am open to suggestions on the name.

dwalton76 avatar Jan 11 '20 20:01 dwalton76

Since SPIKE Prime isn't running Linux, it doesn't really fit in the ev3dev organization. So you can name the repository whatever you like as far as I am concerned. :smile:

dlech avatar Jan 12 '20 00:01 dlech

I don't have the time (or hardware) to work on a new project right now but I'd be interested to see what you come up with!

WasabiFan avatar Jan 12 '20 00:01 WasabiFan

spikedev it is :)

https://github.com/dwalton76/spikedev

dwalton76 avatar Jan 12 '20 02:01 dwalton76

Update...from motor.py I have the Speed classes, MoveTank and MoveSteering ported over and working. Misc thoughts

  • I have yet to figure how to get the position of the motor in spike micropython
  • it terms of functionality the Motor and MoveTank API that they have is very similar to ours...the names are a little different though. The main thing they are missing is the ability to have the motor.run_XYZ calls block until the motor has stopped. My Motor class adds that and support for our Speed classes but so far that is the only functionality I’ve added at the motor level
  • they have a “motor pair” object so that made MoveTank really easy.
  • have started porting MoveDifferential. For now I am chopping the odometery support. The reason being spike doesn’t have the _thread module and I need a thread running in the background to keep track of where the robot is. Need to brainstorm on this some more.
  • no plans for MoveJoystick for now since I would need to get a web server running in micropython to be able to use it....hmm how to do that without _thread.

In general it has been fairly smooth sailing so far. All the work we did to make most things in ev3dev-lang-python work with micropython has been a huge help.

dwalton76 avatar Jan 15 '20 04:01 dwalton76

Motor movement is non blocking but there is a callback mechanism that tells you if the command was interrupted by another one, or the motor stalled, or the motion completed.

Don’t use the threading library, instead use the coroutine capability (yield) to create a simple scheduler 😏

rhempel avatar Jan 15 '20 06:01 rhempel