This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ESP32
#1
Hello,

I've an esp32 and a board "m5stack" which include a mpu9250. I've bought planning to code an autopilot with it, but then i discovered pypilot.

Do you think it will be difficult to port pypilot to these boards ? (i've not yet looked the code of pypilot). Since m5stack support micropython, have a screen, the mpu9250, wifi, etc... it would be a good choice to keep a pilot without raspberry. I know python but i don't know the limitations of micropython (perhaps you don't know too Smile


Congratulations for making this pilot, it's the missing opensource part of sailing for the moment.
  Reply
#2
moving this threat to pypilot forum
  Reply
#3
(05-17-2018, 05:58 AM)quetzal Wrote: Hello,

I've an esp32 and a board "m5stack" which include a mpu9250. I've bought planning to code an autopilot with it, but then i discovered pypilot.

Do you think it will be difficult to port pypilot to these boards ? (i've not yet looked the code of pypilot). Since m5stack support micropython, have a screen, the mpu9250, wifi, etc... it would be a good choice to keep a pilot without raspberry. I know python but i don't know the limitations of micropython (perhaps you don't know too Smile  


Congratulations for making this pilot, it's the missing opensource part of sailing for the moment.
I do hope to support micropython. As far as I know it should be possible.

It would be worth the effort to support smaller platforms.

The key features I am unsure of:
1) multiprocessing -- This is probably the most difficult to deal with.   Pypilot uses several processes to offload to avoid stalling the control loop. and enable processing elsewhere when waiting for data transfers.   It should be possible to make it work with a single process for proof of concept, but some type of prioritised threading is prefered.   
2) networking (sockets) -- possibly already supported over wifi anyway for remote control and config
3) filesystem -- or the ability to read and write to just a single file to store configuration
4) 520kb ram -- is it enough?  I think probably, but not sure how efficient micropython is

The part reading from i2c would need to be ported from linux devices but I don't think it would be too difficult, the same for commanding the motor over a serial port to the controller.

I think certain features like the webserver for browser control would be difficult without a rewrite, but this is not really that important initially.   The existing LCD menu interface can probably be ported.

So... yes it's possible, but I don't have the hardware at this time or I might try it.
  Reply
#4
(05-17-2018, 09:54 PM)seandepagnier Wrote: 4) 520kb ram -- is it enough?  I think probably, but not sure how efficient micropython is


My ESP8266 unit, known to be sold in bulk on Ebay as the black PCB version = AI-Thinker ESP-01 with 1MB memory. I think 512MB is nowhere to find anymore.
  Reply
#5
I don't think ram will be a problem (I think my m5stack has 4mb ram but standard esp32 520kb).
Esp32 is multithread and more important, multi-core (2 physicals cores) so it will not be too difficult to keep the separated thread splitted.
I will take a look on the code of pypilot as soon as i've some free time Smile
  Reply
#6
With enough ram, like 4mb, it should be possible to run an rtos like freertos or chibirtos, and in each thread run an instance of micropython. From there, it would be possible to implement the standard python multiprocessing library including communications pipes. This might make it possible to use pypilot with few modifications which is preferred since linux will continue to be the development environment (for ease of debugging etc..) Of course, they will have separate stacks and can't share garbage collection, but it should be fine.

It also might be possible to compile it with cython and run that using an rtos rather than micropython.

The other option, is, if dual core, use one core for the autopilot control loop and sensors, and the other core for data requests and automatic calibration. This probably would basically work as well.

The m5 stack is more expensive than the raspberry pi zero. The main advantages I can see are lower power and faster boot time although the raspberry is already acceptable. And possibly they could drive something like VNH2SP30 directly without a separate microprocessor for the controller.

micropython is definately missing some standard modules, but they should be possible to reimplement for our use.

I would research this more, but at this time I don't have the hardware.
  Reply
#7
Hello,
i am a huge fan of opencpn and on the webpage i discovered the pypilot plugin and your system.
very nice good job.
i want to do a similar thing , an all round board computer with autopilot and bought there for an Udoo x86 board
https://www.udoo.org/udoo-x86/
and want to use fairwindsystem
http://www.fairwindsystem.com/en - which seems to gone a bit sleepy in progressing -
i think i go with your system first , to get a functioning autopilot running.......
  Reply
#8
Yes, I recommend raspberry pi because they are stable and we have images that work automatically. It is unlikely that myself or sailoog will produce working images for anything else in the near future.

Anything running linux with i2c, and a uart should basically work without any modifications to pypilot. I have run it an several different boards, so I am pretty sure this includes the udoo but I don't have one to tell you.
  Reply
#9
Freertos is the standard OS for m5stack (and perhaps for esp32 ? I'm not sure), and micropython is the official way to develop for m5stack.
I think m5stack is worth the cost because for 40-45$ you get the esp32, the color screen, the mpu9250, the battery (which is not very usefull for us, perhaps only to not loose calibration ?), the sd card reader, the speaker, etc.... Standard ESP32 is damn cheap too.

I'm not affiliated in any way with m5stack or esp32 Smile
I don't know micropython but i've programmed many server side software with standard python, so i will look in pypilot.
I've look in the version i've, it's not the 4mb ram (so i don't know how much ram i've, it's not very good documented).

The only thing to add is the motor controller.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)