Skip to content
Snippets Groups Projects
Commit 91ea252f authored by Nikolaus Vahrenkamp's avatar Nikolaus Vahrenkamp
Browse files
parents 6f4364ad 28077aba
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 680 deletions
add_subdirectory(WeissHapticSensorsUnitTest)
add_subdirectory(DummyTest)
\ No newline at end of file
set(SCENARIO_COMPONENTS
DummyUnitApp
DummyUnitObserver
)
# optional 3rd parameter: "path/to/global/config.cfg"
armarx_scenario("DummyUnitTest" "${SCENARIO_COMPONENTS}")
# ==================================================================
# ArmarX properties
# ==================================================================
# ArmarX.DataPath: Semicolon-separated search list for data files
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.DataPath = ""
# ArmarX.Verbosity: Global logging level for whole application
# Attributes:
# - Default: Verbose
# - Case sensitivity: no
# - Required: no
# - Possible values: {Debug, Error, Fatal, Important, Info, Undefined, Verbose, Warning}
# ArmarX.Verbosity = Verbose
# ArmarX.DisableLogging: Turn logging off in whole application
# Attributes:
# - Default: 0
# - Case sensitivity: no
# - Required: no
# - Possible values: {0, 1, false, no, true, yes}
# ArmarX.DisableLogging = 0
# ArmarX.CachePath: Path for cache files
# Attributes:
# - Default: ${HOME}/.armarx/mongo/.cache
# - Case sensitivity: no
# - Required: no
# ArmarX.CachePath = ${HOME}/.armarx/mongo/.cache
# ArmarX.ApplicationName: Application name
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.ApplicationName = ""
# ArmarX.Config: Comma-separated list of configuration files
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.Config = ""
# ==================================================================
# ArmarX.DummyUnit properties
# ==================================================================
# ArmarX.DummyUnit.ReportPeriod: The unit's reporting period in ms
# Attributes:
# - Case sensitivity: no
# - Required: yes
ArmarX.DummyUnit.ReportPeriod = 1000
# ArmarX.DummyUnit.MinimumLoggingLevel: Local logging level only for this component
# Attributes:
# - Default: Undefined
# - Case sensitivity: no
# - Required: no
# - Possible values: {Error, Fatal, Info, Undefined, Verbose, Warning}
# ArmarX.DummyUnit.MinimumLoggingLevel = Undefined
# ArmarX.DummyUnit.ObjectName: Name of IceGrid well-known object
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.DummyUnit.ObjectName = ""
# ==================================================================
# ArmarX properties
# ==================================================================
# ArmarX.DataPath: Semicolon-separated search list for data files
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.DataPath = ""
# ArmarX.Verbosity: Global logging level for whole application
# Attributes:
# - Default: Verbose
# - Case sensitivity: no
# - Required: no
# - Possible values: {Debug, Error, Fatal, Important, Info, Undefined, Verbose, Warning}
# ArmarX.Verbosity = Verbose
# ArmarX.DisableLogging: Turn logging off in whole application
# Attributes:
# - Default: 0
# - Case sensitivity: no
# - Required: no
# - Possible values: {0, 1, false, no, true, yes}
# ArmarX.DisableLogging = 0
# ArmarX.CachePath: Path for cache files
# Attributes:
# - Default: ${HOME}/.armarx/mongo/.cache
# - Case sensitivity: no
# - Required: no
# ArmarX.CachePath = ${HOME}/.armarx/mongo/.cache
# ArmarX.ApplicationName: Application name
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.ApplicationName = ""
# ArmarX.Config: Comma-separated list of configuration files
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.Config = ""
# ==================================================================
# ArmarX.DummyUnitObserver properties
# ==================================================================
# ArmarX.DummyUnitObserver.ReportPeriod: The unit's reporting period in ms
# Attributes:
# - Case sensitivity: no
# - Required: yes
ArmarX.DummyUnitObserver.ReportPeriod = <set value!>
# ArmarX.DummyUnitObserver.MinimumLoggingLevel: Local logging level only for this component
# Attributes:
# - Default: Undefined
# - Case sensitivity: no
# - Required: no
# - Possible values: {Error, Fatal, Info, Undefined, Verbose, Warning}
# ArmarX.DummyUnitObserver.MinimumLoggingLevel = Undefined
# ArmarX.DummyUnitObserver.ObjectName: Name of IceGrid well-known object
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.DummyUnitObserver.ObjectName = ""
......@@ -21,6 +21,4 @@ add_subdirectory(PlatformUnitObserver)
add_subdirectory(RobotStateComponent)
add_subdirectory(RobotStateObserver)
add_subdirectory(HandUnitObserver)
add_subdirectory(DummyUnit)
add_subdirectory(DummyUnitObserver)
armarx_component_set_name("DummyUnitApp")
set(COMPONENT_LIBS RobotAPIInterfaces RobotAPIUnits ArmarXCore)
set(EXE_SOURCE main.cpp DummyUnitApp.h)
armarx_add_component_executable("${EXE_SOURCE}")
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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 Lesser 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::DummyUnit
* @author Peter Kaiser (peter dot kaiser at kit dot edu)
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#ifndef _ARMARX_APPLICATION_RobotAPI_DummyUnit_H
#define _ARMARX_APPLICATION_RobotAPI_DummyUnit_H
#include <Core/core/application/Application.h>
#include <RobotAPI/units/DummyUnit.h>
namespace armarx
{
class DummyUnitApp :
virtual public armarx::Application
{
void setup(const ManagedIceObjectRegistryInterfacePtr& registry, Ice::PropertiesPtr properties)
{
registry->addObject(Component::create<DummyUnit>(properties));
}
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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 Lesser 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::DummyUnitApp
* @author Peter Kaiser (peter dot kaiser at kit dot edu)
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#include "DummyUnitApp.h"
int main(int argc, char* argv[])
{
armarx::ApplicationPtr app = armarx::Application::createInstance <armarx::DummyUnitApp>();
app->setName("DummyUnit");
return app->main(argc, argv);
}
armarx_component_set_name(DummyUnitObserver)
set(COMPONENT_LIBS RobotAPIUnits RobotAPICore RobotAPIInterfaces ArmarXInterfaces ArmarXCore ArmarXCoreObservers)
set(SOURCES main.cpp DummyUnitObserverApp.h)
armarx_add_component_executable("${SOURCES}")
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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 Lesser 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::DummyUnit
* @author Peter Kaiser (peter dot kaiser at kit dot edu)
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#include <Core/core/application/Application.h>
#include <RobotAPI/units/DummyUnitObserver.h>
namespace armarx
{
class DummyUnitObserverApp :
virtual public armarx::Application
{
void setup(const ManagedIceObjectRegistryInterfacePtr& registry, Ice::PropertiesPtr properties)
{
registry->addObject( Component::create<DummyUnitObserver>(properties) );
}
};
}
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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 Lesser 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::DummyUnit
* @author Peter Kaiser (peter dot kaiser at kit dot edu)
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#include "DummyUnitObserverApp.h"
#include <Core/core/logging/Logging.h>
int main(int argc, char* argv[])
{
armarx::ApplicationPtr app = armarx::Application::createInstance<armarx::DummyUnitObserverApp>();
app->setName("DummyUnitObserver");
return app->main(argc, argv);
}
......@@ -9,7 +9,6 @@ set(SLICE_FILES
observers/KinematicUnitObserverInterface.ice
observers/PlatformUnitObserverInterface.ice
observers/DummyUnitObserverInterface.ice
robotstate/LinkedPoseBase.ice
robotstate/PoseBase.ice
......@@ -27,7 +26,6 @@ set(SLICE_FILES
units/TCPControlUnit.ice
units/TCPMoverUnitInterface.ice
units/UnitInterface.ice
units/DummyUnitInterface.ice
)
# generate the interface library
......
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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 Lesser 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 Peter Kaiser (peter dot kaiser at kit dot edu)
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#ifndef _ARMARX_CORE_DUMMY_UNIT_OBSERVER_SLICE_
#define _ARMARX_CORE_DUMMY_UNIT_OBSERVER_SLICE_
#include <RobotAPI/interface/units/DummyUnitInterface.ice>
#include <Core/interface/observers/ObserverInterface.ice>
module armarx
{
interface DummyUnitObserverInterface extends ObserverInterface, DummyUnitListener
{
};
};
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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 Lesser 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::RobotAPI
* @author Peter Kaiser (peter dot kaiser at kit dot edu)
* @copyright 2014
* @license http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#ifndef _ARMARX_CORE_DUMMYUNIT_SLICE_
#define _ARMARX_CORE_DUMMYUNIT_SLICE_
#include <RobotAPI/interface/units/UnitInterface.ice>
#include <Core/interface/observers/VariantBase.ice>
#include <Core/interface/observers/ObserverInterface.ice>
/*
* The DummyUnit is a SensorActorUnit that is only implemented for documentation
* purposes. It is designed to be a minimum working example and has no real use.
*/
module armarx
{
interface DummyUnitInterface extends SensorActorUnitInterface
{
void setPeriodicValue(VariantBase value);
};
interface DummyUnitListener
{
void reportPeriodicValue(VariantBase value);
};
};
#endif
......@@ -47,8 +47,6 @@ set(LIB_HEADERS
KinematicUnitObserver.h
PlatformUnitObserver.h
SensorActorUnit.h
DummyUnit.h
DummyUnitObserver.h
)
set(LIB_FILES
......@@ -71,8 +69,6 @@ set(LIB_FILES
KinematicUnitObserver.cpp
PlatformUnitObserver.cpp
SensorActorUnit.cpp
DummyUnit.cpp
DummyUnitObserver.cpp
)
armarx_add_library("${LIB_NAME}" "${LIB_VERSION}" "${LIB_SOVERSION}" "${LIB_FILES}" "${LIB_HEADERS}" "${LIBS}")
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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 Lesser 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 Peter Kaiser (peter dot kaiser at kit dot edu)
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#include "DummyUnit.h"
using namespace armarx;
void DummyUnit::onInitComponent()
{
period = getProperty<int>("ReportPeriod").getValue();
periodicValue = VariantPtr(new Variant(10));
offeringTopic("PeriodicDummyValue");
}
void DummyUnit::onConnectComponent()
{
listenerPrx = getTopic<DummyUnitListenerPrx>("PeriodicDummyValue");
if(periodicTask)
{
periodicTask->stop();
}
periodicTask = new PeriodicTask<DummyUnit>(this, &DummyUnit::reportValue, period, false, "DummyValueProducer");
periodicTask->start();
}
void DummyUnit::onExitComponent()
{
}
void DummyUnit::setPeriodicValue(const VariantBasePtr &value, const Ice::Current &c)
{
periodicValue = VariantPtr::dynamicCast(value);
}
PropertyDefinitionsPtr DummyUnit::createPropertyDefinitions()
{
return PropertyDefinitionsPtr(new DummyUnitPropertyDefinitions(getConfigIdentifier()));
}
void DummyUnit::reportValue()
{
listenerPrx->reportPeriodicValue(periodicValue);
}
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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 Lesser 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 Peter Kaiser (peter dot kaiser at kit dot edu)
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#ifndef _ARMARX_COMPONENT_DUMMY_UNIT_H
#define _ARMARX_COMPONENT_DUMMY_UNIT_H
#include <RobotAPI/units/SensorActorUnit.h>
#include <Core/core/Component.h>
#include <Core/core/application/properties/Properties.h>
#include <Core/core/system/ImportExportComponent.h>
#include <Core/observers/variant/Variant.h>
#include <Core/core/services/tasks/PeriodicTask.h>
#include <RobotAPI/interface/units/DummyUnitInterface.h>
namespace armarx
{
class DummyUnitPropertyDefinitions:
public ComponentPropertyDefinitions
{
public:
DummyUnitPropertyDefinitions(std::string prefix):
ComponentPropertyDefinitions(prefix)
{
defineRequiredProperty<int>("ReportPeriod","The unit's reporting period in ms");
}
};
class DummyUnit :
virtual public DummyUnitInterface,
virtual public SensorActorUnit
{
public:
virtual std::string getDefaultName() const { return "DummyUnit"; }
virtual void onInitComponent();
virtual void onConnectComponent();
virtual void onExitComponent();
virtual void setPeriodicValue(const VariantBasePtr &value, const Ice::Current& c = ::Ice::Current());
virtual PropertyDefinitionsPtr createPropertyDefinitions();
protected:
void reportValue();
DummyUnitListenerPrx listenerPrx;
PeriodicTask<DummyUnit>::pointer_type periodicTask;
int period;
VariantPtr periodicValue;
};
}
#endif
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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 Lesser 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 Peter Kaiser (peter dot kaiser at kit dot edu)
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#include "DummyUnitObserver.h"
armarx::DummyUnitObserver::DummyUnitObserver()
{
}
void armarx::DummyUnitObserver::onInitObserver()
{
usingTopic("PeriodicDummyValue");
}
void armarx::DummyUnitObserver::onConnectObserver()
{
}
void armarx::DummyUnitObserver::reportPeriodicValue(const armarx::VariantBasePtr &value, const Ice::Current &)
{
ARMARX_INFO << VariantPtr::dynamicCast(value);
}
armarx::PropertyDefinitionsPtr armarx::DummyUnitObserver::createPropertyDefinitions()
{
return armarx::PropertyDefinitionsPtr(new DummyUnitPropertyDefinitions(getConfigIdentifier()));
}
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* 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 Lesser 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 Peter Kaiser (peter dot kaiser at kit dot edu)
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#ifndef _ARMARX_ROBOTAPI_DUMMYUNIT_OBSERVER_H
#define _ARMARX_ROBOTAPI_DUMMYUNIT_OBSERVER_H
#include <RobotAPI/interface/observers/DummyUnitObserverInterface.h>
#include <Core/observers/Observer.h>
#include <Core/core/application/properties/Properties.h>
namespace armarx
{
class DummyUnitPropertyDefinitions : public ComponentPropertyDefinitions
{
public:
DummyUnitPropertyDefinitions(std::string prefix) :
ComponentPropertyDefinitions(prefix)
{
// No required properties
}
};
class DummyUnitObserver :
virtual public Observer,
virtual public DummyUnitObserverInterface
{
public:
DummyUnitObserver();
virtual std::string getDefaultName() const { return "DummyUnitObserver"; }
void onInitObserver();
void onConnectObserver();
void reportPeriodicValue(const VariantBasePtr &value, const ::Ice::Current& = ::Ice::Current());
virtual PropertyDefinitionsPtr createPropertyDefinitions();
};
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment