Measure Position with XDK?
응답
16. 12. 10 오후 4:41

Hi all,

I was wondering if there was a sensor on the XDK that can measure relative position of the XDK as I am trying to record positional and rotational data to animate a 3D model. I have been looking into the inertial Measurment Unit (BMI160) as a way to estimate position but I was wondering if there was an easier solution already built into the XDK.

 

Thanks,

Eric

0 (0 투표)
RE: Measure Position with XDK?
응답
16. 12. 12 오후 2:07 as a reply to Eric Zhong.

Hello Eric,

the relative position can be estimated by measuring the orientation via the orientation sensor interface orientation.h. You only have to define a starting point and then you can calculate the relative position from the orientation data. You also need the relative position of the sensors themselves. This information is provided in this thread here. Keep in mind, if you want to measure more than the relative position, then you also have to use the accelerometer and the gyroscope as well.

Please tell me if this is a possible solution you looked for.

Kind regards,
Franjo

0 (0 투표)
RE: Measure Position with XDK?
응답
16. 12. 17 오후 7:42 as a reply to Franjo Stjepandic.

Hi Franjo,

Sorry for the late response. Thanks for this information. I was wondering if the DemoDataLogger program can combine the two sensors (BMI160 and BMM159, http://xdk.bosch-connectivity.com/xdk_docs/html/group___orientation.html#details) to read orientation data. I want to print the orientation data to an sd card using the data logger program.

Thanks,

Eric 

0 (0 투표)
RE: Measure Position with XDK?
응답
16. 12. 19 오후 5:07 as a reply to Eric Zhong.

Hello Eric,

The DataLoggerDemo does not support printing the orientation data right out of the box. If this feature is required for your specific use case you need to implement it on your own.

You have two different possibilities to implement it depending on the specific purpose. You could either use the datalogger as basis which you then need to extend: Reading of the sd card, additional interfaces for the initialisation of the orientation interface, reading the values in specified intervals and writing them to the file. The output would be an extended version of the datalogger demo.

Alternatively, if there is no need for the remaining datalogger functionality, you could start with the SdCardExample and take the required parts for reading the orientation sensor values from the sensor guide. I assume this would be way easier to implement because the functionality is limited to the orientation data only.

Kind regards,
Franjo

0 (0 투표)
RE: Measure Position with XDK?
응답
16. 12. 23 오후 3:30 as a reply to Franjo Stjepandic.

Hi Franjo,

Since I am already using the DataLogger Demo for Gyroscopic data, I tried to create an extension of the DataLogger Program. Unforunately, when I modified the code by adding the code in the sensor guide you showed me, the program consistently failed to compile. This is the error I recieved:

c:/xdk-workbench/armgcc/bin/../lib/gcc/arm-none-eabi/4.7.4/../../../../arm-none-eabi/bin/ld.exe: region RAM overflowed with stack
collect2.exe: error: ld returned 1 exit status
application.mk:90: recipe for target 'C:/Users/Feng/Desktop/DataLogger3/XDK/src/DDL_demoDataLogger/debug/DDL_demoDataLogger.out' failed
make\mingw32-make.exe[1]: Leaving directory 'C:/XDK-Workbench/SDK/xdk110/Common'
make\mingw32-make.exe[1]: *** [C:/Users/Feng/Desktop/DataLogger3/XDK/src/DDL_demoDataLogger/debug/DDL_demoDataLogger.out] Error 1
Makefile:39: recipe for target 'debug' failed
mingw32-make: *** [debug] Error 2
 

I looked online and they said I needed to reduce heap size in gcc? I was wondering if you knew a solution to this.

Thanks,

Eric

0 (0 투표)
RE: Measure Position with XDK?
응답
16. 12. 23 오후 9:58 as a reply to Eric Zhong.

Oops! I figured it out, I just changed modified the total heap size under sdk/xdk110/common/config/FreeRTOSConfig

 

0 (0 투표)
RE: Measure Position with XDK?
응답
16. 12. 23 오후 10:46 as a reply to Eric Zhong.

Hi, sorry to bother you again,

I implemented the code suggested in the orientation sensor guide into the existing BMG_160_cc.c code as I just wanted to see if it could read orientation and the BMG_160_cc.c program already had the existing format to read from the orientation sensor. I replaced reading the gyroscopic sensor with reading the orientation for quaternion values. Here is the code that I modified:

Orientation_QuaternionData_T QuaternionValues = { INT32_C(0), INT32_C(0),
    INT32_C(0) };

extern Orientation_HandlePtr_T xdkOrientationSensor_Handle;

void bmg160_getSensorValues(xTimerHandle pxTimer)
{

    Retcode_T returnValue = (Retcode_T) RETCODE_FAILURE;
    (void) pxTimer; /* suppressing warning message */

    /* read Raw sensor data */

    Retcode_T returnQuatValue = Orientation_readQuaternionValue(&QuaternionValues);
    if (RETCODE_OK == returnQuatValue)
    {
        ;
    }
    else
    {
        printf("GyrosensorReadRaw Failed\n\r");
    }

When I run the datalogger program (and move the xdk around), all it writes to the SD card are zeros. I was wondering if you knew a way to obtain the correct data?

Many thanks,

Eric

0 (0 투표)
RE: Measure Position with XDK?
응답
16. 12. 27 오후 2:11 as a reply to Eric Zhong.

Hello Eric,

It is really great that you solved the heap issue on your own.
But please be aware of modifying the SDK applies the changes you made not only to your current project. Since the SDK is linked to every project, modifying the SDK implies changes to all of your projects. 
Thus I recommend to be very careful with XDK SDK changes.

I assume only changing one existing interface requires more effort to debug than extending the datalogger functionality by a new interface. The cause of your issue is the BMG160 data structure which is based on integers while the orientation sensor data is not.
The orientation sensor data consist of float values between 0 and 1. I assume that by casting it to int, it will always be written as 0 to the SD card.

If you want to extend the functionality, I would recommend analyzing to original datalogger demo and see how the sensors there are included, and then look up how to adapt this to the orientation sensor.

Kind regards,
Franjo

0 (0 투표)
RE: Measure Position with XDK?
응답
16. 12. 28 오후 11:10 as a reply to Franjo Stjepandic.

Hello Franjo,

Thank you for all of your advice! I have gotten the program to consistently print out data from the orientation sensor.

Thanks again,

Eric

0 (0 투표)
RE: Measure Position with XDK?
응답
16. 12. 29 오후 7:05 as a reply to Eric Zhong.

Hello Eric,

Is a pleasure for me to help. I am glad to hear that you got your application working correctly now.

Please to not hesitate to ask if you have further questions.

Kind regards,
Franjo

0 (0 투표)