Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

Hello ,

 

I'm using Python 3.6.

 

I can run the example to emunerate my device.

When I'm using example_simple.py from IMU brick 2.0.

I have an error message from  imu.get_quaternion()

 

in get_quaternion

    return GetQuaternion(*self.ipcon.send_request(self, BrickIMU.FUNCTION_GET_QUATERNION, (), '', 'f f f f'))

 

  File "C:\Users\JPannetier\Anaconda3\lib\site-packages\tinkerforge\ip_connection.py", line 1194, in send_request

    return unpack_payload(response[8:], form_ret)

 

  File "C:\Users\JPannetier\Anaconda3\lib\site-packages\tinkerforge\ip_connection.py", line 251, in unpack_payload

    x = struct.unpack(f, data[:length])

 

error: unpack requires a buffer of 4 bytes

 

Thank you

Best regard

Geschrieben
  • Autor

Hi Photron,

 

Exactly.

I have a IMU Brick 2.0.

And I have this error when i'm using your example of IMU Brick 2.0....

 

Best regard

Geschrieben
  • Autor

I'm using a Brick IMU 2.0 with its example :

https://www.tinkerforge.com/en/doc/Software/Bricks/IMUV2_Brick_Python.html#simple

 

When I opened the source of Brick IMU 2.0, i can notice :

Into communication.c :

 

void get_quaternion(const ComType com, const GetQuaternion *data) {

GetQuaternionReturn gqr;

 

gqr.header        = data->header;

gqr.header.length = sizeof(GetQuaternionReturn);

gqr.x            = sensor_data.qua_x;

gqr.y            = sensor_data.qua_y;

gqr.z            = sensor_data.qua_z;

gqr.w            = sensor_data.qua_w;

 

send_blocking_with_timeout(&gqr, sizeof(GetQuaternionReturn), com);

}

 

And into communication.h

 

typedef struct {

MessageHeader header;

int16_t w;

int16_t x;

int16_t y;

int16_t z;

} __attribute__((__packed__)) GetQuaternionReturn;

 

 

 

 

Geschrieben

The error message above comes from the IMU Brick 1.0 bindings. You can see it from the names and also because of the "f f f f", since the 1.0 IMU returned floats while the new one returns ints.

 

Please download the example again from here https://www.tinkerforge.com/en/doc/Software/Bricks/IMUV2_Brick_Python.html#simple and try it again.

Geschrieben
  • Autor

Super,

 

It's working now.

Sorry for my mistake.

Thank you very much for your support.

 

Best regard Jérôme

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.