Giter Club home page Giter Club logo

Comments (5)

photron avatar photron commented on June 29, 2024

Are you sure that you're using the correct UID for your IMU Brick 2.0?

from generators.

generalazure avatar generalazure commented on June 29, 2024

I am using the same UID that is shown in Brick Viewer and that works fine for getting sensor measurements. I've created a minimal example:

IPConnection ipcon;
ipcon_create(&ipcon);
IMUV2 imu;
imu_v2_create(&imu, "6QF9YH" , &ipcon);
int ret = ipcon_connect(&ipcon, "localhost", 4223);
uint8_t magRate, gyroRange, gyroBandwidth, accRange, accBandwidth;
ret = imu_v2_get_sensor_configuration(&imu, &magRate, &gyroRange, &gyroBandwidth, &accRange, &accBandwidth);
int8_t temp;
ret = imu_v2_get_temperature(&imu, &temp);

Executing the code above in VS2013 x64 debug mode gives me a correct temp (currently 31), but 204 for all config values. The return value of all 3 calls is 0.

from generators.

photron avatar photron commented on June 29, 2024

I tested this with VS 2015 and it works for me.

Are you using the latest C/C++ bindings (2.1.15) and the latest IMU Brick 2.0 firmware (2.0.8)? If not, does ist make a difference if you update?

Could you test the following example with the modified ip_connection.c from this gist and show me its output?

https://gist.github.com/photron/fc3af20746305ad8ae46c4182e9f237f

#include <stdio.h>

#include "ip_connection.h"
#include "brick_imu_v2.h"

int main(void) {
	IPConnection ipcon;
	ipcon_create(&ipcon);
	IMUV2 imu;
	imu_v2_create(&imu, "6QF9YH" , &ipcon);
	int ret = ipcon_connect(&ipcon, "localhost", 4223);
	printf("A %d\n", ret);
	uint8_t magRate, gyroRange, gyroBandwidth, accRange, accBandwidth;
	ret = imu_v2_get_sensor_configuration(&imu, &magRate, &gyroRange, &gyroBandwidth, &accRange, &accBandwidth);
	printf("B %d %d %d %d %d %d\n", ret, magRate, gyroRange, gyroBandwidth, accRange, accBandwidth);
	int8_t temp;
	ret = imu_v2_get_temperature(&imu, &temp);
	printf("C %d %d\n", ret, temp);
	imu_v2_destroy(&imu);
	ipcon_destroy(&ipcon);
	return 0;
}

The modified IP connection will dump the raw requests and responses. The output should look similar to this.

A 0
S 8: 48 22 56 197 8 42 40 0 -> 0
R 13: 48 22 56 197 13 42 40 0 5 0 7 1 3 -> 0
B 0 5 0 7 1 3
S 8: 48 22 56 197 8 4 56 0 -> 0
R 9: 48 22 56 197 9 4 56 0 36 -> 0
C 0 36

from generators.

generalazure avatar generalazure commented on June 29, 2024

Good call about the firmware version, updating from 2.0.4 to 2.0.8 solved the issue. Response packet length is 5 bytes more now and the contained values make sense. Guess I should run updates more often.
Anyway, thanks for the help :)

from generators.

photron avatar photron commented on June 29, 2024

The imu_v2_get_sensor_configuration function was added in firmware version 2.0.5. Therefore, firmware 2.0.4 should respond with an error and the C/C++ bindings should return E_NOT_SUPPORTED (-10). But there was a bug in the firmware, that made the Brick not correctly report an error in this case. That's why imu_v2_get_sensor_configuration returned 0, while it should actually have returned E_NOT_SUPPORTED (-10). This bug was fixed a while ago.

Your problem was trying to call imu_v2_get_sensor_configuration with a firmware that does't have that function yet, but also has a bug that makes it report this incorrectly. So nothing to fix here actually.

from generators.

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.