Skip to content

Commit ff5d681

Browse files
author
Alberto Pretto
committed
Removed dependency on pcl, added BSD license, ...
1 parent 97667a3 commit ff5d681

17 files changed

+1988
-115
lines changed

CMakeLists.txt

+37-29
Original file line numberDiff line numberDiff line change
@@ -16,62 +16,70 @@ message("${CMAKE_CXX_FLAGS_RELEASE}")
1616
find_package(Boost REQUIRED)
1717
find_package(Eigen3 REQUIRED)
1818
find_package(Ceres REQUIRED)
19-
find_package(PCL 1.6 REQUIRED)
20-
add_definitions(${PCL_DEFINITIONS})
21-
22-
set (IMU_TK_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
23-
set (IMU_TK_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib PARENT_SCOPE)
24-
set (IMU_TK_LIBS imu_tk PARENT_SCOPE)
2519

2620
include_directories(./include
2721
/usr/include
2822
${Boost_INCLUDE_DIRS}
2923
${EIGEN_INCLUDE_DIR}
30-
${CERES_INCLUDE_DIRS}
31-
${PCL_INCLUDE_DIRS})
24+
${CERES_INCLUDE_DIRS})
25+
26+
#Vis3D
27+
find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL REQUIRED )
28+
find_package(OpenGL REQUIRED)
29+
find_package(GLUT REQUIRED)
30+
31+
include_directories( ${OPENGL_INCLUDE_DIRS}
32+
${GLUT_INCLUDE_DIRS}
33+
${CMAKE_CURRENT_BINARY_DIR} )
34+
35+
set(IMU_TK_VIS_EXTRA_SOURCES
36+
./src/vis_extra/gl_camera.cpp
37+
./src/vis_extra/opengl_3d_scene.cpp )
38+
set(IMU_TK_VIS_EXTRA_HEADERS
39+
./include/imu_tk/vis_extra/opengl_3d_scene.h )
40+
41+
qt4_wrap_cpp(IMU_TK_VIS_EXTRA_HEADERS_MOC ${IMU_TK_VIS_EXTRA_HEADERS})
42+
43+
include(${QT_USE_FILE})
44+
add_definitions(${QT_DEFINITIONS})
45+
46+
aux_source_directory( ./src IMU_TK_CORE_SRC )
47+
set( IMU_TK_SRC ${IMU_TK_CORE_SRC} ${IMU_TK_VIS_EXTRA_HEADERS_MOC} ${IMU_TK_VIS_EXTRA_SOURCES} )
48+
49+
add_library(imu_tk ${IMU_TK_SRC})
50+
set_target_properties(imu_tk PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
3251

33-
34-
aux_source_directory( src IMU_TK_SRC )
52+
set (IMU_TK_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE STRING "imu_tk include directories")
53+
set (IMU_TK_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib CACHE STRING "imu_tk libraries directories")
54+
set (IMU_TK_LIBS imu_tk ${CERES_LIBRARIES} ${QT_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARY}
55+
CACHE STRING "imu_tk libraries")
3556

36-
add_library(imu_tk STATIC ${IMU_TK_SRC})
37-
target_link_libraries( imu_tk ${PCL_LIBRARIES} )
38-
set_target_properties(imu_tk PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
57+
message( "${IMU_TK_LIBS}" )
3958

4059
if( BUILD_IMU_TK_EXAMPLES )
4160

4261
add_executable(test_imu_calib apps/test_imu_calib.cpp)
43-
target_link_libraries( test_imu_calib
44-
imu_tk
45-
${CERES_LIBRARIES})
62+
target_link_libraries( test_imu_calib ${IMU_TK_LIBS})
4663

4764
set_target_properties( test_imu_calib PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
4865

4966
add_executable(test_phone_calib apps/test_phone_calib.cpp)
50-
target_link_libraries( test_phone_calib
51-
imu_tk
52-
${CERES_LIBRARIES})
67+
target_link_libraries( test_phone_calib ${IMU_TK_LIBS})
5368

5469
set_target_properties( test_phone_calib PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
5570

56-
5771
add_executable(test_imu_calib2 apps/test_imu_calib2.cpp)
58-
target_link_libraries( test_imu_calib2
59-
imu_tk
60-
${CERES_LIBRARIES})
72+
target_link_libraries( test_imu_calib2 ${IMU_TK_LIBS})
6173

6274
set_target_properties( test_imu_calib2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
6375

6476
add_executable(test_imu_calib3 apps/test_imu_calib3.cpp)
65-
target_link_libraries( test_imu_calib3
66-
imu_tk
67-
${CERES_LIBRARIES})
77+
target_link_libraries( test_imu_calib3 ${IMU_TK_LIBS})
6878

6979
set_target_properties( test_imu_calib3 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
7080

7181
add_executable(test_integration apps/test_integration.cpp)
72-
target_link_libraries( test_integration
73-
imu_tk
74-
${CERES_LIBRARIES})
82+
target_link_libraries( test_integration ${IMU_TK_LIBS})
7583

7684
set_target_properties( test_integration PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
7785

apps/test_integration.cpp

+29-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include <iostream>
22

3+
#include <QApplication>
4+
35
#include "imu_tk/io_utils.h"
46
#include "imu_tk/calibration.h"
57
#include "imu_tk/filters.h"
@@ -15,6 +17,8 @@ int main(int argc, char** argv)
1517
if( argc < 2 )
1618
return -1;
1719

20+
QApplication app(argc, argv);
21+
1822
vector< TriadData > acc_data, gyro_data, mag_data;
1923

2024
cout<<"Importing IMU data from file : "<< argv[1]<<endl;
@@ -30,25 +34,41 @@ int main(int argc, char** argv)
3034

3135
Vector3d mag_mean = dataMean( mag_data, DataInterval(100, 3000));
3236

33-
VisualizerPtr vis = createVisualizer();
37+
Vis3D vis;
3438

3539
Eigen::Vector4d quat(1.0, 0, 0, 0); // Identity quaternion
3640
double t[3] = {0, 0, 0};
37-
showFrame(vis, quat.data(), t, "ref");
38-
showLine(vis, t, mag_mean.data(), 1,1,1, "init_mag");
41+
vis.registerFrame("ref");
42+
vis.registerFrame("cur", 255, 0, 0);
43+
vis.registerLine( "init_mag" );
44+
vis.registerLine( "mag" );
45+
46+
vis.setFramePos( "ref", quat.data(), t );
47+
vis.setLinePos( "init_mag", t, mag_mean.data() );
3948

4049
for(int i = 3000; i < gyro_data.size() - 1; i++)
4150
{
42-
if( !(i%100) )
43-
std::cout<<i/100<<std::endl;
4451
double dt = gyro_data[i+1].timestamp() - gyro_data[i].timestamp();
4552

4653
quatIntegrationStepRK4( quat, gyro_data[i].data(), gyro_data[i + 1].data(), dt, quat );
47-
showFrame(vis, quat.data(), t, "cur");
48-
showLine( vis, t, mag_data[i].data().data(), 1, 1, 1, "mag" );
49-
blockVisualizer(vis, 10);
54+
vis.setFramePos( "cur", quat.data(), t );
55+
//vis.setLinePos( "mag", t, mag_data[i].data().data() );
56+
57+
if( !(i%100) )
58+
{
59+
std::cout<<i/100<<std::endl;
60+
}
61+
vis.updateAndWait(1);
5062
}
5163
std::cout<<"Done"<<std::endl;
52-
blockVisualizer(vis);
64+
//blockVisualizer(vis);
65+
//return app.exec();
66+
// while( true )
67+
// {
68+
// app.processEvents();
69+
// }
70+
//waitForKey();
71+
vis.updateAndWait();
72+
//return app.exec();
5373
return 0;
5474
}

include/imu_tk/base.h

+30-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
/*
2+
* imu_tk - Inertial Measurement Unit Toolkit
3+
*
4+
* Copyright (c) 2014, Alberto Pretto <pretto@diag.uniroma1.it>
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
129
#pragma once
230

331
#include <vector>
@@ -7,7 +35,8 @@
735

836
namespace imu_tk
937
{
10-
38+
/** @brief Simple container for a data item (e.g., timestamp + x, y, z accelerometers or
39+
* gyroscopes reading */
1140
template <typename _T > class TriadData_
1241
{
1342
public:

include/imu_tk/calibration.h

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
/*
2+
* imu_tk - Inertial Measurement Unit Toolkit
3+
*
4+
* Copyright (c) 2014, Alberto Pretto <pretto@diag.uniroma1.it>
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
129
#pragma once
230

331
#include <vector>

include/imu_tk/filters.h

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
/*
2+
* imu_tk - Inertial Measurement Unit Toolkit
3+
*
4+
* Copyright (c) 2014, Alberto Pretto <pretto@diag.uniroma1.it>
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
129
#pragma once
230

331
#include <vector>

include/imu_tk/imu_tk.h

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
/*
2+
* imu_tk - Inertial Measurement Unit Toolkit
3+
*
4+
* Copyright (c) 2014, Alberto Pretto <pretto@diag.uniroma1.it>
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
129
#pragma once
230

331
#include "imu_tk/base.h"

include/imu_tk/integration.h

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
/*
2+
* imu_tk - Inertial Measurement Unit Toolkit
3+
*
4+
* Copyright (c) 2014, Alberto Pretto <pretto@diag.uniroma1.it>
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
129
#pragma once
230

331
#include <Eigen/Core>

include/imu_tk/io_utils.h

+28
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
/*
2+
* imu_tk - Inertial Measurement Unit Toolkit
3+
*
4+
* Copyright (c) 2014, Alberto Pretto <pretto@diag.uniroma1.it>
5+
* All rights reserved.
6+
*
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
129
#pragma once
230

331
#include <vector>

0 commit comments

Comments
 (0)