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.

Reading Jevois data into Python over USB

0 votes


I am trying to read data using Serial-over-USB with PyUSB. (I would also happily accept any other answer that gets me this data in Python).

For my tests, I'm using the AR demo, which gives output of the type "T2 x y", (i.e., "T2 432 -234"). I am trying to get this string into Python so I can manipulate it there.

Using screen and connecting directly to the Jevois, I do see output in that format.

However, when I connect using PyUSB, I get a long string of numbers. 

Example: [0, 0, 110, 192, 0, 128, 43, 0, 117, 192, 15, 65, 64, 31, 48, 206, 64, 245, 66, 192, 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 117, 192, 15, 65, 0, 0, 0, 0, 164, 190, 66, 192, 112, 190, 66, 192, 136, 5, 7, 192, 88, 130, 36, 192, 0, 0, 0, 0, 248, 35, 5]

Specific questions:

  • how many bytes should I read?
  • how do I translate the bytes into a string that looks like "T2 432 -234"?
asked May 31, 2018 in User questions by miriam (220 points)

2 Answers

0 votes
Best answer
Thanks for asking! We just posted a tutorial for that:


This should provide you with a start which you can modify for your own use. Also see http://jevois.org/tutorials/UserColorTracking.html for Python code that sends commands to JeVois.
answered Jun 5, 2018 by JeVois (46,580 points)
selected Jun 5, 2018 by miriam
This is great, thanks! I have it mostly working!

The only small issue I'm having is that I can't get 'setpar serstyle Normal' to stick when I put it in initscript.config. The other things I put there do work.

setpar serout USB
setmapping2 YUYV 320 240 30.0 JeVois DemoArUco

I can run 'setpar serstyle Normal' in the serial terminal and that works.
The serstyle param is a parameter of the module, so just make sure you set it after you load the module with setmapping2. If you set it before setmapping2, the setting will be applied to the current module, but then setmapping2 will unload the current module and load fresh the module specified in the setmapping2. So indeed the setting would then be lost.
0 votes
Simple answer - try using readline instead of read.

line = ser.readline()
answered Jun 5, 2018 by PeterQuinn (1,020 points)