4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #include "../../../sensor_data.h"
24 float arr1[3] = {1.04, -4.678, -2.34};
25 float arr2[3] = {0, 0, 1};
26 vect<float, 3> v1(arr1);
27 vect<float, 3> v2(arr2);
29 sensor_data<float> sd1(2.0, 3.0, 4.0, 140737488355328);
30 sensor_data<float> sd2(1.04, -4.678, -2.34, 0);
31 sensor_data<float> sd3(0.054, 1.097, 4.456, 140737488355328);
33 sensor_data<float> sd10(v1, 140737488355328);
34 sensor_data<float> sd11(0.2, 0.1, 0.3, 140737488355328);
36 cout << "Constructor tests\n";
37 cout << "input\t" << v1 << "\n";
38 cout << "output\t" << sd10.m_data << "\t" << sd10.m_time_stamp << "\n\n";
39 cout << "input\t" << v1 << "\n";
40 cout << "output\t" << sd2.m_data << "\t" << sd2.m_time_stamp << "\n\n";
42 cout << "Addition:\n";
43 sensor_data<float> sd4 = sd1 + sd2;
44 cout << "\n" << sd1.m_data << "\n" << sd2.m_data;
45 cout << "\nSum:\n" << sd4.m_data << endl;
46 sensor_data<float> sd9 = sd1 + sd10;
47 cout << "\n" << sd1.m_data << "\n" << sd10.m_data;
48 cout << "\nSum:\n" << sd9.m_data << endl;
50 cout << "\n\n\nNormalization:\n";
51 cout << "\n" << sd3.m_data;
53 cout << "\nResult:\n" << sd3.m_data << endl;
54 cout << "\n" << sd2.m_data;
56 cout << "\nResult:\n" << sd2.m_data << endl;
59 cout << "\n\n\nScale data:\n";
60 sensor_data<float> sd8 = scale_data(sd2, xx);
61 cout << "\n" << sd2.m_data << "\n" << xx;
62 cout << "\nResult:\n" << sd8.m_data << endl;
64 cout << "\n\n\nConvert Sensor Data to Quaternion:\n";
65 quaternion<float> q = sensor_data2quat(sd11, v2);
66 cout << "\n" << sd11.m_data << "\n" << v2;
67 cout << "\nResult:\n" << q.m_quat << endl;