diff --git a/scenarios/MetaWearIMU/MetaWearIMU.scx b/scenarios/MetaWearIMU/MetaWearIMU.scx new file mode 100644 index 0000000000000000000000000000000000000000..4afe52b26fe45ded4c69195a340be4ff2e887462 --- /dev/null +++ b/scenarios/MetaWearIMU/MetaWearIMU.scx @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<scenario name="MetaWearIMU" creation="2017-04-13.11:40:16" lastChange="2017-04-13.11:40:16" globalConfigName="./config/global.cfg" package="RobotAPI"> + <application name="MetaWearIMUObserverApp" instance="" package="RobotAPI" enabled="true"/> + <application name="MetaWearIMUApp" instance="" package="RobotAPI" enabled="true"/> +</scenario> + diff --git a/scenarios/MetaWearIMU/config/MetaWearIMUApp.cfg b/scenarios/MetaWearIMU/config/MetaWearIMUApp.cfg new file mode 100644 index 0000000000000000000000000000000000000000..4adf5c5a0a56e6483a81abe9cd1e9f3d9356ae0d --- /dev/null +++ b/scenarios/MetaWearIMU/config/MetaWearIMUApp.cfg @@ -0,0 +1,172 @@ +# ================================================================== +# MetaWearIMUApp properties +# ================================================================== + +# ArmarX.AdditionalPackages: List of additional ArmarX packages which should be in the list of default packages. If you have custom packages, which should be found by the gui or other apps, specify them here. Comma separated List. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +# ArmarX.AdditionalPackages = Default value not mapped. + + +# ArmarX.ApplicationName: Application name +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.ApplicationName = "" + + +# ArmarX.CachePath: Path for cache files +# Attributes: +# - Default: ${HOME}/.armarx/mongo/.cache +# - Case sensitivity: no +# - Required: no +# ArmarX.CachePath = ${HOME}/.armarx/mongo/.cache + + +# ArmarX.Config: Comma-separated list of configuration files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.Config = "" + + +# ArmarX.DataPath: Semicolon-separated search list for data files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.DataPath = "" + + +# ArmarX.DefaultPackages: List of ArmarX packages which are accessible by default. Comma separated List. If you want to add your own packages and use all default ArmarX packages, use the property 'AdditionalPackages'. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +# ArmarX.DefaultPackages = Default value not mapped. + + +# ArmarX.DependenciesConfig: Path to the (usually generated) config file containing all data paths of all dependent projects. This property usually does not need to be edited. +# Attributes: +# - Default: ./config/dependencies.cfg +# - Case sensitivity: no +# - Required: no +# ArmarX.DependenciesConfig = ./config/dependencies.cfg + + +# ArmarX.DisableLogging: Turn logging off in whole application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.DisableLogging = 0 + + +# ArmarX.EnableProfiling: Enable profiling of CPU load produced by this application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.EnableProfiling = 0 + + +# ArmarX.MetaWearIMU.EnableProfiling: enable profiler which is used for logging performance events +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMU.EnableProfiling = 0 + + +# ArmarX.MetaWearIMU.MetaWearPythonTopicName: Name of the topic provided by the python driver +# Attributes: +# - Default: MetaWearPythonData +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMU.MetaWearPythonTopicName = MetaWearPythonData + + +# ArmarX.MetaWearIMU.MetaWearTopicName: Name of the MetaWear topic +# Attributes: +# - Default: MetaWearData +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMU.MetaWearTopicName = MetaWearData + + +# ArmarX.MetaWearIMU.MinimumLoggingLevel: Local logging level only for this component +# Attributes: +# - Default: Undefined +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMU.MinimumLoggingLevel = Undefined + + +# ArmarX.MetaWearIMU.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMU.ObjectName = "" + + +# ArmarX.RedirectStdout: Redirect std::cout and std::cerr to ArmarXLog +# Attributes: +# - Default: 1 +# - Case sensitivity: no +# - Required: no +# ArmarX.RedirectStdout = 1 + + +# ArmarX.RemoteHandlesDeletionTimeout: The timeout (in ms) before a remote handle deletes the managed object after the use count reached 0. This time can be used by a client to increment the count again (may be required when transmitting remote handles) +# Attributes: +# - Default: 3000 +# - Case sensitivity: no +# - Required: no +# ArmarX.RemoteHandlesDeletionTimeout = 3000 + + +# ArmarX.StartDebuggerOnCrash: If this application crashes (segmentation fault) qtcreator will attach to this process and start the debugger. +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.StartDebuggerOnCrash = 0 + + +# ArmarX.TopicSuffix: Suffix appended to all topic names for outgoing topics. This is mainly used to direct all topics to another name for TopicReplaying purposes. +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.TopicSuffix = "" + + +# ArmarX.UseTimeServer: Enable using a global Timeserver (e.g. from ArmarXSimulator) +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.UseTimeServer = 0 + + +# ArmarX.Verbosity: Global logging level for whole application +# Attributes: +# - Default: Info +# - Case sensitivity: no +# - Required: no +# ArmarX.Verbosity = Info + + +# Ice.Config: Custom Property +# Attributes: +# - Default: ::NOT_DEFINED:: +# - Case sensitivity: no +# - Required: no +# Ice.Config = ::NOT_DEFINED:: + + diff --git a/scenarios/MetaWearIMU/config/MetaWearIMUObserverApp.cfg b/scenarios/MetaWearIMU/config/MetaWearIMUObserverApp.cfg new file mode 100644 index 0000000000000000000000000000000000000000..bb94180a49d314a787823ff999e94fc8b0307a6f --- /dev/null +++ b/scenarios/MetaWearIMU/config/MetaWearIMUObserverApp.cfg @@ -0,0 +1,196 @@ +# ================================================================== +# MetaWearIMUObserverApp properties +# ================================================================== + +# ArmarX.AdditionalPackages: List of additional ArmarX packages which should be in the list of default packages. If you have custom packages, which should be found by the gui or other apps, specify them here. Comma separated List. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +# ArmarX.AdditionalPackages = Default value not mapped. + + +# ArmarX.ApplicationName: Application name +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.ApplicationName = "" + + +# ArmarX.CachePath: Path for cache files +# Attributes: +# - Default: ${HOME}/.armarx/mongo/.cache +# - Case sensitivity: no +# - Required: no +# ArmarX.CachePath = ${HOME}/.armarx/mongo/.cache + + +# ArmarX.Config: Comma-separated list of configuration files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.Config = "" + + +# ArmarX.DataPath: Semicolon-separated search list for data files +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.DataPath = "" + + +# ArmarX.DefaultPackages: List of ArmarX packages which are accessible by default. Comma separated List. If you want to add your own packages and use all default ArmarX packages, use the property 'AdditionalPackages'. +# Attributes: +# - Default: Default value not mapped. +# - Case sensitivity: no +# - Required: no +# ArmarX.DefaultPackages = Default value not mapped. + + +# ArmarX.DependenciesConfig: Path to the (usually generated) config file containing all data paths of all dependent projects. This property usually does not need to be edited. +# Attributes: +# - Default: ./config/dependencies.cfg +# - Case sensitivity: no +# - Required: no +# ArmarX.DependenciesConfig = ./config/dependencies.cfg + + +# ArmarX.DisableLogging: Turn logging off in whole application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.DisableLogging = 0 + + +# ArmarX.EnableProfiling: Enable profiling of CPU load produced by this application +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.EnableProfiling = 0 + + +# ArmarX.MetaWearIMUObserver.CreateUpdateFrequenciesChannel: If true, an additional channel is created that shows the update frequency of every other channel in that observer. +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMUObserver.CreateUpdateFrequenciesChannel = 0 + + +# ArmarX.MetaWearIMUObserver.DebugDrawerTopic: Name of the DebugDrawerTopic +# Attributes: +# - Default: DebugDrawerUpdates +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMUObserver.DebugDrawerTopic = DebugDrawerUpdates + + +# ArmarX.MetaWearIMUObserver.EnableProfiling: enable profiler which is used for logging performance events +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMUObserver.EnableProfiling = 0 + + +# ArmarX.MetaWearIMUObserver.MaxHistoryRecordFrequency: The Observer history is written with this maximum frequency. Everything faster is being skipped. +# Attributes: +# - Default: 50 +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMUObserver.MaxHistoryRecordFrequency = 50 + + +# ArmarX.MetaWearIMUObserver.MaxHistorySize: Maximum number of entries in the Observer history +# Attributes: +# - Default: 5000 +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMUObserver.MaxHistorySize = 5000 + + +# ArmarX.MetaWearIMUObserver.MetaWearTopicName: Name of the MetaWear topic +# Attributes: +# - Default: MetaWearData +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMUObserver.MetaWearTopicName = MetaWearData + + +# ArmarX.MetaWearIMUObserver.MinimumLoggingLevel: Local logging level only for this component +# Attributes: +# - Default: Undefined +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMUObserver.MinimumLoggingLevel = Undefined + + +# ArmarX.MetaWearIMUObserver.ObjectName: Name of IceGrid well-known object +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.MetaWearIMUObserver.ObjectName = "" + + +# ArmarX.RedirectStdout: Redirect std::cout and std::cerr to ArmarXLog +# Attributes: +# - Default: 1 +# - Case sensitivity: no +# - Required: no +# ArmarX.RedirectStdout = 1 + + +# ArmarX.RemoteHandlesDeletionTimeout: The timeout (in ms) before a remote handle deletes the managed object after the use count reached 0. This time can be used by a client to increment the count again (may be required when transmitting remote handles) +# Attributes: +# - Default: 3000 +# - Case sensitivity: no +# - Required: no +# ArmarX.RemoteHandlesDeletionTimeout = 3000 + + +# ArmarX.StartDebuggerOnCrash: If this application crashes (segmentation fault) qtcreator will attach to this process and start the debugger. +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.StartDebuggerOnCrash = 0 + + +# ArmarX.TopicSuffix: Suffix appended to all topic names for outgoing topics. This is mainly used to direct all topics to another name for TopicReplaying purposes. +# Attributes: +# - Default: "" +# - Case sensitivity: no +# - Required: no +# ArmarX.TopicSuffix = "" + + +# ArmarX.UseTimeServer: Enable using a global Timeserver (e.g. from ArmarXSimulator) +# Attributes: +# - Default: 0 +# - Case sensitivity: no +# - Required: no +# ArmarX.UseTimeServer = 0 + + +# ArmarX.Verbosity: Global logging level for whole application +# Attributes: +# - Default: Info +# - Case sensitivity: no +# - Required: no +# ArmarX.Verbosity = Info + + +# Ice.Config: Custom Property +# Attributes: +# - Default: ::NOT_DEFINED:: +# - Case sensitivity: no +# - Required: no +# Ice.Config = ::NOT_DEFINED:: + + diff --git a/scenarios/MetaWearIMU/config/global.cfg b/scenarios/MetaWearIMU/config/global.cfg new file mode 100644 index 0000000000000000000000000000000000000000..920e0209bf12c5a70461bba6c6c29d502509dc5a --- /dev/null +++ b/scenarios/MetaWearIMU/config/global.cfg @@ -0,0 +1,7 @@ +# ================================================================== +# Global Config from Scenario MetaWearIMU +# ================================================================== + + + + diff --git a/source/RobotAPI/applications/CMakeLists.txt b/source/RobotAPI/applications/CMakeLists.txt index a0b259ba1c6dd4e5339dc390f5e6de6e3a138a5e..2cf0e0077107cc6d3c7322fbe118cd245e4f8b31 100644 --- a/source/RobotAPI/applications/CMakeLists.txt +++ b/source/RobotAPI/applications/CMakeLists.txt @@ -29,6 +29,10 @@ add_subdirectory(OrientedTactileSensorUnitObserver) add_subdirectory(OptoForceUnit) add_subdirectory(OptoForceUnitObserver) + add_subdirectory(GamepadUnit) add_subdirectory(GamepadUnitObserver) -add_subdirectory(GamepadControlUnit) \ No newline at end of file +add_subdirectory(GamepadControlUnit) + +add_subdirectory(MetaWearIMU) +add_subdirectory(MetaWearIMUObserver) \ No newline at end of file diff --git a/source/RobotAPI/applications/MetaWearIMU/CMakeLists.txt b/source/RobotAPI/applications/MetaWearIMU/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..587a9944bdbac35f44eec281577078427473aa10 --- /dev/null +++ b/source/RobotAPI/applications/MetaWearIMU/CMakeLists.txt @@ -0,0 +1,20 @@ +armarx_component_set_name("MetaWearIMUApp") + +#find_package(MyLib QUIET) +#armarx_build_if(MyLib_FOUND "MyLib not available") +# +# all include_directories must be guarded by if(Xyz_FOUND) +# for multiple libraries write: if(X_FOUND AND Y_FOUND).... +#if(MyLib_FOUND) +# include_directories(${MyLib_INCLUDE_DIRS}) +#endif() + +set(COMPONENT_LIBS + ArmarXCoreInterfaces + ArmarXCore + MetaWearIMU +) + +set(EXE_SOURCE main.cpp) + +armarx_add_component_executable("${EXE_SOURCE}") diff --git a/source/RobotAPI/applications/MetaWearIMU/main.cpp b/source/RobotAPI/applications/MetaWearIMU/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1f86708a7f1c12cd4f4dd198b6fe40e4664314ff --- /dev/null +++ b/source/RobotAPI/applications/MetaWearIMU/main.cpp @@ -0,0 +1,32 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::application::MetaWearIMU + * @author Lukas Kaul ( lukas dot s dot kaul at gmail dot com ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include <RobotAPI/drivers/MetaWearIMU/MetaWearIMU.h> + +#include <ArmarXCore/core/application/Application.h> +#include <ArmarXCore/core/Component.h> +#include <ArmarXCore/core/logging/Logging.h> + +int main(int argc, char* argv[]) +{ + return armarx::runSimpleComponentApp < armarx::MetaWearIMU > (argc, argv, "MetaWearIMU"); +} diff --git a/source/RobotAPI/applications/MetaWearIMUObserver/CMakeLists.txt b/source/RobotAPI/applications/MetaWearIMUObserver/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..368319708c010643f93698500b6d3cbb24c16602 --- /dev/null +++ b/source/RobotAPI/applications/MetaWearIMUObserver/CMakeLists.txt @@ -0,0 +1,20 @@ +armarx_component_set_name("MetaWearIMUObserverApp") + +#find_package(MyLib QUIET) +#armarx_build_if(MyLib_FOUND "MyLib not available") +# +# all include_directories must be guarded by if(Xyz_FOUND) +# for multiple libraries write: if(X_FOUND AND Y_FOUND).... +#if(MyLib_FOUND) +# include_directories(${MyLib_INCLUDE_DIRS}) +#endif() + +set(COMPONENT_LIBS + ArmarXCoreInterfaces + ArmarXCore + RobotAPIUnits +) + +set(EXE_SOURCE main.cpp) + +armarx_add_component_executable("${EXE_SOURCE}") diff --git a/source/RobotAPI/applications/MetaWearIMUObserver/main.cpp b/source/RobotAPI/applications/MetaWearIMUObserver/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..376425b06be3750b2d16b74a9e156a7753bf4172 --- /dev/null +++ b/source/RobotAPI/applications/MetaWearIMUObserver/main.cpp @@ -0,0 +1,32 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::application::MetaWearIMUObserver + * @author Lukas Kaul ( lukas dot s dot kaul at gmail dot com ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include <RobotAPI/components/units/MetaWearIMUObserver.h> + +#include <ArmarXCore/core/application/Application.h> +#include <ArmarXCore/core/Component.h> +#include <ArmarXCore/core/logging/Logging.h> + +int main(int argc, char* argv[]) +{ + return armarx::runSimpleComponentApp < armarx::MetaWearIMUObserver > (argc, argv, "MetaWearIMUObserver"); +} diff --git a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp index 21ecd403f18d0c2c8e0969218a167125239e7d06..2da9f8701b48e44d517bd971129063ebd8799b1c 100644 --- a/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp +++ b/source/RobotAPI/components/DebugDrawer/DebugDrawerComponent.cpp @@ -254,7 +254,7 @@ namespace armarx removeSelectionCallbacks(); selectionNode->deselectAll(); - for (auto& e : selectedElements) + for (auto & e : selectedElements) { SoNode* n = SoSelection::getByName(SELECTION_NAME(e.layerName, e.elementName)); if (n) @@ -294,7 +294,7 @@ namespace armarx name = name.substr(index + strlen(SELECTION_NAME_SPLITTER)); // Check if selected element is 'selectable' - for (auto& l : layers) + for (auto & l : layers) { std::string layer = l.first; if (layers[layer].addedBoxVisualizations.find(name) != layers[layer].addedBoxVisualizations.end() @@ -936,6 +936,7 @@ namespace armarx SoShapeHints* hints = new SoShapeHints; hints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE; hints->shapeType = SoShapeHints::UNKNOWN_SHAPE_TYPE; + hints->faceType = SoShapeHints::UNKNOWN_FACE_TYPE; sep->addChild(hints); sep->addChild(VirtualRobot::CoinVisualizationFactory::CreatePolygonVisualization(d.points, d.colorInner, d.colorBorder, d.lineWidth)); @@ -2142,7 +2143,7 @@ namespace armarx d.layerName = layerName; d.name = robotName; - for (auto& it : configuration) + for (auto & it : configuration) { d.configuration[it.first] = it.second; } @@ -2217,7 +2218,7 @@ namespace armarx void DebugDrawerComponent::clearAll(const Ice::Current&) { - for (auto& i : layers) + for (auto & i : layers) { clearLayer(i.first); } @@ -2260,72 +2261,72 @@ namespace armarx Layer& layer = layers.at(layerName); - for (const auto& i : layer.addedCoordVisualizations) + for (const auto & i : layer.addedCoordVisualizations) { removePoseVisu(layerName, i.first); } - for (const auto& i : layer.addedLineVisualizations) + for (const auto & i : layer.addedLineVisualizations) { removeLineVisu(layerName, i.first); } - for (const auto& i : layer.addedLineSetVisualizations) + for (const auto & i : layer.addedLineSetVisualizations) { removeLineSetVisu(layerName, i.first); } - for (const auto& i : layer.addedBoxVisualizations) + for (const auto & i : layer.addedBoxVisualizations) { removeBoxVisu(layerName, i.first); } - for (const auto& i : layer.addedTextVisualizations) + for (const auto & i : layer.addedTextVisualizations) { removeTextVisu(layerName, i.first); } - for (const auto& i : layer.addedSphereVisualizations) + for (const auto & i : layer.addedSphereVisualizations) { removeSphereVisu(layerName, i.first); } - for (const auto& i : layer.addedCylinderVisualizations) + for (const auto & i : layer.addedCylinderVisualizations) { removeCylinderVisu(layerName, i.first); } - for (const auto& i : layer.addedPointCloudVisualizations) + for (const auto & i : layer.addedPointCloudVisualizations) { removePointCloudVisu(layerName, i.first); } - for (const auto& i : layer.addedPolygonVisualizations) + for (const auto & i : layer.addedPolygonVisualizations) { removePolygonVisu(layerName, i.first); } - for (const auto& i : layer.addedTriMeshVisualizations) + for (const auto & i : layer.addedTriMeshVisualizations) { removeTriMeshVisu(layerName, i.first); } - for (const auto& i : layer.added24BitColoredPointCloudVisualizations) + for (const auto & i : layer.added24BitColoredPointCloudVisualizations) { remove24BitColoredPointCloudVisu(layerName, i.first); } - for (const auto& i : layer.addedArrowVisualizations) + for (const auto & i : layer.addedArrowVisualizations) { removeArrowVisu(layerName, i.first); } - for (const auto& i : layer.addedRobotVisualizations) + for (const auto & i : layer.addedRobotVisualizations) { removeRobotVisu(layerName, i.first); } - for (const auto& i : layer.addedCustomVisualizations) + for (const auto & i : layer.addedCustomVisualizations) { removeCustomVisu(layerName, i.first); } @@ -2397,92 +2398,92 @@ namespace armarx // check for clear&remove //(updates only contain elements to add for each layer after the last clear for this layer was executed) //this prevents a sequence add,clear,add to result in an empty layer - for (const auto& layer : accumulatedUpdateData.clearLayers) + for (const auto & layer : accumulatedUpdateData.clearLayers) { clearLayerQt(layer); } accumulatedUpdateData.clearLayers.clear(); - for (const auto& layer : accumulatedUpdateData.removeLayers) + for (const auto & layer : accumulatedUpdateData.removeLayers) { removeLayerQt(layer); } accumulatedUpdateData.removeLayers.clear(); //add elements - for (auto& e : accumulatedUpdateData.coord) + for (auto & e : accumulatedUpdateData.coord) { drawCoordSystem(e.second); } accumulatedUpdateData.coord.clear(); - for (auto& e : accumulatedUpdateData.box) + for (auto & e : accumulatedUpdateData.box) { drawBox(e.second); } accumulatedUpdateData.box.clear(); - for (auto& e : accumulatedUpdateData.line) + for (auto & e : accumulatedUpdateData.line) { drawLine(e.second); } accumulatedUpdateData.line.clear(); - for (auto& e : accumulatedUpdateData.lineSet) + for (auto & e : accumulatedUpdateData.lineSet) { drawLineSet(e.second); } accumulatedUpdateData.lineSet.clear(); - for (auto& e : accumulatedUpdateData.sphere) + for (auto & e : accumulatedUpdateData.sphere) { drawSphere(e.second); } accumulatedUpdateData.sphere.clear(); - for (auto& e : accumulatedUpdateData.cylinder) + for (auto & e : accumulatedUpdateData.cylinder) { drawCylinder(e.second); } accumulatedUpdateData.cylinder.clear(); - for (auto& e : accumulatedUpdateData.circle) + for (auto & e : accumulatedUpdateData.circle) { drawCircle(e.second); } accumulatedUpdateData.circle.clear(); - for (auto& e : accumulatedUpdateData.text) + for (auto & e : accumulatedUpdateData.text) { drawText(e.second); } accumulatedUpdateData.text.clear(); - for (auto& e : accumulatedUpdateData.pointcloud) + for (auto & e : accumulatedUpdateData.pointcloud) { drawPointCloud(e.second); } accumulatedUpdateData.pointcloud.clear(); - for (auto& e : accumulatedUpdateData.polygons) + for (auto & e : accumulatedUpdateData.polygons) { drawPolygon(e.second); } accumulatedUpdateData.polygons.clear(); - for (auto& e : accumulatedUpdateData.arrows) + for (auto & e : accumulatedUpdateData.arrows) { drawArrow(e.second); } accumulatedUpdateData.arrows.clear(); - for (auto& e : accumulatedUpdateData.triMeshes) + for (auto & e : accumulatedUpdateData.triMeshes) { drawTriMesh(e.second); } accumulatedUpdateData.triMeshes.clear(); - for (auto& e : accumulatedUpdateData.robots) + for (auto & e : accumulatedUpdateData.robots) { ARMARX_DEBUG << "update visu / drawRobot for robot " << e.first; ensureExistingRobotNodes(e.second); @@ -2491,13 +2492,13 @@ namespace armarx } accumulatedUpdateData.robots.clear(); - for (auto& e : accumulatedUpdateData.coloredpointcloud) + for (auto & e : accumulatedUpdateData.coloredpointcloud) { drawColoredPointCloud(e.second); } accumulatedUpdateData.coloredpointcloud.clear(); - for (auto& e : accumulatedUpdateData.colored24Bitpointcloud) + for (auto & e : accumulatedUpdateData.colored24Bitpointcloud) { draw24BitColoredPointCloud(e.second); } @@ -2602,7 +2603,7 @@ namespace armarx ScopedRecursiveLockPtr l = getScopedVisuLock(); Ice::StringSeq seq {}; - for (const auto& layer : layers) + for (const auto & layer : layers) { seq.push_back(layer.first); } @@ -2615,7 +2616,7 @@ namespace armarx ::armarx::LayerInformationSequence seq {}; ScopedRecursiveLockPtr l = getScopedVisuLock(); - for (const auto& layer : layers) + for (const auto & layer : layers) { int count = layer.second.addedCoordVisualizations.size() + layer.second.addedLineVisualizations.size() + diff --git a/source/RobotAPI/components/units/CMakeLists.txt b/source/RobotAPI/components/units/CMakeLists.txt index 46c0b32ee4f4f9b85f253cf93b493524960d9670..7c99e406382161c50b689c9f1a5bea1c64b317ee 100644 --- a/source/RobotAPI/components/units/CMakeLists.txt +++ b/source/RobotAPI/components/units/CMakeLists.txt @@ -32,9 +32,10 @@ set(LIB_HEADERS HapticObserver.h InertialMeasurementUnit.h InertialMeasurementUnitObserver.h - LaserScannerUnitObserver.h OptoForceUnitObserver.h + MetaWearIMUObserver.h OrientedTactileSensorUnitObserver.h + LaserScannerUnitObserver.h GamepadUnitObserver.h TCPControlUnit.h TCPControlUnitObserver.h @@ -62,6 +63,7 @@ set(LIB_FILES InertialMeasurementUnit.cpp InertialMeasurementUnitObserver.cpp LaserScannerUnitObserver.cpp + MetaWearIMUObserver.cpp OptoForceUnitObserver.cpp OrientedTactileSensorUnitObserver.cpp GamepadUnitObserver.cpp diff --git a/source/RobotAPI/components/units/MetaWearIMUObserver.cpp b/source/RobotAPI/components/units/MetaWearIMUObserver.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bd36b219b5b588e819d81924a1e60711cc342d8b --- /dev/null +++ b/source/RobotAPI/components/units/MetaWearIMUObserver.cpp @@ -0,0 +1,116 @@ +/* + * This file is part of ArmarX. + * + * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package + * @author + * @date + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ +#include "MetaWearIMUObserver.h" + + +#include <ArmarXCore/observers/checks/ConditionCheckEquals.h> +#include <ArmarXCore/observers/checks/ConditionCheckLarger.h> +#include <ArmarXCore/observers/checks/ConditionCheckSmaller.h> +#include <ArmarXCore/observers/checks/ConditionCheckUpdated.h> + +#include <RobotAPI/libraries/core/Pose.h> + +#include <ArmarXCore/observers/variant/TimestampVariant.h> + + + +using namespace armarx; + + +void MetaWearIMUObserver::onInitObserver() +{ + usingTopic(getProperty<std::string>("MetaWearTopicName").getValue()); + + offerConditionCheck("updated", new ConditionCheckUpdated()); + offerConditionCheck("larger", new ConditionCheckLarger()); + offerConditionCheck("equals", new ConditionCheckEquals()); + offerConditionCheck("smaller", new ConditionCheckSmaller()); + + offeringTopic(getProperty<std::string>("DebugDrawerTopic").getValue()); +} + + + +void MetaWearIMUObserver::onConnectObserver() +{ + debugDrawerPrx = getTopic<DebugDrawerInterfacePrx>(getProperty<std::string>("DebugDrawerTopic").getValue()); +} + + +void MetaWearIMUObserver::onExitObserver() +{ + +} + +void armarx::MetaWearIMUObserver::reportIMUValues(const std::string& name, const MetaWearIMUData& data, const TimestampBasePtr& timestamp, const Ice::Current&) +{ + ScopedLock lock(dataMutex); + + if (!existsChannel(name)) + { + offerChannel(name, "MetaWear IMU data"); + } + offerVector3(name, "acceleration", data.acceleration); + offerVector3(name, "gyro", data.gyro); + offerVector3(name, "magnetic", data.magnetic); + offerQuaternion(name, "orientationQuaternion", data.orientationQuaternion); + + updateChannel(name); + +} + +PropertyDefinitionsPtr MetaWearIMUObserver::createPropertyDefinitions() +{ + return PropertyDefinitionsPtr(new MetaWearIMUObserverPropertyDefinitions(getConfigIdentifier())); +} + +void MetaWearIMUObserver::offerVector3(const std::string& channelName, const std::string& dfName, const std::vector<float>& data) +{ + if (data.size() == 3) + { + Vector3Ptr vec3 = new Vector3(data.at(0), data.at(1), data.at(2)); + offerOrUpdateDataField(channelName, dfName, vec3, dfName); + } + else if (data.size() != 0) + { + ARMARX_WARNING << "data." << dfName << ".size() != 3 && data." << dfName << ".size() != 0"; + } +} + +void MetaWearIMUObserver::offerQuaternion(const std::string& channelName, const std::string& dfName, const std::vector<float>& data) +{ + if (data.size() == 4) + { + QuaternionPtr quat = new Quaternion(data.at(0), data.at(1), data.at(2), data.at(3)); + offerOrUpdateDataField(channelName, dfName, quat, dfName); + } + else if (data.size() != 0) + { + ARMARX_WARNING << "data." << dfName << ".size() != 4 && data." << dfName << ".size() != 0"; + } +} + + + + diff --git a/source/RobotAPI/components/units/MetaWearIMUObserver.h b/source/RobotAPI/components/units/MetaWearIMUObserver.h new file mode 100644 index 0000000000000000000000000000000000000000..e2ea76acd7f7c7a0db5af45d97a2d88556d9adac --- /dev/null +++ b/source/RobotAPI/components/units/MetaWearIMUObserver.h @@ -0,0 +1,87 @@ +/* + * This file is part of ArmarX. + * + * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::units + * @author David Schiebener <schiebener at kit dot edu> + * @date 2014 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_ROBOTAPI_META_WEAR_IMU_OBSERVER_H +#define _ARMARX_ROBOTAPI_META_WEAR_IMU_OBSERVER_H + +#include <RobotAPI/interface/units/MetaWearIMU.h> +#include <ArmarXCore/observers/Observer.h> +#include <RobotAPI/interface/visualization/DebugDrawerInterface.h> +#include <RobotAPI/libraries/core/Pose.h> + + +namespace armarx +{ + /** + * \class MetaWearIMUObserverPropertyDefinitions + * \brief + */ + class MetaWearIMUObserverPropertyDefinitions: + public ObserverPropertyDefinitions + { + public: + MetaWearIMUObserverPropertyDefinitions(std::string prefix): + ObserverPropertyDefinitions(prefix) + { + defineOptionalProperty<std::string>("MetaWearTopicName", "MetaWearData", "Name of the MetaWear topic"); + defineOptionalProperty<std::string>("DebugDrawerTopic", "DebugDrawerUpdates", "Name of the DebugDrawerTopic"); + } + }; + + + + class MetaWearIMUObserver : + virtual public Observer, + virtual public MetaWearIMUObserverInterface + { + public: + MetaWearIMUObserver() {} + + virtual std::string getDefaultName() const + { + return "MetaWearIMUObserver"; + } + virtual void onInitObserver(); + virtual void onConnectObserver(); + virtual void onExitObserver(); + + void reportIMUValues(const std::string& name, const MetaWearIMUData& data, const TimestampBasePtr& timestamp, const Ice::Current&); + + /** + * @see PropertyUser::createPropertyDefinitions() + */ + virtual PropertyDefinitionsPtr createPropertyDefinitions(); + + + private: + Mutex dataMutex; + DebugDrawerInterfacePrx debugDrawerPrx; + + void offerVector3(const std::string& channelName, const std::string& dfName, const std::vector<float>& data); + void offerQuaternion(const std::string& channelName, const std::string& dfName, const std::vector<float>& data); + + }; +} + +#endif diff --git a/source/RobotAPI/drivers/CMakeLists.txt b/source/RobotAPI/drivers/CMakeLists.txt index b2807bcf363219b251eefa62ac8455ce51761664..90331c6e0fb050613d291969d419a824e2cd385b 100644 --- a/source/RobotAPI/drivers/CMakeLists.txt +++ b/source/RobotAPI/drivers/CMakeLists.txt @@ -4,4 +4,5 @@ add_subdirectory(HokuyoLaserUnit) add_subdirectory(OptoForceUnit) add_subdirectory(OrientedTactileSensor) add_subdirectory(GamepadUnit) +add_subdirectory(MetaWearIMU) diff --git a/source/RobotAPI/drivers/MetaWearIMU/CMakeLists.txt b/source/RobotAPI/drivers/MetaWearIMU/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..08a4ae860c367354aaf2613d5c27c90e89ec8b1e --- /dev/null +++ b/source/RobotAPI/drivers/MetaWearIMU/CMakeLists.txt @@ -0,0 +1,24 @@ +armarx_component_set_name("MetaWearIMU") + +#find_package(MyLib QUIET) +#armarx_build_if(MyLib_FOUND "MyLib not available") +# +# all include_directories must be guarded by if(Xyz_FOUND) +# for multiple libraries write: if(X_FOUND AND Y_FOUND).... +#if(MyLib_FOUND) +# include_directories(${MyLib_INCLUDE_DIRS}) +#endif() + +set(COMPONENT_LIBS ArmarXCoreInterfaces ArmarXCore ArmarXCoreEigen3Variants RobotAPIInterfaces) + +set(SOURCES +./MetaWearIMU.cpp +#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@.cpp +) +set(HEADERS +./MetaWearIMU.h +#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@.h +) + +armarx_add_component("${SOURCES}" "${HEADERS}") + diff --git a/source/RobotAPI/drivers/MetaWearIMU/MetaWearIMU.cpp b/source/RobotAPI/drivers/MetaWearIMU/MetaWearIMU.cpp new file mode 100644 index 0000000000000000000000000000000000000000..23efa0543398c1036b06cf4cb149f5cad6494fb0 --- /dev/null +++ b/source/RobotAPI/drivers/MetaWearIMU/MetaWearIMU.cpp @@ -0,0 +1,73 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::MetaWearIMU + * @author Lukas Kaul ( lukas dot s dot kaul at gmail dot com ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#include "MetaWearIMU.h" + +#include <ArmarXCore/observers/variant/TimestampVariant.h> + + +using namespace armarx; + + +void MetaWearIMU::onInitComponent() +{ + usingTopic(getProperty<std::string>("MetaWearPythonTopicName")); + offeringTopic(getProperty<std::string>("MetaWearTopicName")); +} + + +void MetaWearIMU::onConnectComponent() +{ + topicPrx = getTopic<MetaWearIMUListenerPrx>(getProperty<std::string>("MetaWearTopicName").getValue()); +} + + +void MetaWearIMU::onDisconnectComponent() +{ + +} + + +void MetaWearIMU::onExitComponent() +{ + +} + +armarx::PropertyDefinitionsPtr MetaWearIMU::createPropertyDefinitions() +{ + return armarx::PropertyDefinitionsPtr(new MetaWearIMUPropertyDefinitions( + getConfigIdentifier())); +} + + + +void armarx::MetaWearIMU::reportIMUValues(const std::string& name, const MetaWearIMUDataExt& data_ext, const Ice::Current&) +{ + IceUtil::Time now = IceUtil::Time::now(); + TimestampVariantPtr nowTimestamp = new TimestampVariant(now); + MetaWearIMUData data; + data.acceleration = data_ext.acceleration; + data.gyro = data_ext.gyro; + data.magnetic = data_ext.magnetic; + data.orientationQuaternion = data_ext.orientationQuaternion; + topicPrx->reportIMUValues(name, data, nowTimestamp); +} diff --git a/source/RobotAPI/drivers/MetaWearIMU/MetaWearIMU.h b/source/RobotAPI/drivers/MetaWearIMU/MetaWearIMU.h new file mode 100644 index 0000000000000000000000000000000000000000..57068b21b8a6007591aec6f003f1ecaa0688476b --- /dev/null +++ b/source/RobotAPI/drivers/MetaWearIMU/MetaWearIMU.h @@ -0,0 +1,108 @@ +/* + * This file is part of ArmarX. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI::ArmarXObjects::MetaWearIMU + * @author Lukas Kaul ( lukas dot s dot kaul at gmail dot com ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_COMPONENT_RobotAPI_MetaWearIMU_H +#define _ARMARX_COMPONENT_RobotAPI_MetaWearIMU_H + + +#include <ArmarXCore/core/Component.h> +#include <RobotAPI/interface/units/MetaWearIMUInterface.h> +#include <RobotAPI/interface/units/MetaWearIMU.h> + +namespace armarx +{ + /** + * @class MetaWearIMUPropertyDefinitions + * @brief + */ + class MetaWearIMUPropertyDefinitions: + public armarx::ComponentPropertyDefinitions + { + public: + MetaWearIMUPropertyDefinitions(std::string prefix): + armarx::ComponentPropertyDefinitions(prefix) + { + //defineRequiredProperty<std::string>("PropertyName", "Description"); + defineOptionalProperty<std::string>("MetaWearPythonTopicName", "MetaWearPythonData", "Name of the topic provided by the python driver"); + defineOptionalProperty<std::string>("MetaWearTopicName", "MetaWearData", "Name of the MetaWear topic"); + } + }; + + /** + * @defgroup Component-MetaWearIMU MetaWearIMU + * @ingroup RobotAPI-Components + * A description of the component MetaWearIMU. + * + * @class MetaWearIMU + * @ingroup Component-MetaWearIMU + * @brief Brief description of class MetaWearIMU. + * + * Detailed description of class MetaWearIMU. + */ + class MetaWearIMU : + virtual public armarx::Component, + virtual public armarx::MetaWearIMUInterface + { + public: + /** + * @see armarx::ManagedIceObject::getDefaultName() + */ + virtual std::string getDefaultName() const + { + return "MetaWearIMU"; + } + + protected: + /** + * @see armarx::ManagedIceObject::onInitComponent() + */ + virtual void onInitComponent(); + + /** + * @see armarx::ManagedIceObject::onConnectComponent() + */ + virtual void onConnectComponent(); + + /** + * @see armarx::ManagedIceObject::onDisconnectComponent() + */ + virtual void onDisconnectComponent(); + + /** + * @see armarx::ManagedIceObject::onExitComponent() + */ + virtual void onExitComponent(); + + /** + * @see PropertyUser::createPropertyDefinitions() + */ + virtual armarx::PropertyDefinitionsPtr createPropertyDefinitions(); + + MetaWearIMUListenerPrx topicPrx; + + // MetaWearIMUInterface interface + public: + void reportIMUValues(const std::string& name, const MetaWearIMUDataExt& data_ext, const Ice::Current&); + }; +} + +#endif diff --git a/source/RobotAPI/interface/CMakeLists.txt b/source/RobotAPI/interface/CMakeLists.txt index aceee62f86a1419e89993e7d9c4809111b722b18..73a7048e0d97cd2235661f12c6b1623965e4f464 100644 --- a/source/RobotAPI/interface/CMakeLists.txt +++ b/source/RobotAPI/interface/CMakeLists.txt @@ -38,6 +38,8 @@ set(SLICE_FILES units/ATINetFTUnit.ice units/OrientedTactileSensorUnit.ice units/GamepadUnit.ice + units/MetaWearIMUInterface.ice + units/MetaWearIMU.ice components/ViewSelectionInterface.ice diff --git a/source/RobotAPI/interface/CMakeLists.txt.orig b/source/RobotAPI/interface/CMakeLists.txt.orig deleted file mode 100644 index 0897bbda5645ed5909a98fb1ca6ecb221d9a75fe..0000000000000000000000000000000000000000 --- a/source/RobotAPI/interface/CMakeLists.txt.orig +++ /dev/null @@ -1,55 +0,0 @@ -### -### CMakeLists.txt file for ArmarX Interfaces -### - -set(ROBOTAPI_INTERFACE_DEPEND ArmarXCore) - -set(SLICE_FILES - observers/KinematicUnitObserverInterface.ice - observers/PlatformUnitObserverInterface.ice - observers/ObserverFilters.ice - - core/PoseBase.ice - core/OrientedPoint.ice - core/LinkedPoseBase.ice - core/FramedPoseBase.ice - core/RobotState.ice - core/RobotStateObserverInterface.ice - core/Trajectory.ice - - selflocalisation/SelfLocalisationProcess.ice - - speech/SpeechInterface.ice - - units/ForceTorqueUnit.ice - units/InertialMeasurementUnit.ice -<<<<<<< HEAD - units/LaserScannerUnit.ice -======= - units/OptoForceUnit.ice ->>>>>>> master - units/HandUnitInterface.ice - units/HapticUnit.ice - units/WeissHapticUnit.ice - units/HeadIKUnit.ice - units/KinematicUnitInterface.ice - units/PlatformUnitInterface.ice - units/RobotPoseUnitInterface.ice - units/TCPControlUnit.ice - units/TCPMoverUnitInterface.ice - units/UnitInterface.ice - units/ATINetFTUnit.ice - units/OrientedTactileSensorUnit.ice - - components/ViewSelectionInterface.ice - - visualization/DebugDrawerInterface.ice - - libraries/RTControllers/LVL1Controller.ice - libraries/RTControllers/PassThroughController.ice - libraries/RTControllers/RobotUnitInterface.ice -) - #core/RobotIK.ice - -# generate the interface library -armarx_interfaces_generate_library(RobotAPI "${ROBOTAPI_INTERFACE_DEPEND}") diff --git a/source/RobotAPI/interface/units/MetaWearIMU.ice b/source/RobotAPI/interface/units/MetaWearIMU.ice new file mode 100644 index 0000000000000000000000000000000000000000..994aa33ac6e2fddaeb12337443aed16dd54baecb --- /dev/null +++ b/source/RobotAPI/interface/units/MetaWearIMU.ice @@ -0,0 +1,51 @@ +/* + * This file is part of ArmarX. + * + * Copyright (C) 2012-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI + * @author Lukas Kaul ( lukas dot kaul at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_ROBOTAPI_UNITS_MetaWearIMU_SLICE_ +#define _ARMARX_ROBOTAPI_UNITS_MetaWearIMU_SLICE_ + +#include <RobotAPI/interface/core/PoseBase.ice> +#include <RobotAPI/interface/units/UnitInterface.ice> +#include <ArmarXCore/interface/core/UserException.ice> +#include <ArmarXCore/interface/observers/Timestamp.ice> + +module armarx +{ + struct MetaWearIMUData { + Ice::FloatSeq orientationQuaternion; + Ice::FloatSeq magnetic; + Ice::FloatSeq gyro; + Ice::FloatSeq acceleration; + }; + + interface MetaWearIMUListener + { + void reportIMUValues(string name, MetaWearIMUData data, TimestampBase timestamp); + }; + interface MetaWearIMUObserverInterface extends ObserverInterface, MetaWearIMUListener + { + }; +}; + +#endif diff --git a/source/RobotAPI/interface/units/MetaWearIMUInterface.ice b/source/RobotAPI/interface/units/MetaWearIMUInterface.ice new file mode 100644 index 0000000000000000000000000000000000000000..3dbf0f5ad36eacd0865ddef4f7c3d6152061df6a --- /dev/null +++ b/source/RobotAPI/interface/units/MetaWearIMUInterface.ice @@ -0,0 +1,46 @@ +/* + * This file is part of ArmarX. + * + * Copyright (C) 2012-2017, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved. + * + * ArmarX is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * ArmarX is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * @package RobotAPI + * @author Lukas Kaul ( lukas dot kaul at kit dot edu ) + * @date 2017 + * @copyright http://www.gnu.org/licenses/gpl-2.0.txt + * GNU General Public License + */ + +#ifndef _ARMARX_ROBOTAPI_UNITS_MetaWearIMUInterface_SLICE_ +#define _ARMARX_ROBOTAPI_UNITS_MetaWearIMUInterface_SLICE_ + + +module armarx +{ + sequence<float> FloatSeq; + + struct MetaWearIMUDataExt { + FloatSeq orientationQuaternion; + FloatSeq magnetic; + FloatSeq gyro; + FloatSeq acceleration; + }; + + interface MetaWearIMUInterface + { + void reportIMUValues(string name, MetaWearIMUDataExt data); + }; +}; + +#endif