From 8493775484a2e852652f6a00a1fc289256ca6ee9 Mon Sep 17 00:00:00 2001 From: Peter Kaiser <peter.kaiser@kit.edu> Date: Tue, 29 Nov 2016 11:45:46 +0100 Subject: [PATCH] Moved BusInspectionUnit to Armar4 --- .../BusInspectionUnitObserver/CMakeLists.txt | 16 --- .../BusInspectionUnitObserver/main.cpp | 34 ----- source/RobotAPI/applications/CMakeLists.txt | 1 - .../components/units/BusInspectionUnit.cpp | 99 -------------- .../components/units/BusInspectionUnit.h | 101 --------------- .../units/BusInspectionUnitObserver.cpp | 121 ------------------ .../units/BusInspectionUnitObserver.h | 75 ----------- .../RobotAPI/components/units/CMakeLists.txt | 4 - source/RobotAPI/interface/CMakeLists.txt | 2 - .../hardware/BusInspectionInterface.ice | 112 ---------------- 10 files changed, 565 deletions(-) delete mode 100644 source/RobotAPI/applications/BusInspectionUnitObserver/CMakeLists.txt delete mode 100644 source/RobotAPI/applications/BusInspectionUnitObserver/main.cpp delete mode 100644 source/RobotAPI/components/units/BusInspectionUnit.cpp delete mode 100644 source/RobotAPI/components/units/BusInspectionUnit.h delete mode 100644 source/RobotAPI/components/units/BusInspectionUnitObserver.cpp delete mode 100644 source/RobotAPI/components/units/BusInspectionUnitObserver.h delete mode 100644 source/RobotAPI/interface/hardware/BusInspectionInterface.ice diff --git a/source/RobotAPI/applications/BusInspectionUnitObserver/CMakeLists.txt b/source/RobotAPI/applications/BusInspectionUnitObserver/CMakeLists.txt deleted file mode 100644 index 36d65f098..000000000 --- a/source/RobotAPI/applications/BusInspectionUnitObserver/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ - -armarx_component_set_name(BusInspectionUnitObserver) - -find_package(Eigen3 QUIET) -armarx_build_if(Eigen3_FOUND "Eigen3 not available") - -if (Eigen3_FOUND) - include_directories( - ${Eigen3_INCLUDE_DIR}) -endif() - -set(COMPONENT_LIBS RobotAPIUnits) - -set(EXE_SOURCE main.cpp) - -armarx_add_component_executable("${EXE_SOURCE}") diff --git a/source/RobotAPI/applications/BusInspectionUnitObserver/main.cpp b/source/RobotAPI/applications/BusInspectionUnitObserver/main.cpp deleted file mode 100644 index 82f4b846f..000000000 --- a/source/RobotAPI/applications/BusInspectionUnitObserver/main.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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::application::BusInspectionUnitObserver - * @author Peter Kaiser (peter dot kaiser at kit dot edu) - * @date 2015 - * @copyright http://www.gnu.org/licenses/gpl-2.0.txt - * GNU General Public License - */ - -#include <RobotAPI/components/units/BusInspectionUnitObserver.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::BusInspectionUnitObserver>(argc, argv, "BusInspectionUnitObserver"); -} diff --git a/source/RobotAPI/applications/CMakeLists.txt b/source/RobotAPI/applications/CMakeLists.txt index 736267ef6..91731e3bd 100644 --- a/source/RobotAPI/applications/CMakeLists.txt +++ b/source/RobotAPI/applications/CMakeLists.txt @@ -1,4 +1,3 @@ -add_subdirectory(BusInspectionUnitObserver) add_subdirectory(ForceTorqueObserver) add_subdirectory(HeadIKUnit) add_subdirectory(TCPControlUnit) diff --git a/source/RobotAPI/components/units/BusInspectionUnit.cpp b/source/RobotAPI/components/units/BusInspectionUnit.cpp deleted file mode 100644 index 196c78b54..000000000 --- a/source/RobotAPI/components/units/BusInspectionUnit.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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 Core - * @author Matthias Hadlich (matthias dot hadlich at student dot kit dot edu) - * @copyright 2014 Matthias Hadlich - * @license http://www.gnu.org/licenses/gpl-2.0.txt - * GNU General Public License - */ - -#ifndef BUSINSPECTIONUNIT_CPP -#define BUSINSPECTIONUNIT_CPP - -#include "BusInspectionUnit.h" -#include <vector> -#include <string> - -using namespace armarx; - -void BusInspectionUnit::onInitComponent() -{ - this->onInitBusInspectionUnit(); - offeringTopic("HALCycleTimes"); -} - -void BusInspectionUnit::onConnectComponent() -{ - busInspectionListenerPrx = getTopic<BusInspectionListenerPrx>("HALCycleTimes"); - - this->onConnectBusInspectionUnit(); -} - -void BusInspectionUnit::onExitComponent() -{ - this->onExitBusInspectionUnit(); -} - -BusNames BusInspectionUnit::getConfiguredBusses(const Ice::Current& c) -{ - std::vector<std::string> res; - return res; -} -BusInformation BusInspectionUnit::getBusInformation(const std::string& bus, const Ice::Current& c) -{ - BusInformation res; - return res; -} -DeviceNames BusInspectionUnit::getDevicesOnBus(const std::string& bus, const Ice::Current& c) -{ - std::vector<std::string> res; - return res; -} - -DeviceInformation BusInspectionUnit::getDeviceInformation(const std::string& device, const Ice::Current& c) -{ - DeviceInformation res; - return res; -} - -Ice::Int BusInspectionUnit::performDeviceOperation(BasicOperation operation, Ice::Int device, const Ice::Current& c) -{ - return 0; -} - -Ice::Int BusInspectionUnit::performBusOperation(BasicOperation operation, const std::string& bus, const Ice::Current& c) -{ - return 0; -} - -bool BusInspectionUnit::isInRealTimeMode(const Ice::Current& c) -{ - return false; -} - -std::string BusInspectionUnit::sendCommand(const std::string& command, Ice::Int device, const Ice::Current& c) -{ - return ""; -} - -PropertyDefinitionsPtr BusInspectionUnit::createPropertyDefinitions() -{ - return PropertyDefinitionsPtr(new BusInspectionUnitPropertyDefinitions(getConfigIdentifier())); -} - -#endif diff --git a/source/RobotAPI/components/units/BusInspectionUnit.h b/source/RobotAPI/components/units/BusInspectionUnit.h deleted file mode 100644 index 604ea29b4..000000000 --- a/source/RobotAPI/components/units/BusInspectionUnit.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 Core - * @author Matthias Hadlich (matthias dot hadlich at student dot kit dot edu) - * @copyright 2014 Matthias Hadlich - * @license http://www.gnu.org/licenses/gpl-2.0.txt - * GNU General Public License - */ - -#ifndef _BUSINSPECTIONUNIT_H -#define _BUSINSPECTIONUNIT_H - -#include <string> - -#include <ArmarXCore/core/Component.h> -#include <ArmarXCore/core/application/properties/Properties.h> -#include <ArmarXCore/core/system/ImportExportComponent.h> - -#include <RobotAPI/interface/hardware/BusInspectionInterface.h> - -namespace armarx -{ - /** - * \class BusInspectionUnitPropertyDefinitions - * \brief - */ - class BusInspectionUnitPropertyDefinitions: - public ComponentPropertyDefinitions - { - public: - BusInspectionUnitPropertyDefinitions(std::string prefix) : - ComponentPropertyDefinitions(prefix) - { - } - }; - - /** - * \class BusInspectionUnit - * \ingroup RobotAPI-SensorActorUnits - * \brief Provides information about connected hardware devices. - * - * BusInspectionUnit is the base class of a unit that allows the introspection of a connected bus system. - */ - class BusInspectionUnit : - virtual public BusInspectionInterface, virtual public Component - { - public: - // inherited from Component - virtual std::string getDefaultName() const - { - return "BusInspectionUnit"; - } - virtual void onInitComponent(); - virtual void onConnectComponent(); - virtual void onExitComponent(); - - virtual void onInitBusInspectionUnit() = 0; - virtual void onConnectBusInspectionUnit() = 0; - virtual void onExitBusInspectionUnit() = 0; - - virtual BusNames getConfiguredBusses(const Ice::Current& c = ::Ice::Current()); - virtual BusInformation getBusInformation(const std::string& bus, const Ice::Current& c = ::Ice::Current()); - virtual DeviceNames getDevicesOnBus(const std::string& bus, const Ice::Current& c = ::Ice::Current()); - virtual DeviceInformation getDeviceInformation(const std::string& device, const Ice::Current& c = ::Ice::Current()); - - virtual Ice::Int performDeviceOperation(BasicOperation operation, Ice::Int device, const Ice::Current& c = ::Ice::Current()); - virtual Ice::Int performBusOperation(BasicOperation operation, const std::string& bus, const Ice::Current& c = ::Ice::Current()); - virtual bool isInRealTimeMode(const Ice::Current& c = ::Ice::Current()); - - virtual std::string sendCommand(const std::string& command, Ice::Int device, const Ice::Current& c = ::Ice::Current()); - - /** - * \see PropertyUser::createPropertyDefinitions() - */ - virtual PropertyDefinitionsPtr createPropertyDefinitions(); - - protected: - std::string channel; - BusInspectionListenerPrx busInspectionListenerPrx; - }; -} - - - - -#endif diff --git a/source/RobotAPI/components/units/BusInspectionUnitObserver.cpp b/source/RobotAPI/components/units/BusInspectionUnitObserver.cpp deleted file mode 100644 index 8cce4c9b8..000000000 --- a/source/RobotAPI/components/units/BusInspectionUnitObserver.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* -* 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 ArmarX:: -* @author Peter Kaiser (peter dot kaiser at kit dot edu) -* @date 2015 -* @copyright http://www.gnu.org/licenses/gpl-2.0.txt -* GNU General Public License -*/ - -#include "BusInspectionUnitObserver.h" - -#include <ArmarXCore/observers/checks/ConditionCheckUpdated.h> -#include <ArmarXCore/observers/checks/ConditionCheckEquals.h> -#include <ArmarXCore/observers/checks/ConditionCheckInRange.h> -#include <ArmarXCore/observers/checks/ConditionCheckLarger.h> -#include <ArmarXCore/observers/checks/ConditionCheckSmaller.h> -#include <ArmarXCore/observers/checks/ConditionCheckEqualsWithTolerance.h> -#include <RobotAPI/libraries/core/checks/ConditionCheckMagnitudeChecks.h> -#include <RobotAPI/libraries/core/observerfilters/OffsetFilter.h> -#include <ArmarXCore/observers/variant/DatafieldRef.h> - -#include <RobotAPI/libraries/core/RobotAPIObjectFactories.h> - -using namespace armarx; - -BusInspectionUnitObserver::BusInspectionUnitObserver() -{ -} - -void BusInspectionUnitObserver::setTopicName(std::string topicName) -{ - this->topicName = topicName; -} - -void BusInspectionUnitObserver::onInitObserver() -{ - if (topicName.empty()) - { - usingTopic(getProperty<std::string>("BusInspectionUnitTopicName").getValue()); - ARMARX_INFO << "Using topic " << getProperty<std::string>("BusInspectionUnitTopicName").getValue(); - } - else - { - usingTopic(topicName); - ARMARX_INFO << "Using topic " << topicName; - } -} - -void BusInspectionUnitObserver::onConnectObserver() -{ -} - -PropertyDefinitionsPtr BusInspectionUnitObserver::createPropertyDefinitions() -{ - return PropertyDefinitionsPtr(new BusInspectionUnitObserverPropertyDefinitions(getConfigIdentifier())); -} - -void BusInspectionUnitObserver::reportCycleTimeStatistics(int averageCycleTime, int minCycleTime, int maxCycleTime, const Ice::Current&) -{ - ScopedLock lock(dataMutex); - - try - { - std::string channelName = "HALCycleTimes"; - - DataFieldIdentifierPtr id_avg = new DataFieldIdentifier(getName(), channelName, "Average HAL Cycle"); - if (!existsChannel(id_avg->channelName)) - { - offerChannel(id_avg->channelName, "HAL Cycle times"); - } - - if (!existsDataField(id_avg->channelName, id_avg->datafieldName)) - { - offerDataFieldWithDefault(id_avg->channelName, id_avg->datafieldName, Variant(averageCycleTime), "Average HAL cycle time"); - } - else - { - setDataField(id_avg->channelName, id_avg->datafieldName, Variant(averageCycleTime)); - } - - DataFieldIdentifierPtr id_min = new DataFieldIdentifier(getName(), channelName, "Minimum HAL Cycle"); - if (!existsDataField(id_min->channelName, id_min->datafieldName)) - { - offerDataFieldWithDefault(id_min->channelName, id_min->datafieldName, Variant(minCycleTime), "Minimum HAL cycle time"); - } - else - { - setDataField(id_min->channelName, id_min->datafieldName, Variant(minCycleTime)); - } - - DataFieldIdentifierPtr id_max = new DataFieldIdentifier(getName(), channelName, "Maximum HAL Cycle"); - if (!existsDataField(id_max->channelName, id_max->datafieldName)) - { - offerDataFieldWithDefault(id_max->channelName, id_max->datafieldName, Variant(maxCycleTime), "Maximum HAL cycle time"); - } - else - { - setDataField(id_max->channelName, id_max->datafieldName, Variant(maxCycleTime)); - } - - updateChannel(channelName); - } - catch (std::exception& e) - { - ARMARX_ERROR << "Reporting HAL cycle time failed! "; - handleExceptions(); - } -} diff --git a/source/RobotAPI/components/units/BusInspectionUnitObserver.h b/source/RobotAPI/components/units/BusInspectionUnitObserver.h deleted file mode 100644 index 3eded4de0..000000000 --- a/source/RobotAPI/components/units/BusInspectionUnitObserver.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -* 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 ArmarX:: -* @author Peter Kaiser (peter dot kaiser at kit dot edu) -* @date 2015 -* @copyright http://www.gnu.org/licenses/gpl-2.0.txt -* GNU General Public License -*/ - -#ifndef _ARMARX_ROBOTAPI_BUSINSPECTIONUNITOBSERVER_H -#define _ARMARX_ROBOTAPI_BUSINSPECTIONUNITOBSERVER_H - -#include <RobotAPI/interface/hardware/BusInspectionInterface.h> -#include <ArmarXCore/observers/Observer.h> - -namespace armarx -{ - /** - * \class ForceTorqueObserverPropertyDefinitions - * \brief - */ - class BusInspectionUnitObserverPropertyDefinitions: - public ObserverPropertyDefinitions - { - public: - BusInspectionUnitObserverPropertyDefinitions(std::string prefix): - ObserverPropertyDefinitions(prefix) - { - defineOptionalProperty<std::string>("BusInspectionUnitTopicName", "HALCycleTimes", "Name of the BusInspectionUnit Topic"); - } - }; - - class BusInspectionUnitObserver : - virtual public Observer, - virtual public BusInspectionUnitObserverInterface - { - public: - BusInspectionUnitObserver(); - - void setTopicName(std::string topicName); - - virtual std::string getDefaultName() const - { - return "BusInspectionUnitObserver"; - } - void onInitObserver(); - void onConnectObserver(); - - virtual void reportCycleTimeStatistics(int averageCycleTime, int minCycleTime, int maxCycleTime, const Ice::Current&); - - /** - * @see PropertyUser::createPropertyDefinitions() - */ - virtual PropertyDefinitionsPtr createPropertyDefinitions(); - - private: - armarx::Mutex dataMutex; - std::string topicName; - }; -} - -#endif diff --git a/source/RobotAPI/components/units/CMakeLists.txt b/source/RobotAPI/components/units/CMakeLists.txt index 503f3e2e3..94ed1485e 100644 --- a/source/RobotAPI/components/units/CMakeLists.txt +++ b/source/RobotAPI/components/units/CMakeLists.txt @@ -37,8 +37,6 @@ set(LIB_HEADERS HandUnit.h HandUnitSimulation.h - BusInspectionUnit.h - BusInspectionUnitObserver.h KinematicUnit.h KinematicUnitSimulation.h PlatformUnit.h @@ -64,8 +62,6 @@ set(LIB_FILES HandUnit.cpp HandUnitSimulation.cpp - BusInspectionUnit.cpp - BusInspectionUnitObserver.cpp KinematicUnit.cpp KinematicUnitSimulation.cpp PlatformUnit.cpp diff --git a/source/RobotAPI/interface/CMakeLists.txt b/source/RobotAPI/interface/CMakeLists.txt index 044aadda5..11dd79e23 100644 --- a/source/RobotAPI/interface/CMakeLists.txt +++ b/source/RobotAPI/interface/CMakeLists.txt @@ -5,8 +5,6 @@ set(ROBOTAPI_INTERFACE_DEPEND ArmarXCore) set(SLICE_FILES - hardware/BusInspectionInterface.ice - observers/KinematicUnitObserverInterface.ice observers/PlatformUnitObserverInterface.ice observers/ObserverFilters.ice diff --git a/source/RobotAPI/interface/hardware/BusInspectionInterface.ice b/source/RobotAPI/interface/hardware/BusInspectionInterface.ice deleted file mode 100644 index ef342bda1..000000000 --- a/source/RobotAPI/interface/hardware/BusInspectionInterface.ice +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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 ArmarX::Core - * @author Peter Kaiser (peter dot kaiser at kit dot edu) - * @author Matthias Hadlich (matthias dot hadlich at student dot kit dot edu) - * @copyright 2014 Peter Kaiser - * @license http://www.gnu.org/licenses/gpl-2.0.txt - * GNU General Public License - */ - -#ifndef _ARMARX_CORE_BUSINSPECTIONINTERFACE_SLICE_ -#define _ARMARX_CORE_BUSINSPECTIONINTERFACE_SLICE_ - -#include <RobotAPI/interface/units/KinematicUnitInterface.ice> - -#include <ArmarXCore/interface/core/UserException.ice> -#include <ArmarXCore/interface/core/BasicTypes.ice> -#include <ArmarXCore/interface/observers/ObserverInterface.ice> - -module armarx -{ - exception UnknownBusException extends UserException - { - string busName; - }; - - exception UnknownDeviceException extends UserException - { - string deviceName; - }; - - exception UnknownCommandException extends UserException - { - string commandName; - }; - - struct DeviceStatus - { - OperationStatus operation; - ErrorStatus error; - - bool enabled; - bool emergencyStop; - string msg; - }; - - sequence<string> BusNames; - sequence<string> DeviceNames; - - struct DeviceInformation - { - int id; - string type; - int heartBeatErrorCounter; - string firmwareBuildDate; - - DeviceStatus status; - }; - - struct BusInformation - { - int baudrate; - int amountOfErrors; - }; - - enum BasicOperation { eStart, eStop, eReset }; - - - interface BusInspectionInterface - { - BusNames getConfiguredBusses(); - BusInformation getBusInformation(string bus) throws UnknownBusException; - DeviceNames getDevicesOnBus(string bus) throws UnknownBusException; - DeviceInformation getDeviceInformation(string device) throws UnknownDeviceException; - int performDeviceOperation(BasicOperation operation, int device); - int performBusOperation(BasicOperation operation, string bus); - bool isInRealTimeMode(); - string sendCommand(string command, int device) throws UnknownCommandException; - }; - - interface BusInspectionListener - { - /** - * Report statistics on the cycle times of the underlying hardware abstraction layer - * - * Times are given in µs. - */ - void reportCycleTimeStatistics(int averageCycleTime, int minCycleTime, int maxCycleTime); - }; - - interface BusInspectionUnitObserverInterface extends ObserverInterface, BusInspectionListener - { - }; - -}; - -#endif -- GitLab