Comments (5)
Are you sure that you're using the correct UID for your IMU Brick 2.0?
from generators.
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.
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.
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.
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)
- C#: Windows Phone does not dequeue CallbackQueue HOT 1
- C#: locking HOT 6
- C# 2.0: Enums HOT 1
- C# 2.0: ResponseExpected HOT 5
- Can't use generate_all.py on Python 3.3.0 HOT 3
- Semantics of SequenceNumbers HOT 3
- Update to JDK7+ HOT 2
- RFE: Function to get Device from Device ID HOT 8
- Why compatible with .NET 2.0 HOT 2
- generate_csharp_bindings.py broken? HOT 2
- IPCON_CONNECTED_CALLBACK registration is broken (C/C++ code) HOT 2
- Memory Leak HOT 1
- Optional callbacks not getting called in JavaScript. HOT 1
- Java : Add Automatic-Module-Name to manifest
- (csharp) Socket disposed after consecutive timeouts HOT 6
- Julia support HOT 1
- Broken Rust bindings due to yanked dependency HOT 2
- Crash in ip connection on invalid packet HOT 1
- After C# upgrade to 2.1.32 constantly getting disconnects on Raspberry PI HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generators.