GithubHelp home page GithubHelp logo

Comments (9)

WillChen0207 avatar WillChen0207 commented on May 18, 2024

Same problem, please help us

from pyteapot-quaternion-euler-cube-rotation.

thecountoftuscany avatar thecountoftuscany commented on May 18, 2024

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?

from pyteapot-quaternion-euler-cube-rotation.

WillChen0207 avatar WillChen0207 commented on May 18, 2024

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

from pyteapot-quaternion-euler-cube-rotation.

thecountoftuscany avatar thecountoftuscany commented on May 18, 2024

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?

from pyteapot-quaternion-euler-cube-rotation.

WillChen0207 avatar WillChen0207 commented on May 18, 2024

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?

from pyteapot-quaternion-euler-cube-rotation.

thecountoftuscany avatar thecountoftuscany commented on May 18, 2024

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

from pyteapot-quaternion-euler-cube-rotation.

WillChen0207 avatar WillChen0207 commented on May 18, 2024

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!

from pyteapot-quaternion-euler-cube-rotation.

thecountoftuscany avatar thecountoftuscany commented on May 18, 2024

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

from pyteapot-quaternion-euler-cube-rotation.

RafigRzayev avatar RafigRzayev commented on May 18, 2024

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!

from pyteapot-quaternion-euler-cube-rotation.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.