OpenMV IDE 1.9.0 "stopping" issue

General discussion about topics related to OpenMV.
User avatar
aakoch
Posts: 24
Joined: Wed Dec 06, 2017 11:07 pm

OpenMV IDE 1.9.0 "stopping" issue

Postby aakoch » Wed May 09, 2018 10:42 pm

I downloaded the new IDE, version 1.9.0, and sometimes when I click on the stop button (the red X), instead of stopping, the camera LEDs all turn on (white) and the IDE doesn't respond. Eventually the OS reports that the device was removed. I'm on macOS High Sierra. Anyone else having any problems?
User avatar
kwagyeman
Posts: 2403
Joined: Sun May 24, 2015 2:10 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby kwagyeman » Sun May 13, 2018 3:43 pm

Hi, we updated the IDE software to add more timeouts for Mac. We found this to be the issue with the camera having problems. We wait 50 ms after the last polling command sent the camera on Mac to issue stop and 50 ms afterwards. Does this issue happen every time? Getting all white LEDs means a fatal error.
Nyamekye,
bogflap
Posts: 35
Joined: Mon Apr 16, 2018 10:03 am

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby bogflap » Wed May 16, 2018 5:07 am

I get this problem fairly regularly. Hit the stop cross and I get a white light on my M7. OS sees the M7 as disconnected. Sometimes I get a corrupt SD card. I am assuming that the IDE exception that you get is interrupting a file IO operation hence the SD card corruption.
It would be nice if there were some way of of flagging to a script that a halt has been requested. Then the script could terminate gracefully under program control.
I am looking at attaching some switches to the M7 GPIO so that an ISR can set a flag that my scripts can use to terminate gracefully with. Instead of a while(True) statement I can then use a while(<flag not set>).
Much nicer if this could be implemented in some way through the IDE
I am using IDE V1.9.0, OS is Linux (openSUSE Leap 42.2).
User avatar
kwagyeman
Posts: 2403
Joined: Sun May 24, 2015 2:10 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby kwagyeman » Thu May 17, 2018 10:44 am

Things should be rather solid on linux... I haven't tried on openSUSE however.

Can you create a bug for this on the openmv cam firmware page?

Also, can you share the firmware that causes the issue here? I'd like to test and see why.
Nyamekye,
bogflap
Posts: 35
Joined: Mon Apr 16, 2018 10:03 am

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby bogflap » Thu May 17, 2018 12:13 pm

Ooops! Bit of a drop off there. Firmware version is 2.9.0.
User avatar
kwagyeman
Posts: 2403
Joined: Sun May 24, 2015 2:10 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby kwagyeman » Thu May 17, 2018 12:39 pm

Great, can you share the script that's having issues?
Nyamekye,
bogflap
Posts: 35
Joined: Mon Apr 16, 2018 10:03 am

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby bogflap » Fri May 18, 2018 4:05 am

Ok. The code i am using is as below
Note that all the io is happening because i was tracking down why the image held in the allocated frame buffer was getting corrupted.
I suspect that one of the routines, such as find_blobs, is using the memory without checking to see if it is in use.
That is just a theory.
The code may not make a lot of sense as this is a snapshot of where I am in my current investigations.
The overall task is to detect movement and to save a clean image of the frame where movement was detected.
I found in my use case your method of using percentiles did not work very well

Code: Select all

import sensor, image, time

PixelsThreshold = 250
IntensityThreshold = [(50, 255)]
LastImageFile = "LastImage.bmp"
LastDifferenceFile = "DifferenceImage.bmp"

# Pretty standard start up code
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)
sensor.set_vflip(True)
sensor.set_hmirror(True)
sensor.set_auto_whitebal(False) # Turn off white balance.
sensor.skip_frames(time = 2000) # Let new settings take affect.
clock = time.clock() # Tracks FPS.

# Special case of the first frame where there is no previous frame to work with
firstFrame = True

thisImage = None
tmpImage = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)

while(True):
    clock.tick()

    if firstFrame:
        firstFrame = False
        tmpImage.replace(sensor.snapshot())
        tmpImage.to_grayscale()
        tmpImage.save(LastImageFile)
        continue

    thisImage = sensor.snapshot()
    thisImage.save("thisImage.bmp")
    tmpImage.replace(thisImage)
    tmpImage.save("replace.bmp")
    tmpImage.to_grayscale()
    tmpImage.save("tmpImageToGrayscale.bmp")
    tmpImage.difference(LastImageFile)
    tmpImage.save(LastDifferenceFile)

    blobs = tmpImage.find_blobs(IntensityThreshold, pixels_threshold = PixelsThreshold)

    for blob in blobs:
        thisImage.draw_rectangle(blob.rect())

    print(clock.fps(), len(blobs))

    # Image no longer available in colour after this point
    thisImage.to_grayscale()
    thisImage.save(LastImageFile)
User avatar
kwagyeman
Posts: 2403
Joined: Sun May 24, 2015 2:10 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby kwagyeman » Fri May 18, 2018 10:52 am

Hi, we just got a bug report of a pointer possibly not being checked in our list code from another user and this causing an issue. The problem is like in find blobs. The weird thing is... This issue would have been in the firmware for years now and yet the method appears to work still.

Anyway, I'm at Maker Faire today and this weekend but I can get this fixed if it's and issue with find blobs. Ibrahim may jump in if he can.
Nyamekye,
User avatar
kwagyeman
Posts: 2403
Joined: Sun May 24, 2015 2:10 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby kwagyeman » Sat May 19, 2018 10:28 am

Hi, Ibrahim is working on this issue and will release a patch firmware. We previously fixed this issue before a long time ago but it appears to have come back again when we updated MicroPython.
Nyamekye,
bogflap
Posts: 35
Joined: Mon Apr 16, 2018 10:03 am

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby bogflap » Sat May 19, 2018 2:22 pm

Quick work good response, looking forward to the patch firmware
User avatar
aakoch
Posts: 24
Joined: Wed Dec 06, 2017 11:07 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby aakoch » Sun May 20, 2018 4:31 pm

I don't get this every time. Actually, today was going pretty well but the IDE wasn't recognizing the camera and I created a new file and ran it when all the LEDs came on again. So, I don't think it is related to find_blobs in my case.

In fact, I saved the default "new" file and was able to get it to fail on the first time of resetting the camera and running it.

Setup:
1. connect camera in IDE
2. create new file
3. save script to camera, stripping new lines
4. reset camera via menu in IDE
5. re-connect camera via menu in IDE
6. run script in IDE
7. stop script in IDE

At this point all the LEDs turned on and the camera eventually disconnected from the OS.
User avatar
aakoch
Posts: 24
Joined: Wed Dec 06, 2017 11:07 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby aakoch » Sun May 20, 2018 4:35 pm

Another question: was there a change that made all the LEDs flash when hitting stop (even when successful)? I never noticed this before.
User avatar
aakoch
Posts: 24
Joined: Wed Dec 06, 2017 11:07 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby aakoch » Sun May 20, 2018 5:00 pm

I was playing around with a script that was just using the LEDs and the fatal error never happened. But only after 3 starts and stops with the default "new file" script it happened.
User avatar
iabdalkader
Posts: 595
Joined: Sun May 24, 2015 3:53 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby iabdalkader » Mon May 21, 2018 5:07 pm

Hi,

Can you test the attached firmware ? It should fix the stop issue.

Note: Yes I think I changed the LEDs reset recently (it's okay).
Attachments
firmware.zip
(1.09 MiB) Downloaded 13 times
User avatar
aakoch
Posts: 24
Joined: Wed Dec 06, 2017 11:07 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby aakoch » Mon May 21, 2018 9:10 pm

I tried it but still got a fatal error. Here are the steps:

1. Ran bootloader
2. Created new file
3. Ran script
4. Stopped script
5. Ran script
6. Stopped script
7. Reset camera
8. Un- then Re-plugged USB
9. Connected
10. Ran script
11. Stopped script
Fatal error
User avatar
iabdalkader
Posts: 595
Joined: Sun May 24, 2015 3:53 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby iabdalkader » Mon May 21, 2018 9:13 pm

By fatal error do you mean the camera restarts or gets stuck in a loop ? The issue I was seeing is random stop/exec cause the camera to hardfault and restart.
User avatar
kwagyeman
Posts: 2403
Joined: Sun May 24, 2015 2:10 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby kwagyeman » Sat Jun 09, 2018 1:53 pm

What's the status on all of this?
Nyamekye,
User avatar
iabdalkader
Posts: 595
Joined: Sun May 24, 2015 3:53 pm

Re: OpenMV IDE 1.9.0 "stopping" issue

Postby iabdalkader » Sat Jun 09, 2018 2:02 pm


Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest