Hi,

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???

 

Please suggest....
 

0 (0 Stimmen)
RE: Physical vs Virtual sensor to ROS messages
Antwort
04.10.18 13:39 als Antwort auf Niti Rohilla.
Hello Niti,

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

The main difference between the two APIs is only that the virtual sensor API contains special features of the sensors (e.g. the BMM150, the BMI160) itself. In regards to ROS, just for clarification, you are referring to the Robot Operating System framework?

If that is the case, the best approach to send the sensor data would be to use the XDK_Sensor.h interface, which provides a slight configuration and enabling for all XDK sensors.

Additionally, you would need to make some conversion to the acceleration data, by multiplying it with the value 9810, to convert it into millimetres per square second.
Please note the data of the accelerometer is provided in millimetres per square second, which is also used for the other sensors. As such, you might need to convert the values once more by dividing them by thousand.

Furthermore, could you go more into detail about the ROS part itself?
 
  • How is the ROS message planned to be sent?
  • Which interface are you going to use?
  • How should it be built?

Maybe I can provide further assistance on this topic, too.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Stimmen)
RE: Physical vs Virtual sensor to ROS messages
Antwort
08.10.18 06:06 als Antwort auf Franjo Stjepandic.

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?
 

0 (0 Stimmen)
RE: Physical vs Virtual sensor to ROS messages
Antwort
08.10.18 11:37 als Antwort auf Niti Rohilla.
Hello Niti,

The calculations you mentioned should be valid for the accelerometer and the gyroscope.

Thank you very much for the hint about the magnetometer. You are correct, the values are provided in microtesla instead of millitesla.

In regards to the calibration, this would need to be done manually for all used sensors, while it depends on how much the values are drifting in regards to the specified accuracy of the sensors. There is, unfortunately, no other API as the calibrated sensor API available for that.

Could you please go more into detail about how much the values are actually drifting?

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Stimmen)
RE: Physical vs Virtual sensor to ROS messages
Antwort
09.10.18 10:24 als Antwort auf Franjo Stjepandic.

Hi,

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?
 

0 (0 Stimmen)
RE: Physical vs Virtual sensor to ROS messages
Antwort
10.10.18 08:29 als Antwort auf Niti Rohilla.
Hello Niti,

thank you for providing further information.

To be on the same page, you are now using the virtual sensors, in terms the BCDS_CalibratedAccel.h , BCDS_CalibratedGyro.h and BCDS_CalibratedMag.h interfaces instead of the basic interfaces from the sensor API, right?

In the VirtualXdkDemo , the BCDS_Rotation.h interface is used, which I guess points internally to the BCDS_CalibratdMag.h and BCDS_CalibratedGyro.h interface. These two require the mentioned calibration you linked for the VirtualXdkDemo .

In regards to your second question, I guess the calibrations of the sensors do not interfere with each other, since the physical signals are independent from each other.

Generally, the calibrated features are all parts of physical sensors. Receiving data from the virtual sensors results in getting data from the physical sensors first and post-process them into the data to receive. In this regard, you need to calibrate the sensors after every startup, if they are used in your XDK application.

Furthermore, could you please go more into detail about why you require a calibration of the sensor values? 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.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Stimmen)
RE: Physical vs Virtual sensor to ROS messages
Antwort
16.10.18 03:33 als Antwort auf Franjo Stjepandic.

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. 

Regards,

Niti

 

0 (0 Stimmen)
RE: Physical vs Virtual sensor to ROS messages
Antwort
16.10.18 15:13 als Antwort auf Niti Rohilla.
Hello Niti,

In regards to yourfirst question, could you please go more into detail about how you included the calibration you mentioned in you last post, since you said that the added calibration has no impact on the printed data. In general it would be possible to integrate the functionality you mentioned via the SD card and a config file placed on it.

Regarding your second question, my last explaining was might missleading to understand regarding this point. The sensor is measuring values with a minimal error due to its physical and electrical behavior. Those two behaviors define the error range of the sensor. In case of changes in that behavior, the range will change too, which results in the necessary compensation, I mentioned earlier. But those are scenarious, you don't have to worry about. While the sensor is working with his normal/specified behavior, no additional compensation is necessary regarding the changed error range.

Regarding your third question, could you please get more into detail what this matrix does?

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 Stimmen)
RE: Physical vs Virtual sensor to ROS messages
Antwort
16.10.18 16:05 als Antwort auf Franjo Stjepandic.

Hi Franjo,

 

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.

https://manialabs.wordpress.com/2012/08/06/covariance-matrices-with-a-practical-example/

Sometimes sensors datasheets provides the covariance values. Please suggest

0 (0 Stimmen)
RE: Physical vs Virtual sensor to ROS messages
Antwort
17.10.18 16:06 als Antwort auf Niti Rohilla.
Hello Niti,

Thank you for providing further information.

As mentioned, the Virtual sensor API calibrates on the start and then eliminates influences, which extends the maximal specified error range. If the physical and electrical behaviour of the sensor stays the same, no exceedings in the sensor range are possible.

Furthermore, since only one virtual sensor can be used at a time in the StreamVirtualSensordataOverUsb example, you need to consider if the calibration is necessary for your use case. If not, you could use the StreamSensorDataOverUsb example, which enables you to use more than just one virtual sensor.

Regarding the question about saving the data on the SD card, this will be only sufficient for static calibration. Dynamic calibration should be calculated within the XDK application and then applied to the sensor values.

If you are interested in saving the static calibration data onto a file, then this would be only possible via SD card. There you place a config file onto it and then read the data from it on startup. For implementing the functionality, I recommend going through the SD Card guide or through the corresponding SD card article on the XDK knowledgebase . Please note, for the XDK knowledgebase you need to register an account beforehand to get access to its content.

In regards to the covariance matrix, thank you for providing further information.

For the calculation process, it depends on how much sensor values you want to put into your sensor collection. The corresponding covariance matrix would then the quadrature number of the used sensor values as matrix elements depending on the number used sensor values.

For calculating the elements of the covariance matrix, you would simply need to apply the calculation of the discrete variance and covariance to the sensor values in your XDK application. These calculations may get more complex depending on the number of used sensor values.

As such, it would be helpful, if you could go into detail about the number of sensor values you want to calculate the covariance matrix for.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Stimmen)