I am using the XDK to prototype traking of orientation for a handheld device that we are developing. I have been using the VirtualSensor_GetRotationData() function to get a ROTATION_QUATERNION and that has worked really well. Now I would like to get the actual sensor data that is used to create the ROTATION_QUATERNION so that I can run it through filters of our own and I am trying to understand the best way to do that.

It appears to me that since I already have a VirtualSensor, I can just call the VirtualSensor_GetCalibratedAccel(), VirtualSensor_GetCalibratedGyro() and VirtualSensor_GetCalibratedMag() functions to return the scaled x,y,z data for each sensor to run through whatever filters (Madgwick, Complimentary, etc) that I desire. Is this correct?

Also where can I find out what the default sensor setup parameters are? In my initial code I just called VirtualSensor_Setup() with a setup structure of:

static Sensor_Setup_T SensorSetup =
        {
                .CmdProcessorHandle = NULL,
                .Enable =
                        {
                                .Accel = true,
                                .Mag = true,
                                .Gyro = true,
                                .Humidity = false,        //true,
                                .Temp = false,            //true,
                                .Pressure = false,        //true,
                                .Light = true,
                                .Noise = false,            //true,
                        },
                .Config =
                        {
                                .Accel =
                                        {
                                                .Type = SENSOR_ACCEL_BMA280,
                                                .IsRawData = false,
                                                .IsInteruptEnabled = true,
                                                .Callback = AccelAppCallback,
                                        },
                                .Gyro =
                                        {
                                                .Type = SENSOR_GYRO_BMG160,
                                                .IsRawData = false,
                                        },
                                .Mag =
                                        {
                                                .IsRawData = false,
                                        },
                                .Light =
                                        {
                                                .IsInteruptEnabled = true,
                                                .Callback = LightAppCallback,
                                        },
//                                .Temp =
//                                        {
//                                                .OffsetCorrection = APP_TEMPERATURE_OFFSET_CORRECTION,
//                                        },
                        },
        };/**< Sensor setup parameters */

 

but this doesn't tell me what data range, data rate, etc. is being used. Where can I find that information?

 

0 (0 Votes)
RE: How to get sensor data for Virtual sensor
Answer
1/9/19 4:56 PM as a reply to Larry Cook.
Dear Larry,

First, I would like to welcome you to the XDK community.

To answer your question, you can, of course, run the sensor data you receive from the functions VirtualSensor_GetCalibratedAccel() , VirtualSensor_GetCalibratedGyro() and VirtualSensor_GetCalibratedMag() through any filter you desire to make further analysis.

For setting up the sensor ranges and bandwidth you can reference the sensor article .
If you have not found what you need in the guides you can also search template proposal in the sensor by pressing
ctrl + space.
You can also follow declarations by highlighting the sensorsetup and pressing F3 or
rightclicking -> open declaration , this will show you the correspoding source code.

I hope this was helpful, if you have further questions do not hesitate to ask.

Kind regards,
Franjo
0 (0 Votes)
RE: How to get sensor data for Virtual sensor
Answer
1/9/19 6:24 PM as a reply to Franjo Stjepandic.

Franjo,

Thank you for the information and the quick response. I will give these fucntion a try and also take a look at the referenced article.

I would also like to say that I have been following this message board for several months and have found the information contained in it very useful. It is one of the better support forums I have ever seen.

Thank you for your efforts.

Larry

+1 (1 Vote)
RE: How to get sensor data for Virtual sensor
Answer
1/10/19 3:59 PM as a reply to Larry Cook.
Dear Larry,

I am always glad to help and thank you for the positive feedback. We are glad to hear that the information, we hope to provide in great detail, is very useful.

Please feel free to ask if you have any kind of further concern or question.

Kind regards,
Franjo
0 (0 Votes)