Script Size Limit

Discussion related to "under the hood" OpenMV topics.
User avatar
cagiva
Posts: 78
Joined: Thu Jan 05, 2017 9:23 pm

Script Size Limit

Postby cagiva » Wed Oct 25, 2017 2:57 am

Is there a limit on the size of the python script being run from the IDE?

I'm using the OpenMV-7 board and my .py file consist of 198 lines and it's size is ~5KB, but I'm now reaching a point where I have to remove lines to be able to run it from the IDE.
User avatar
kwagyeman
Posts: 1747
Joined: Sun May 24, 2015 2:10 pm

Re: Script Size Limit

Postby kwagyeman » Wed Oct 25, 2017 3:11 am

Um, you shouldn't be anywhere near the limit with a script that small. What's the issue you are getting?

Try running some of the larger example scripts like pixy emulation.
Nyamekye,
User avatar
cagiva
Posts: 78
Joined: Thu Jan 05, 2017 9:23 pm

Re: Script Size Limit

Postby cagiva » Wed Oct 25, 2017 11:33 am

I just tested using the pixy_uart_emulation.py example and the same problem occurred. It refuses to run it (I sent you video as PM). It works fine with smaller .py examples like the helloworld.py. I running with them without the SD card inserted though.
User avatar
kwagyeman
Posts: 1747
Joined: Sun May 24, 2015 2:10 pm

Re: Script Size Limit

Postby kwagyeman » Wed Oct 25, 2017 12:17 pm

I'll run the test when I get home. That said, I just saw a video for the code. Not the code.
Nyamekye,
User avatar
cagiva
Posts: 78
Joined: Thu Jan 05, 2017 9:23 pm

Re: Script Size Limit

Postby cagiva » Wed Oct 25, 2017 1:10 pm

I didn't send you my code since I was able to reproduce it with the pixy_uart_emulation.py example.
User avatar
kwagyeman
Posts: 1747
Joined: Sun May 24, 2015 2:10 pm

Re: Script Size Limit

Postby kwagyeman » Thu Oct 26, 2017 12:35 am

Hi, this looks like the weird Mac problem we've seen forever... it's not an issue with the camera. The IDE is just not getting a response from the camera after sending the script. The script size probably has something to do with how USB packets are sent to the camera. The same script for me works on my PC with the same firmware version.

I have an idea. So, I'll be down in the South Bay area next week to support a Rocket Launch at Planet Labs (day job). While I'm down there. I can bring my USB analyzer with me and scope out the packets sent to the OpenMV Cam by the PC. Fixing this issue would be really good for our Mac users.
Nyamekye,
User avatar
kwagyeman
Posts: 1747
Joined: Sun May 24, 2015 2:10 pm

Re: Script Size Limit

Postby kwagyeman » Thu Oct 26, 2017 12:40 am

To bypass the USBDBG stack... do this. Use the Open Terminal feature to open the serial port your OpenMV Cam is on. Do this without connecting the camera. Then, hit the run button to run the script in the editor window. The script should start outputting text. To see the frame buffer just add a:

Code: Select all

print(img.compressed_for_ide())
At the end of the main loop. You should get the same performance as with the native USBDBG protocol.
Nyamekye,
User avatar
cagiva
Posts: 78
Joined: Thu Jan 05, 2017 9:23 pm

Re: Script Size Limit

Postby cagiva » Sun Dec 17, 2017 11:50 am

kwagyeman wrote:
Thu Oct 26, 2017 12:40 am
To bypass the USBDBG stack... do this. Use the Open Terminal feature to open the serial port your OpenMV Cam is on. Do this without connecting the camera. Then, hit the run button to run the script in the editor window. The script should start outputting text. To see the frame buffer just add a:

Code: Select all

print(img.compressed_for_ide())
At the end of the main loop. You should get the same performance as with the native USBDBG protocol.
I'm still having this problem with the latest IDE (v1.8.0) running on a Mac. Small scripts run fine from the IDE, but large scripts like the pixy_uart_emulation.py just don't run. However, it runs fine on Windows.

I don't really follow your instructions above. In particular where you ask to open the serial port where my OpenMV Cam is on, but do this without connecting the camera. If I don't connect the camera, then /dev/tty.usbmodem1411 is not listed. Sorry I might be missing something.
Screen Shot 2017-12-17 at 8.44.17 AM.png
Screen Shot 2017-12-17 at 8.44.17 AM.png (82.68 KiB) Viewed 763 times
User avatar
kwagyeman
Posts: 1747
Joined: Sun May 24, 2015 2:10 pm

Re: Script Size Limit

Postby kwagyeman » Sun Dec 17, 2017 4:53 pm

Hi, the Open Terminal feature needs the camera connected to the PC. What I was saying is not to press the "connect" button in the IDE. Open terminal just connects to any serial port and talks standard serial IO.

Um, I'm going to have a test image for Mac that may fix issues out this week. I'm just finish up a feature for a customer this weekend.
Nyamekye,
User avatar
cagiva
Posts: 78
Joined: Thu Jan 05, 2017 9:23 pm

Re: Script Size Limit

Postby cagiva » Sun Dec 17, 2017 5:29 pm

Got it now. Thanks for the clarification. The workaround is not ideal, but it works for now. Please let me know when I can download the fixed version to test it.

Screen Shot 2017-12-17 at 2.24.26 PM.png
Screen Shot 2017-12-17 at 2.24.26 PM.png (57.42 KiB) Viewed 758 times
User avatar
kwagyeman
Posts: 1747
Joined: Sun May 24, 2015 2:10 pm

Re: Script Size Limit

Postby kwagyeman » Thu Dec 28, 2017 4:01 pm

Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest