Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application: Black screen, not-responding #11

Closed
RafigRzayev opened this issue Jun 2, 2022 · 9 comments
Closed

Application: Black screen, not-responding #11

RafigRzayev opened this issue Jun 2, 2022 · 9 comments

Comments

@RafigRzayev
Copy link

Hi,

I tried to run the application on my Windows, but the window is black and is not responding. I believe it is same issue as mentioned in #5

Below you can find the screenshots describing the issue and my prerequisites installation:
screenshotpy

Captureimu

I guess I have some dependency missing, but I don't get any kind of error. If someone has done Windows installation could you please guide what to do regarding other pre-requisites?

@WillChen0207
Copy link

Same problem, please help us

@thecountoftuscany
Copy link
Owner

It seems like you have the the dependencies installed. Did you configure the UDP IP if using WiFi, or set useSerial to True if using serial port for communication (and also set the right serial port in place of /dev/ttyUSB0)? Try using the serial port first to see if it works. If the problem is with using UDP sockets, perhaps @Takaklas can help since they implemented that functionality?

@WillChen0207
Copy link

WillChen0207 commented Jul 27, 2022

Glad to receive your response.
I confirmed thet I had the dependencies installed already and changed useSerial to True as you suggested. Anyway I'm trying to test my new-bought IMU sensor, but the program always gets stuck and when it exit the error info is:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf8 in position 0: invalid start byte

I tried to change utf-8 to gbk, ascii, gb2312, etc. , but none of them works. Can you help me out?
Thanks again

@thecountoftuscany
Copy link
Owner

Is there an error stack trace? Any traceback to which line the error originates? Also, which version of python are you using? Are you already sending the IMU data on your computer's serial port in the format mentioned in the readme? Did you change to that particular serial port in the code?

@WillChen0207
Copy link

WillChen0207 commented Jul 27, 2022

The full error stack trace is as below:

Traceback (most recent call last):
File "C:/.../PyTeapot-Quaternion-Euler-cube-rotation/pyteapot.py", line 203, in
main()
File "C:/.../PyTeapot-Quaternion-Euler-cube-rotation/pyteapot.py", line 43, in main
[yaw, pitch, roll] = read_data()
File "C:/.../PyTeapot-Quaternion-Euler-cube-rotation/pyteapot.py", line 102, in read_data
line = ser.readline().decode('UTF-8').replace('\n', '')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf8 in position 0: invalid start byte

My python version is 3.8.8.
I just used official upper machine software of this IMU and confirmed my PC reads the data correctly. As I am new in this area, I just change my setting as that of the upper machine, like this:

useSerial = True # set true for using serial for data transmission, false for wifi
useQuat = False # set true for using quaternions, false for using y,p,r angles
if(useSerial):
import serial
ser = serial.Serial('com5', 115200)
else:
import socket
...

Did I set those params correctly? Or the data from IMU needs to be formatted as some standards first?

@thecountoftuscany
Copy link
Owner

Yes the IMU data needs to be formatted as defined in the readme (see the String passed over Serial or WiFi section). You can connect the IMU to a microcontroller like Arduino and write a simple program to read the IMU data and send it on your computer's serial port in the format specified in the readme. Also, I just ran my application on Windows for the first time and it ran perfectly fine. Just reiterating the steps I performed from scratch (you can ignore steps 2, 3 if you wrote a program to send your IMU's actual data on the serial port):

  1. pip install pygame PyOpenGL PySerial
  2. Since I don't have a physical device to send IMU data over serial port, I used com0com to fake a pair of virtual COM ports (labelled COM11 (Tx), COM12 (Rx)) on Windows.
  3. Wrote a bare minimum python script to send fake data on the Tx COM port:
import serial
ser = serial.Serial('COM11', 38400)
while True:
    ser.write(b'w0.09wa-0.12ab-0.09bc0.98cy168.8099yp12.7914pr-11.8401r\n')
ser.close()
  1. Set useSerial to True and used the right COM port (in my case COM12).
    I had to do nothing else for the program to work.
    Here's a screenshot:
    image

@WillChen0207
Copy link

WillChen0207 commented Jul 27, 2022

Thank you, I believe that's the problem.
I'll try later and thanks again.

Updated(28th July, 2022).
I changed my settings and now the program runs well. Thanks!

@thecountoftuscany
Copy link
Owner

Sure no problem. Closing issue for now, feel free to reopen if it still doesn't work.

@RafigRzayev
Copy link
Author

I changed following lines and it is working now:
useSerial = False
to
useSerial = True

ser = serial.Serial('/dev/ttyUSB0', 38400)
to
ser = serial.Serial('COM6', 115200)

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants