G
girays
I want to make a good design about combining information. Suppose you
have different data types, and each may have semantically same data. I
want to merge these different data types into a single data at run-
time. For example, sonar sensor has two internal data (bearing and
bearing_rate), and Radar has two as well (range, bearing.
struct sonar_data {
float bearing;
float bearing_rate;
};
struct radar_data {
float bearing;
float range;
};
sonar_data sd;
sd.bearing = 5.0f;
sd.bearing_rate = 0.1f;
radar_data rd;
rd.bearing = 3.0f;
rd.range = 12.0f;
I want to combine these two data into a single data structure:
data.bearing = 4.0f // average of sd(5.0f) and rd(3.0f)
data.bearing_rate = 0.1f; // only comes from sonar_data
data.range = 12.0f; // only comes from radar_data
I don’t know how to make a good design about this problem. Do you have
any template based (or other) suggestions?
Thanks in advance...
---Sgo---
have different data types, and each may have semantically same data. I
want to merge these different data types into a single data at run-
time. For example, sonar sensor has two internal data (bearing and
bearing_rate), and Radar has two as well (range, bearing.
struct sonar_data {
float bearing;
float bearing_rate;
};
struct radar_data {
float bearing;
float range;
};
sonar_data sd;
sd.bearing = 5.0f;
sd.bearing_rate = 0.1f;
radar_data rd;
rd.bearing = 3.0f;
rd.range = 12.0f;
I want to combine these two data into a single data structure:
data.bearing = 4.0f // average of sd(5.0f) and rd(3.0f)
data.bearing_rate = 0.1f; // only comes from sonar_data
data.range = 12.0f; // only comes from radar_data
I don’t know how to make a good design about this problem. Do you have
any template based (or other) suggestions?
Thanks in advance...
---Sgo---