Skip to content

Commit 2092187

Browse files
SeptimiuVanaandreidanila1
authored andcommitted
packages: Create imu analyzer package.
Signed-off-by: andreidanila1 <[email protected]>
1 parent 156087e commit 2092187

18 files changed

+1380
-0
lines changed

packages/imu/CMakeLists.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#
2+
# Copyright (c) 2025 Analog Devices Inc.
3+
#
4+
# This file is part of Scopy
5+
# (see https://www.github.com/analogdevicesinc/scopy).
6+
#
7+
# This program is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
#
20+
21+
cmake_minimum_required(VERSION 3.9)
22+
23+
set(SCOPY_MODULE imu)
24+
set(CURRENT_PKG_PATH ${CMAKE_CURRENT_SOURCE_DIR})
25+
set(PACKAGE_NAME ${SCOPY_MODULE})
26+
27+
set(PACKAGE_DISPLAY_NAME "IMU Analyzer")
28+
set(PACKAGE_DESCRIPTION "This package provides support for adis.")
29+
message(STATUS "building package: " ${SCOPY_MODULE})
30+
31+
project(scopy-package-${SCOPY_MODULE} VERSION 0.1 LANGUAGES CXX)
32+
33+
configure_file(manifest.json.cmakein ${SCOPY_PACKAGE_BUILD_PATH}/${SCOPY_MODULE}/MANIFEST.json @ONLY)
34+
35+
include_emu_xml(${CMAKE_CURRENT_SOURCE_DIR}/emu-xml ${SCOPY_PACKAGE_BUILD_PATH}/${SCOPY_MODULE}/emu-xml)
36+
message(STATUS "Including plugins for ${SCOPY_MODULE}")
37+
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plugins)
38+
add_plugins(${CMAKE_CURRENT_SOURCE_DIR}/plugins ${SCOPY_PACKAGE_BUILD_PATH}/${SCOPY_MODULE}/plugins)
39+
install_plugins(
40+
${SCOPY_PACKAGE_BUILD_PATH}/${SCOPY_MODULE}/plugins
41+
${SCOPY_PACKAGE_INSTALL_PATH}/${SCOPY_MODULE}/plugins "scopy"
42+
)
43+
endif()
44+
45+
install_pkg(${SCOPY_PACKAGE_BUILD_PATH}/${SCOPY_MODULE} ${SCOPY_PACKAGE_INSTALL_PATH}/${SCOPY_MODULE})
46+
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
47+
set(INSTALLER_DESCRIPTION "${PACKAGE_DISPLAY_NAME} ${PACKAGE_DESCRIPTION}")
48+
configureinstallersettings(${SCOPY_MODULE} ${INSTALLER_DESCRIPTION} TRUE)
49+
endif()

packages/imu/manifest.json.cmakein

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"id": "imu",
3+
"title": "IMU Analyzer",
4+
"version": "@PROJECT_VERSION@",
5+
"description": "IMU Evaluation Software Package",
6+
"license": "LGPL",
7+
"author": "Analog Devices Inc.",
8+
"download_link": "",
9+
"zip_checksum": "",
10+
"scopy_compatibility": ["@CMAKE_PROJECT_VERSION@"],
11+
"category": ["iio", "plugin"]
12+
}
13+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include/imuanalyzer/scopy-imuanalyzer_export.h
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#
2+
# Copyright (c) 2025 Analog Devices Inc.
3+
#
4+
# This file is part of Scopy
5+
# (see https://www.github.com/analogdevicesinc/scopy).
6+
#
7+
# This program is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# This program is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
#
20+
21+
cmake_minimum_required(VERSION 3.9)
22+
23+
set(SCOPY_MODULE imuanalyzer)
24+
25+
message(STATUS "building plugin: " ${SCOPY_MODULE})
26+
27+
project(scopy-${SCOPY_MODULE} VERSION 0.1 LANGUAGES CXX)
28+
29+
include(GenerateExportHeader)
30+
31+
# TODO : split stylesheet / resources and add here TODO : export header files correctly
32+
33+
set(CMAKE_CXX_STANDARD 17)
34+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
35+
36+
set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/ui)
37+
set(CMAKE_AUTOUIC ON)
38+
set(CMAKE_AUTOMOC ON)
39+
set(CMAKE_AUTORCC ON)
40+
41+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
42+
43+
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
44+
set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE)
45+
46+
set(SCOPY_QT_COMPONENTS Core Widgets)
47+
48+
file(GLOB SRC_LIST src/*.cpp src/*.cc)
49+
file(GLOB HEADER_LIST include/${SCOPY_MODULE}/*.h include/${SCOPY_MODULE}/*.hpp)
50+
file(GLOB UI_LIST ui/*.ui)
51+
52+
set(ENABLE_TESTING ON)
53+
if(ENABLE_TESTING)
54+
add_subdirectory(test)
55+
endif()
56+
57+
set(PROJECT_SOURCES ${SRC_LIST} ${HEADER_LIST} ${UI_LIST})
58+
59+
find_package(
60+
Qt${QT_VERSION_MAJOR}
61+
COMPONENTS ${SCOPY_QT_COMPONENTS}
62+
REQUIRED
63+
Core
64+
Gui
65+
Widgets
66+
3DCore
67+
3DExtras
68+
3DRender
69+
3DInput
70+
)
71+
72+
add_library(
73+
${PROJECT_NAME} SHARED
74+
${PROJECT_SOURCES}
75+
include/imuanalyzer/imuanalyzerinterface.hpp
76+
include/imuanalyzer/scenerenderer.hpp
77+
include/imuanalyzer/bubblelevelrenderer.hpp
78+
include/imuanalyzer/imuanalyzerutils.hpp
79+
include/imuanalyzer/imuanalyzersettings.hpp
80+
src/datavisualizer.cpp
81+
include/imuanalyzer/datavisualizer.hpp
82+
# ${PROJECT_RESOURCES}
83+
)
84+
85+
generate_export_header(
86+
${PROJECT_NAME} EXPORT_FILE_NAME ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE}/${PROJECT_NAME}_export.h
87+
)
88+
89+
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
90+
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/${SCOPY_MODULE})
91+
92+
target_include_directories(${PROJECT_NAME} PUBLIC scopy-pluginbase scopy-gui)
93+
target_include_directories(
94+
${PROJECT_NAME}
95+
PRIVATE ${IIO_INCLUDE_DIRS}
96+
scopy-gui
97+
scopy-iio-widgets
98+
scopy-iioutil
99+
${OPENGL_INCLUDE_DIRS}
100+
${GLUT_INCLUDE_DIRS}
101+
)
102+
103+
foreach(comp ${SCOPY_QT_COMPONENTS})
104+
set(SCOPY_QT_LIBRARIES ${SCOPY_QT_LIBRARIES} Qt${QT_VERSION_MAJOR}::${comp})
105+
endforeach()
106+
107+
target_link_libraries(
108+
${PROJECT_NAME}
109+
PUBLIC Qt::Widgets
110+
Qt::Core
111+
scopy-pluginbase
112+
scopy-gui
113+
scopy-iioutil
114+
scopy-iio-widgets
115+
Qt5::Core
116+
Qt5::Gui
117+
Qt5::Widgets
118+
Qt5::3DCore
119+
Qt5::3DExtras
120+
Qt5::3DRender
121+
Qt5::3DInput
122+
)
123+
124+
set(PLUGIN_NAME ${PROJECT_NAME} PARENT_SCOPE)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (c) 2025 Analog Devices Inc.
3+
*
4+
* This file is part of Scopy
5+
* (see https://www.github.com/analogdevicesinc/scopy).
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
21+
#ifndef BUBBLELEVELRENDERER_H
22+
#define BUBBLELEVELRENDERER_H
23+
24+
#include "imuanalyzerutils.hpp"
25+
#include "scopy-imuanalyzer_export.h"
26+
#include "plotwidget.h"
27+
#include <plotaxis.h>
28+
29+
#include <QWidget>
30+
#include <QPainter>
31+
#include <QVBoxLayout>
32+
33+
namespace scopy {
34+
35+
class SCOPY_IMUANALYZER_EXPORT BubbleLevelRenderer : public QWidget
36+
{
37+
Q_OBJECT
38+
public:
39+
BubbleLevelRenderer(QWidget *parent = nullptr);
40+
//~BubbleLevelRenderer();
41+
42+
public Q_SLOTS:
43+
void setRot(data3P rot, data3P pos, float temp);
44+
void setDisplayPoints(QString displayP);
45+
46+
private:
47+
data3P m_rot;
48+
QVector<double> xLinePoint{90, 90};
49+
QVector<double> yLinePoint{3, 3};
50+
PlotWidget *plotWidget;
51+
QwtPlotCurve *point;
52+
QString m_displayPoints;
53+
54+
public:
55+
};
56+
} // namespace scopy
57+
#endif // BUBBLELEVELRENDERER_H
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright (c) 2025 Analog Devices Inc.
3+
*
4+
* This file is part of Scopy
5+
* (see https://www.github.com/analogdevicesinc/scopy).
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
*/
20+
21+
#ifndef DATAVISUALIZER_HPP
22+
#define DATAVISUALIZER_HPP
23+
24+
#include "scopy-imuanalyzer_export.h"
25+
#include <QWidget>
26+
#include <QPlainTextEdit>
27+
#include <QVBoxLayout>
28+
#include <QHBoxLayout>
29+
30+
#include "imuanalyzerutils.hpp"
31+
32+
namespace scopy {
33+
34+
class DataVisualizer : public QWidget
35+
{
36+
Q_OBJECT
37+
public:
38+
DataVisualizer(QWidget *parent = nullptr);
39+
40+
public Q_SLOTS:
41+
void updateValues(data3P rot, data3P pos, float temp);
42+
43+
private:
44+
data3P m_rot, m_deltaRot;
45+
float temp = 0.0f;
46+
QPlainTextEdit *m_accelTextBox, *m_linearATextBox, *m_magnTextBox, *m_tempTextBox;
47+
};
48+
} // namespace scopy
49+
50+
#endif // DATAVISUALIZER_HPP
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright (c) 2025 Analog Devices Inc.
3+
*
4+
* This file is part of Scopy
5+
* (see https://www.github.com/analogdevicesinc/scopy).
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
*
20+
*/
21+
22+
#ifndef IMUANALYZER_H
23+
#define IMUANALYZER_H
24+
25+
#define SCOPY_PLUGIN_NAME IMUAnalyzer
26+
27+
#include "scopy-imuanalyzer_export.h"
28+
#include "imuanalyzerinterface.hpp"
29+
30+
#include <QLineEdit>
31+
#include <QObject>
32+
33+
#include <QLabel>
34+
#include <QPushButton>
35+
#include <QTextEdit>
36+
#include <QWidget>
37+
#include <toolbuttons.h>
38+
#include <tooltemplate.h>
39+
#include "qloggingcategory.h"
40+
41+
#include <pluginbase/plugin.h>
42+
#include <pluginbase/pluginbase.h>
43+
#include "style.h"
44+
45+
#include <iio.h>
46+
#include <iioutil/connectionprovider.h>
47+
48+
namespace scopy {
49+
50+
class SCOPY_IMUANALYZER_EXPORT IMUAnalyzer : public QObject, public PluginBase
51+
{
52+
Q_OBJECT
53+
SCOPY_PLUGIN;
54+
55+
public:
56+
void initMetadata() override;
57+
bool compatible(QString m_param, QString category) override;
58+
void loadToolList() override;
59+
60+
bool onConnect() override;
61+
bool onDisconnect() override;
62+
bool loadIcon() override;
63+
64+
private:
65+
IMUAnalyzerInterface *m_imuInterface;
66+
};
67+
68+
} // namespace scopy
69+
70+
#endif // IMUANALYZER

0 commit comments

Comments
 (0)