Communication with PC whie main (or ide) is running

Hi, the OpenMW is exactly what I need in terms of size, resolution and ease to program for a scientific prototype.
Though my question might be due to the fact that I’m new to Python (I’m a C++/Windows expert), I didn’t identify a way to communicate efficiently with an USB connected PC:

  • while running through the ide, I can’t see the newly created image files (with image.save) in the file explorer
  • when running in autonomous mode, if I understand well, the USB link is disconnected.
    Very likely that the wifi module would provide a way to do this, but I’d really like to have a wire/USB connection, not wifi (or Bluetooth)
    As a downstream question, how to connect and control several OpenMWs to a single PC (by wire/USB) ?
    Thanks for your advices.
    Pascal.

Hi, windows won’t rescan the USB device until it is reconnected. If you want to see new files you have to click Tools->Reset and the drive will remount with the new files.

Anyway, while the IDE is connected the camera is in USB debug mode. The serial port is in use by the IDE. When the IDE is not connected the camera appears as a USB to serial port. https://docs.micropython.org/en/latest/pyboard/library/pyb.USB_VCP.html

Basically you just create a VCP object in your script and that’s your computer’s USB to serial connection. The baud rate at which a host connects doesn’t matter. Just don’t connect at 12000000 or 921600. The cam uses the request baud rate to go into debug mode where it stops acting like a USB to serial port. Anyway, data transfer is always done at Full Speed USB.

Many Thanks Nyamekye for the swift, clear and useful answer.
Just in case, have you ever tried to connect 2 OpenMV cams on a single PC ? From your answer, when not in debug mode, they should behave and be seen as two distinct USB memory devices ?
Thanks again, and best regards,
Pascal

Yes, both will appear as serial ports and USB devices. Our GUI autoconnects when only one is present. When you have two it will ask you for info before connecting.

See the main.py example under the basics examples.

Thanks again.
The OpenMV module and its GUI/software and concept+design is really great. The lenses are also very good: the teleobjective allows for nice macro (nearly microscopic) image acquisition (which is my interest).
Regards, Pascal.

Thanks!

It will keep getting better. Right now we’re still alpha-ish. But, the product is usable.

Hi,

the function USB_VCP.send or USB_VCP.write requires a buffer as parameter. But both “buffer” and “PY_buffer” seem unknown to the OpenMV python. Any exemple on how to use USB_VCP.send/write ?
Many thanks,
Pascal

Ok,
usb.send(img) suddenly works ( usb is a USB_VCP and img = sensor.shapshot()). Sorry for my silly question. I thought I tried it, but certainly had a typo or something.
Thanks for the attention,
Pascal.

The image object acts as a python buffer object. Meaning that you can send images bytes out of the system anytime. You can also array index the image and edit pixels directly. In gray scale the image is just 0-255 value bytes and for RGB its an RGB565 image with the byte order reversed.