Community news, upcoming events and general discussions
Threads: 36 Posts: 88
Get technical support from the community
Threads: 1427 Posts: 7608
Threads: 18 Posts: 64
Tell us how to make XDK better!
Threads: 36 Posts: 119
Share and discuss community member projects
Threads: 81 Posts: 350
XDK provides two set of sensors i.e Physical and virtual sensors. What is the difference between these two sensors?
I want to get the data from all the sensors and map it to ROS messages. What APIs should I use to get the data from the XDK.
As per my understanding, accelerometer only for example, XDK has two accelerometers:
1. Accelerometer - BMA280 2. IMU (Acceleromter + Gyroscope) - BMI160
XDK gives physical APIs to get the data from BMA280 and BMI160(accelerometer part) in the form of physical units as well as digital data. These APIs are:
1. Accelerometer_readXyzGValue() - Physical accelrometer data that is measured in earth acceleration g 2. Accelerometer_readXyzLsbValue() - Digital Accelerometer Data in bytes
But the data provided by these apis are not in the format that can directly be mapped to ROS messages because ROS expects accelerometer data as linear acceleration in meters per second square (m/s^2).
On the other hand, Virtual sensor provide the APIs to get the data from combined accelerometer and gyroscope BMI160 (as per the documentation - XDK sensors guide). It provides the following apis:
1. CalibratedAccel_readXyzLsbValue() : Reads 'LSB' xyz values from calibrated accelerometer. 2. CalibratedAccel_readXyzGValue() : Reads 'g' xyz values from calibrated accelerometer. 3. CalibratedAccel_readXyzMps2Value() : Reads 'm/(s^2)' xyz values from calibrated accelerometer.
So the virtual sensor provides the API : CalibratedAccel_readXyzMps2Value() that gives the data in the format that directly be mapped to ROS message linear acceleration. But as per my understanding of the code, only one virtual sensor can be enabled at a time and it should be enabled at compile time so how can I get calibrated accelerometer and gyroscope data at one time?
What APIs should I use to get the data from the XDK to map to ROS message???
Thanks for your reply.
Yes, you are right. ROS means Robot Operating System framework.
So if I am using the api Accelerometer_readXyzGValue() to get the accelerometer data, then as per the XDK sensor Guide, it returns the data in milli g. To convert it to meters per second square, firstly I need to convert it from milli G to G by dividing by 1000. Then will convert from G to meters per second square by multiplying by 9.81 for each axis.
For Gyroscope, If I use the api Gyroscope_readXyzDegreeValue() which returns the data in milli degree, to convert it from milli degree to radian per second, I should divide the data by 1000 to convert from milli degree to degree then multiply by 0.01745329251994 to convert from degree to radian per second.
For Magnetometer, If I use the api Magnetometer_readXyzTeslaData() which return the data in milli tesla, to convert it from milli tesla to tesla, I should divide the data by 1000. In XDK sensor guide documentation it is saying that it return the data in milli tesla and in XDK API code it is saying its micro tesla. Please confirm which one is right?
Also, I want to know how to calibrate the XDK sensors and how to get the calibrated data?? Data is drifting.. Is there any API to get the calibrated data other than virtual sensor APIs?
Thanks Franjo for your reply and the clarification.
I am able to get the data from two virtual sensors at a time i.e. accelerometer and gyroscope. I have not calibrated the sensor after flashing the code to XDK. I am printing the data inside the if condition which checks the calibration accuracy which should be CALIBRATED_ACCEL_HIGH and I am able to get the data succesfully. Which means that sensor has reached the high calibration accuracy without even calibrating it manually.
So I hove few queries regarding the same:
1. As u mentioned we have to calibrate the sensor manually. But as I mentioned above without even calibrating it manually it is printing the data. Even after I calibrated it there is no difference in data. Is it necessary to manually calibrate the sensor?
2. If I enable multiple or all virtual sensors at a time, then how do we calibrate all the sensors? Does the calibration of one sensor will impact the calibration of the other sensor if all are enabled??
3. As per the XDK's Virtual XDK Demo application documentation - "After starting the virtual XDK application on XDK, the sensors need to be calibrated. This has to be done after each startup of XDK, no matter if initiated by XDK Workbench (clicking reboot or flash) or by switching XDK off and on". Do we need to calibrate the XDK manually after every on/off??
4. Can we calibrate physical sensors and get calibrated data for physical sensors?
Thanks Franjo for helping me to understand the virtual sensors. But I have few more queries:
1. Is there any way that the calibration information can be stored to a file and can be loaded on XDK startup so that we don't need to calibrate the XDK manually on every startup.
2. As you said, As far as I can observe, the provided sensor values are in the range within the maximal possible error for each sensor. A calibration would only deliver results regarding errors extending this range. For these errors, a compensation would then be necessary.
What does the compensation means? How can we do that?
3. How can I calculate the covariance matrix for IMU i.e. accelerometer, gyroscope etc.
Regarding the first query, I was using the virtual sensor calibration api to get the data. I uploaded the StreamVirtualSensordataOverUSB code on XDK and i was getting the data. And you suggested i calibrated the device by moving it +-90 degree to left right but there was no change in the data. That is what I was referring to in my earlier post.
Can u please suggest how can I store the calculate or the calibration details to a file and load it to XDK on startup so that I dont need to calibrate it manually.
Coviance Matrix: This link can explain in a better way. Covariance matrices are a way of describing the relation between a collection of variables.
Sometimes sensors datasheets provides the covariance values. Please suggest