Adding compute_gravity class and implementation 62/24462/2
authorRamasamy <ram.kannan@samsung.com>
Tue, 15 Jul 2014 04:57:45 +0000 (10:27 +0530)
committerRamasamy Kannan <ram.kannan@samsung.com>
Wed, 30 Jul 2014 02:51:40 +0000 (19:51 -0700)
 - Adding class definition and implementation of compute_gravity class
 - Adding testing code for compute_gravity class

signed-off-by: Ramasamy <ram.kannan@samsung.com>
Change-Id: I4150961ddef0f6a7a9c10a369e0355b9615a9e58

src/sensor_fusion/standalone/util/compute_gravity.cpp [new file with mode: 0644]
src/sensor_fusion/standalone/util/compute_gravity.h [new file with mode: 0644]
src/sensor_fusion/standalone/util/test/compute_gravity_test/.cproject [new file with mode: 0644]
src/sensor_fusion/standalone/util/test/compute_gravity_test/.project [new file with mode: 0644]
src/sensor_fusion/standalone/util/test/compute_gravity_test/compute_gravity_main.cpp [new file with mode: 0644]

diff --git a/src/sensor_fusion/standalone/util/compute_gravity.cpp b/src/sensor_fusion/standalone/util/compute_gravity.cpp
new file mode 100644 (file)
index 0000000..3cf6e19
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+#ifdef _COMPUTE_GRAVITY_H
+
+#include "compute_gravity.h"
+
+#define GRAVITY                9.80665
+
+template <typename TYPE>
+compute_gravity<TYPE>::compute_gravity()
+{
+
+}
+
+template <typename TYPE>
+compute_gravity<TYPE>::~compute_gravity()
+{
+
+}
+
+template <typename TYPE>
+sensor_data<TYPE> compute_gravity<TYPE>::orientation2gravity(const sensor_data<TYPE> accel,
+               const sensor_data<TYPE> gyro, const sensor_data<TYPE> magnetic)
+{
+       orientation_filter<TYPE> orien_filter;
+       euler_angles<TYPE> orientation;
+       sensor_data<TYPE> gravity;
+
+       orientation = orien_filter.get_orientation(accel, gyro, magnetic);
+
+       gravity.m_data.m_vec[0] = GRAVITY * sin(orien_filter.m_orientation.m_ang.m_vec[0]);
+       gravity.m_data.m_vec[1] = GRAVITY * sin(orien_filter.m_orientation.m_ang.m_vec[1]);
+       gravity.m_data.m_vec[2] = GRAVITY * cos(orien_filter.m_orientation.m_ang.m_vec[0]) *
+                                                                       cos(orien_filter.m_orientation.m_ang.m_vec[1]);
+
+       return gravity;
+}
+
+#endif
diff --git a/src/sensor_fusion/standalone/util/compute_gravity.h b/src/sensor_fusion/standalone/util/compute_gravity.h
new file mode 100644 (file)
index 0000000..745eb5c
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef _COMPUTE_GRAVITY_H
+#define _COMPUTE_GRAVITY_H
+
+#include "orientation_filter.h"
+
+template <typename TYPE>
+class compute_gravity {
+public:
+       orientation_filter<TYPE> estimate_orientation;
+
+       compute_gravity();
+       ~compute_gravity();
+
+       sensor_data<TYPE> orientation2gravity(const sensor_data<TYPE> accel,
+                       const sensor_data<TYPE> gyro, const sensor_data<TYPE> magnetic);
+};
+
+#include "compute_gravity.cpp"
+
+#endif /* _COMPUTE_GRAVITY_H */
diff --git a/src/sensor_fusion/standalone/util/test/compute_gravity_test/.cproject b/src/sensor_fusion/standalone/util/test/compute_gravity_test/.cproject
new file mode 100644 (file)
index 0000000..88e1d8a
--- /dev/null
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+       <storageModule moduleId="org.eclipse.cdt.core.settings">
+               <cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1091813786">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1091813786" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1091813786" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
+                                       <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1091813786." name="/" resourcePath="">
+                                               <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.255002136" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
+                                                       <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1445043365" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
+                                                       <builder buildPath="${workspace_loc:/compute_gravity_test/Debug}" id="cdt.managedbuild.target.gnu.builder.exe.debug.256420247" managedBuildOn="true" name="Gnu Make Builder.Debug" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.archiver.base.1149894111" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1566195436" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
+                                                               <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.227126937" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+                                                               <option id="gnu.cpp.compiler.exe.debug.option.debugging.level.1438087954" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.2105929867" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.893436230" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
+                                                               <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.350012261" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
+                                                               <option id="gnu.c.compiler.exe.debug.option.debugging.level.414345757" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1305446274" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.153888855" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.234553236" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.571726140" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+                                                                       <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+                                                                       <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+                                                               </inputType>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.1983093387" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1607068893" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+                                                       </tool>
+                                               </toolChain>
+                                       </folderInfo>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+               <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1717646668">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1717646668" moduleId="org.eclipse.cdt.core.settings" name="Release">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.1717646668" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
+                                       <folderInfo id="cdt.managedbuild.config.gnu.exe.release.1717646668." name="/" resourcePath="">
+                                               <toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.55401756" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
+                                                       <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.703544742" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
+                                                       <builder buildPath="${workspace_loc:/compute_gravity_test/Release}" id="cdt.managedbuild.target.gnu.builder.exe.release.495854831" managedBuildOn="true" name="Gnu Make Builder.Release" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.archiver.base.1092424788" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1807942092" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
+                                                               <option id="gnu.cpp.compiler.exe.release.option.optimization.level.1858864018" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+                                                               <option id="gnu.cpp.compiler.exe.release.option.debugging.level.1779660512" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.920009923" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1167146357" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
+                                                               <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.122519507" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
+                                                               <option id="gnu.c.compiler.exe.release.option.debugging.level.916943887" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.847199460" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.2027729811" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.858576018" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1526133730" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+                                                                       <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+                                                                       <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+                                                               </inputType>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1336440508" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.assembler.input.150720839" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+                                                       </tool>
+                                               </toolChain>
+                                       </folderInfo>
+                               </configuration>
+                       </storageModule>
+               </cconfiguration>
+       </storageModule>
+       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+               <project id="compute_gravity_test.cdt.managedbuild.target.gnu.exe.528773176" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
+       </storageModule>
+       <storageModule moduleId="scannerConfiguration">
+               <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1717646668;cdt.managedbuild.config.gnu.exe.release.1717646668.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1167146357;cdt.managedbuild.tool.gnu.c.compiler.input.847199460">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1091813786;cdt.managedbuild.config.gnu.exe.debug.1091813786.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1566195436;cdt.managedbuild.tool.gnu.cpp.compiler.input.2105929867">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1091813786;cdt.managedbuild.config.gnu.exe.debug.1091813786.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.893436230;cdt.managedbuild.tool.gnu.c.compiler.input.1305446274">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1717646668;cdt.managedbuild.config.gnu.exe.release.1717646668.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.1807942092;cdt.managedbuild.tool.gnu.cpp.compiler.input.920009923">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
+               </scannerConfigBuildInfo>
+       </storageModule>
+</cproject>
diff --git a/src/sensor_fusion/standalone/util/test/compute_gravity_test/.project b/src/sensor_fusion/standalone/util/test/compute_gravity_test/.project
new file mode 100644 (file)
index 0000000..79f09e9
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>compute_gravity_test</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+                       <triggers>clean,full,incremental,</triggers>
+                       <arguments>
+                               <dictionary>
+                                       <key>?name?</key>
+                                       <value></value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.append_environment</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+                                       <value>all</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.buildArguments</key>
+                                       <value></value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.buildCommand</key>
+                                       <value>make</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.buildLocation</key>
+                                       <value>${workspace_loc:/compute_gravity_test/Debug}</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+                                       <value>clean</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.contents</key>
+                                       <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+                                       <value>false</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+                                       <value>all</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.stopOnError</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+                                       <value>true</value>
+                               </dictionary>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+                       <triggers>full,incremental,</triggers>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.tizen.nativecpp.apichecker.core.builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.cdt.core.cnature</nature>
+               <nature>org.eclipse.cdt.core.ccnature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+               <nature>org.tizen.nativecpp.apichecker.core.tizenCppNature</nature>
+       </natures>
+</projectDescription>
diff --git a/src/sensor_fusion/standalone/util/test/compute_gravity_test/compute_gravity_main.cpp b/src/sensor_fusion/standalone/util/test/compute_gravity_test/compute_gravity_main.cpp
new file mode 100644 (file)
index 0000000..bd56100
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "../../compute_gravity.h"
+#include <stdlib.h>
+#include <iostream>
+#include <fstream>
+#include <string>
+using namespace std;
+
+#define GRAVITY_DATA_PATH "../../../../design/data/100ms/gravity/throw/"
+#define GRAVITY_DATA_SIZE 135
+
+int main()
+{
+       int data_available = GRAVITY_DATA_SIZE;
+       ifstream accel_in, gyro_in, mag_in;
+       ofstream gravity_file;
+       string line_accel, line_gyro, line_magnetic;
+       float sdata[3];
+       unsigned long long time_stamp;
+       sensor_data<float> gravity;
+       compute_gravity<float> comp_grav;
+
+       accel_in.open(((string)GRAVITY_DATA_PATH + (string)"accel.txt").c_str());
+       gyro_in.open(((string)GRAVITY_DATA_PATH + (string)"gyro.txt").c_str());
+       mag_in.open(((string)GRAVITY_DATA_PATH + (string)"magnetic.txt").c_str());
+
+       gravity_file.open(((string)"gravity.txt").c_str());
+
+       char *token = NULL;
+
+       while (data_available-- > 0)
+       {
+               getline(accel_in, line_accel);
+               sdata[0] = strtof(line_accel.c_str(), &token);
+               sdata[1] = strtof(token, &token);
+               sdata[2] = strtof(token, &token);
+               time_stamp = strtoull (token, NULL, 10);
+               sensor_data<float> accel_data(sdata[0], sdata[1], sdata[2], time_stamp);
+
+               cout << "Accel Data\t" << accel_data.m_data << "\t Time Stamp\t" << accel_data.m_time_stamp << "\n\n";
+
+               getline(gyro_in, line_gyro);
+               sdata[0] = strtof(line_gyro.c_str(), &token);
+               sdata[1] = strtof(token, &token);
+               sdata[2] = strtof(token, &token);
+               time_stamp = strtoull (token, NULL, 10);
+               sensor_data<float> gyro_data(sdata[0], sdata[1], sdata[2], time_stamp);
+
+               cout << "Gyro Data\t" << gyro_data.m_data << "\t Time Stamp\t" << gyro_data.m_time_stamp << "\n\n";
+
+               getline(mag_in, line_magnetic);
+               sdata[0] = strtof(line_magnetic.c_str(), &token);
+               sdata[1] = strtof(token, &token);
+               sdata[2] = strtof(token, &token);
+               time_stamp = strtoull (token, NULL, 10);
+               sensor_data<float> magnetic_data(sdata[0], sdata[1], sdata[2], time_stamp);
+
+               cout << "Magnetic Data\t" << magnetic_data.m_data << "\t Time Stamp\t" << magnetic_data.m_time_stamp << "\n\n";
+
+               gravity = comp_grav.orientation2gravity(accel_data, gyro_data, magnetic_data);
+
+               gravity_file << gravity.m_data;
+
+               cout << "Gravity Data\t" << gravity.m_data << "\n\n";
+       }
+
+       accel_in.close();
+       gyro_in.close();
+       mag_in.close();
+       gravity_file.close();
+
+       return 0;
+}
+