Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers. Note that due to large amounts of spam attempts, your first three posts will be manually moderated, so please be patient.
We have moved to a new forum at http://jevois.usc.edu, please check it out. The forum at jevois.org/qa will not allow new user registrations but is maintained alive for its useful past questions and answers.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

Parsing serial messages from JeVois using Python doesn't work for me

0 votes
Okay, I have tried everything I can think of to get your sample program to work but no data is getting picked up. Here is what I have done:

1) confirmed that pyserial can see the port and that it is open.

2) confirm that the jevois is set to the correct resolution and that the inventor program sees the correct output

3) ensured that no other applications are using the com port and that inventor program is turned off.

Despite all that the python program still doesn't output any data. All i get it recieved: b'' over and over again.

Can anyone help me?
asked Nov 23, 2018 in Programmer Questions by tleehealey (120 points)

1 Answer

0 votes
can you post your full python code? Then we will try it here!
answered Nov 26, 2018 by JeVois (46,580 points)
I've seen this happen too with my python code. I got it to go away by unplugging the usb port from the camera and plugging it back in again. I only saw it when I was running on a headless raspberry pi. I don't think it ever happened when I was running connected to my development laptop.
First off thank you so much for responding. Here is what I have done so far (my system is a windows 10 OS and the camera normally functions perfectly):
1) I tried the exact steps you posted here: http://jevois.org/tutorials/UserParseSerial.html. The result was no output.
Code:
serdev = 'COM5' # serial device of JeVois
import serial
import time
with serial.Serial(serdev, 115200, timeout=1) as ser:
    while 1:
        line = ser.readline().rstrip()
        print("received: {}".format(line))
        tok = line.split()
        if len(tok) < 1: continue
        if tok[0] != 'N2': continue
        if len(tok) != 6: continue
        key, id, x, y, w, h = tok
        print("Found ArUco {} at ({},{}) size {}x{}".format(id, x, y, w, h))

Output:
received: b''
received: b''
received: b''
received: b''
etc...

2) when that didn't work I figured it must be that I was having trouble communicating with the usb so I tried this code:
serdev = 'COM5'
import serial
import time
with serial.Serial(serdev, 115200, timeout=1) as ser:
        while 1:
                print('com5 is open', ser.isOpen())
                print(ser.name)
                line = ser.readline().rstrip()
                print("received: {}".format(line))
This code prints:
com5 is open True
COM5
received: b''
com5 is open True
COM5
received: b''
etc....

all tests are run with the camera set as you instructed in your example and pointed at valid targets that the camera properly detects in the inventor product. Any help you can provide would be greatly appreciated. Also if you are open to it I could show you live on a webex? we can do it whatever timezone works for you. We also tried these steps on a different computer but got the same results.
...