Code Monkey home page Code Monkey logo

Comments (4)

whoenig avatar whoenig commented on August 11, 2024

I usually have a version of the decompress in my cfusdlog decoder (since I only use these with the usd card).

# decompress a quaternion, see quatcompress.h in firmware
# input: 32-bit number, output q = [x,y,z,w]
def quatdecompress(comp):
  q = np.zeros(4)
  mask = (1 << 9) - 1
  i_largest = comp >> 30
  sum_squares = 0
  for i in range(3, -1, -1):
    if i != i_largest:
      mag = comp & mask
      negbit = (comp >> 9) & 0x1
      comp = comp >> 10
      q[i] = mag / mask / np.sqrt(2)
      if negbit == 1:
        q[i] = -q[i]
      sum_squares += q[i] * q[i]
  q[i_largest] = np.sqrt(1.0 - sum_squares)
  return q

I think using FP16, or any other generic compression technique would be much nicer than having the *Z log topics hanging around. However, one would need to double check what the precision impact of that would be.

from crazyflie-lib-python.

knmcguire avatar knmcguire commented on August 11, 2024

Ah thanks! Yeah it would be good to figure it out indeed. the StateEstimateZ logs are not core log variables so we can tranfer to FP16 should be sufficient. Let's investigate

from crazyflie-lib-python.

knmcguire avatar knmcguire commented on August 11, 2024

Hmm... I'm afraid that we probably would need to implement a quadcompress/decompress in the cfilb because of this issue #372. The compressed quat is part of the full state setpoint sent and if we want to implement that into cflib we need those functions too

from crazyflie-lib-python.

knmcguire avatar knmcguire commented on August 11, 2024

this was fixed in #382

from crazyflie-lib-python.

Related Issues (20)

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.