Skip to content
Snippets Groups Projects
Commit d00e7799 authored by Valerij Wittenbeck's avatar Valerij Wittenbeck
Browse files

Added new statechart for moving the platform

parent 47ff66dc
No related branches found
No related tags found
No related merge requests found
Showing
with 1007 additions and 1 deletion
[General]
loadedLibs=Gui/build/lib/libConditionViewerGuiPlugin.so, Gui/build/lib/libHandUnitGuiPlugin.so, Gui/build/lib/libHardwareGuiPlugin.so, Gui/build/lib/libKinematicUnitGuiPlugin.so, Gui/build/lib/libLoggingGuiPlugin.so, Gui/build/lib/libObjectExaminerGuiPlugin.so, Gui/build/lib/libObserverPropertiesGuiPlugin.so, Gui/build/lib/libPlatformUnitGuiPlugin.so, Gui/build/lib/libSensorActorWidgetsGuiPlugin.so, Gui/build/lib/libStateChartGuiPlugin.so, Gui/build/lib/libSystemStateMonitorGuiPlugin.so, SimulationX/build/lib/libSimulatorControlGuiPlugin.so
MainWindowGeometry=@ByteArray(\x1\xd9\xd0\xcb\0\x1\0\0\0\0\x2\x10\0\0\0\x46\0\0\a%\0\0\x4\x1a\0\0\x2\x18\0\0\0\x62\0\0\a\x1d\0\0\x4\x12\0\0\0\0\0\0)
DockWidgetsState="@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x1\0\0\0\x1\0\0\x5\x6\0\0\x3\x82\xfc\x2\0\0\0\x2\xfc\0\0\0\x19\0\0\x2\xd2\0\0\0\xdc\0\xff\xff\xff\xfc\x1\0\0\0\x2\xfb\0\0\0\x1a\0\x44\0o\0\x63\0k\0L\0o\0g\0V\0i\0\x65\0w\0\x65\0r\x1\0\0\0\0\0\0\x3\xec\0\0\0\xc8\0\xff\xff\xff\xfb\0\0\0,\0\x44\0o\0\x63\0k\0S\0y\0s\0t\0\x65\0m\0S\0t\0\x61\0t\0\x65\0M\0o\0n\0i\0t\0o\0r\x1\0\0\x3\xf2\0\0\x1\x14\0\0\0\xd3\0\xff\xff\xff\xfb\0\0\0\x1e\0\x44\0o\0\x63\0k\0\x45\0v\0\x65\0n\0t\0S\0\x65\0n\0\x64\0\x65\0r\x1\0\0\x2\xf1\0\0\0\xaa\0\0\0\xaa\0\xff\xff\xff\0\0\0\0\0\0\x3\x82\0\0\0\x4\0\0\0\x4\0\0\0\b\0\0\0\b\xfc\0\0\0\0)"
WidgetCustomNames=EventSender, LogViewer, SystemStateMonitor
[EventSender]
WidgetBaseName=EventSender
widgetWidth=1286
widgetHeight=150
EventSender\1\eventSenderName=startMovePlatformTest
EventSender\1\description=
EventSender\1\componentName=RobotControlStateOfferer
EventSender\1\globalStateIdentifier=RobotStatechart->RobotControl->Functional
EventSender\1\eventName=EvLoadScenario
EventSender\1\eventReceiverName=toAll
EventSender\1\parameters\1\key=proxyName
EventSender\1\parameters\1\VariantTypeId=-2125418521
EventSender\1\parameters\1\value=MovePlatformStateChartStateOfferer
EventSender\1\parameters\2\key=stateName
EventSender\1\parameters\2\VariantTypeId=-2125418521
EventSender\1\parameters\2\value=MovePlatformStateChart
EventSender\1\parameters\size=2
EventSender\size=1
[LogViewer]
WidgetBaseName=LogViewer
widgetWidth=1004
widgetHeight=702
verbosityLevel=1
autoFilterAdding=true
[SystemStateMonitor]
WidgetBaseName=SystemStateMonitor
widgetWidth=276
widgetHeight=702
ManagerRepository=@Invalid()
MonitoredManagers=ArmarXGuiManager, ArmarXSimulatorManager, CommonStorageManager, ConditionHandlerManager, KinematicUnitDynamicSimulationManager, KinematicUnitObserverManager, KinematicUnitSimulationManager, LongtermMemoryManager, MovePlatformAppManager, PlatformUnitDynamicSimulationManager, PlatformUnitObserverManager, PriorKnowledgeManager, RobotControlManager, RobotStateComponentManager, SystemObserverManager, WavingManager
ArmarX.LoadPlugins=${ArmarXHome_DIR}/Gui/build/lib/libKinematicUnitGuiPlugin.so
ArmarX.Show3DViewer=yes
# model XML file path containing a VirtualRobot RobotNodeSet that defines the joints
ArmarX.KinematicUnitGuiPlugin.RobotFileName=Armar4/data/robotmodel/ArmarIV.xml
# node set name
ArmarX.KinematicUnitGuiPlugin.RobotNodeSetName=Robot
ArmarX.KinematicUnitGuiPlugin.KinematicUnitName=Armar4KinematicUnit
# ==================================================================
# ArmarX properties
# ==================================================================
# ArmarX.CachePath: Path for cache files
# Attributes:
# - Default: .cache
# - Case sensitivity: no
# - Required: no
# ArmarX.CachePath = .cache
# 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.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.ConditionHandler properties
# ==================================================================
# ArmarX.ConditionHandler.HistoryLength: Length of condition history kept by the conditionhandler
# Attributes:
# - Default: 1000
# - Case sensitivity: no
# - Required: no
# ArmarX.ConditionHandler.HistoryLength = 1000
# ArmarX.ConditionHandler.Observers: Comma seperated observer list
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.ConditionHandler.Observers = ""
# ArmarX.ConditionHandler.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.ConditionHandler.MinimumLoggingLevel = Undefined
# ArmarX.ConditionHandler.ObjectName: Name of IceGrid well-known object
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.ConditionHandler.ObjectName = ""
ArmarX.DisableLogging = no
VisionX.DisableLogging = no
ArmarX.GlobalMinimumLoggingLevel = Verbose
VisionX.GlobalMinimumLoggingLevel = Verbose
<MovePlatformStateChart>
<StateParameters>
<!--
x/y are in mm
for now z=rotation around z axis in radian
-->
<targetPositions>
<Item0>
<x>0</x>
<y>0</y>
<z>0</z>
</Item0>
<Item1>
<x>0</x>
<y>10000</y>
<z>0</z>
</Item1>
<Item2>
<x>0</x>
<y>10000</y>
<z>1</z>
</Item2>
<Item3>
<x>-3000</x>
<y>5000</y>
<z>1</z>
</Item3>
<Item4>
<x>0</x>
<y>0</y>
<z>0</z>
</Item4>
</targetPositions>
<!--unreachable-->
<!--targetPositions>
<Item0>
<x>5000</x>
<y>5000</y>
<z>0</z>
</Item0>
</targetPositions-->
<positionalAccuracy>10</positionAccuracy> <!--mm-->
<orientationalAccuracy>0.1</orientationAccuracy> <!--rad-->
<timeoutMoveTo>30000</timeoutMoveTO>
</StateParameters>
</MovePlatformStateChart>
# ==================================================================
# ArmarX properties
# ==================================================================
# ArmarX.CachePath: Path for cache files
# Attributes:
# - Default: .cache
# - Case sensitivity: no
# - Required: no
# ArmarX.CachePath = .cache
# 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.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.PlatformUnitObserver properties
# ==================================================================
ArmarX.PlatformUnitObserver.PlatformName=Platform
# ==================================================================
# ArmarX properties
# ==================================================================
# ArmarX.CachePath: Path for cache files
# Attributes:
# - Default: .cache
# - Case sensitivity: no
# - Required: no
# ArmarX.CachePath = .cache
# 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.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.RobotControlStateOfferer properties
# ==================================================================
# ArmarX.RobotControlStateOfferer.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.RobotControlStateOfferer.MinimumLoggingLevel = Undefined
# ArmarX.RobotControlStateOfferer.ObjectName: Name of IceGrid well-known object
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.RobotControlStateOfferer.ObjectName = ""
setting colored console to deactivated
# ==================================================================
# ArmarX properties
# ==================================================================
# ArmarX.CachePath: Path for cache files
# Attributes:
# - Default: .cache
# - Case sensitivity: no
# - Required: no
# ArmarX.CachePath = .cache
# 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.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.RobotStateComponent properties
# ==================================================================
# ArmarX.RobotStateComponent.RobotFileName: Filename of VirtualRobot robot model (e.g. robot_model.xml)
# Attributes:
# - Case sensitivity: no
# - Required: yes
ArmarX.RobotStateComponent.RobotFileName =Armar3/data/robotmodel/ArmarIII.xml
# ArmarX.RobotStateComponent.RobotNodeSetName: Set of nodes that is controlled by the KinematicUnit
# Attributes:
# - Case sensitivity: no
# - Required: yes
ArmarX.RobotStateComponent.RobotNodeSetName =Robot
# ArmarX.RobotStateComponent.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.RobotStateComponent.MinimumLoggingLevel = Undefined
# ArmarX.RobotStateComponent.ObjectName: Name of IceGrid well-known object
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.RobotStateComponent.ObjectName = ""
# ==================================================================
# ArmarX properties
# ==================================================================
# ArmarX.CachePath: Path for cache files
# Attributes:
# - Default: .cache
# - Case sensitivity: no
# - Required: no
# ArmarX.CachePath = .cache
# 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.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.SystemObserver properties
# ==================================================================
# ArmarX.SystemObserver.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.SystemObserver.MinimumLoggingLevel = Undefined
# ArmarX.SystemObserver.ObjectName: Name of IceGrid well-known object
# Attributes:
# - Default: ""
# - Case sensitivity: no
# - Required: no
# ArmarX.SystemObserver.ObjectName = ""
export CORE_PATH=../../../Core
export GUI_PATH=../../../Gui
export VISIONX_PATH=../..././VisionX
export ARMAR4_PATH=../../../Armar4
export HUMANOIDROBOTAPI_PATH=../../../RobotAPI
export SCRIPT_PATH=$CORE_PATH/build/bin
export SIMULATION_PATH=../../../SimulationX
export CORE_BIN_PATH=$CORE_PATH/build/bin
export GUI_BIN_PATH=$GUI_PATH/build/bin
export VISIONX_BIN_PATH=$VISIONX_PATH/build/bin
export ARMAR4_BIN_PATH=$ARMAR4_PATH/build/bin
export HUMANOIDROBOTAPI_BIN_PATH=$HUMANOIDROBOTAPI_PATH/build/bin
export GLOBAL_CONFIG=./configs/Global.cfg
# armarx components
$SIMULATION_PATH/scenarios/startScenario.sh
$SCRIPT_PATH/startApplication.sh $CORE_BIN_PATH/PlatformUnitObserverRun --Ice.Config=$GLOBAL_CONFIG,./configs/PlatformUnitObserver.cfg &
$SCRIPT_PATH/startApplication.sh $CORE_BIN_PATH/SystemObserverRun --Ice.Config=$GLOBAL_CONFIG &
$SCRIPT_PATH/startApplication.sh $CORE_BIN_PATH/RobotStateComponentRun --Ice.Config=$SIMULATION_PATH/scenarios/SimulatorGui/configs/Armar3KinematicUnit.cfg,./configs/RobotStateComponent.cfg &
$SCRIPT_PATH/startApplication.sh $CORE_BIN_PATH/RobotControlRun --Ice.Config=$GLOBAL_CONFIG &
$SCRIPT_PATH/startApplication.sh $CORE_BIN_PATH/ConditionHandlerRun --Ice.Config=$GLOBAL_CONFIG &
$SCRIPT_PATH/startApplication.sh $HUMANOIDROBOTAPI_BIN_PATH/MovePlatformAppRun --Ice.Config=$GLOBAL_CONFIG &
export CORE_PATH=../../../Core
export GUI_PATH=../../../Gui
export VISIONX_PATH=../..././VisionX
export ARMAR4_PATH=../../../Armar4
export HUMANOIDROBOTAPI_PATH=../../../RobotAPI
export SCRIPT_PATH=$CORE_PATH/build/bin
export SIMULATION_PATH=../../../SimulationX
export CORE_BIN_PATH=$CORE_PATH/build/bin
export GUI_BIN_PATH=$GUI_PATH/build/bin
export VISIONX_BIN_PATH=$VISIONX_PATH/build/bin
export ARMAR4_BIN_PATH=$ARMAR4_PATH/build/bin
export HUMANOIDROBOTAPI_BIN_PATH=$HUMANOIDROBOTAPI_PATH/build/bin
export GLOBAL_CONFIG=./configs/Global.cfg
# armarx components
$SCRIPT_PATH/startApplication.sh $CORE_BIN_PATH/PlatformUnitObserverRun --Ice.Config=$GLOBAL_CONFIG,./configs/PlatformUnitObserver.cfg &
$SCRIPT_PATH/startApplication.sh $CORE_BIN_PATH/SystemObserverRun --Ice.Config=$GLOBAL_CONFIG &
$SCRIPT_PATH/startApplication.sh $CORE_BIN_PATH/RobotStateComponentRun --Ice.Config=$SIMULATION_PATH/scenarios/SimulatorGui/configs/Armar3KinematicUnit.cfg,./configs/RobotStateComponent.cfg &
$SCRIPT_PATH/startApplication.sh $CORE_BIN_PATH/RobotControlRun --Ice.Config=$GLOBAL_CONFIG &
$SCRIPT_PATH/startApplication.sh $CORE_BIN_PATH/ConditionHandlerRun --Ice.Config=$GLOBAL_CONFIG &
$SCRIPT_PATH/startApplication.sh $HUMANOIDROBOTAPI_BIN_PATH/MovePlatformAppRun --Ice.Config=$GLOBAL_CONFIG &
skill ()
{
STR=`ps aux | grep -re "$1 --Ice.Default" | grep -v grep | awk '{print $2}'`
if [ ${#STR} == 0 ]
then
echo skipping $1
else
echo killing $1
kill -s $2 `ps aux | grep -re "$1 --Ice.Default" | grep -v grep | awk '{print $2}'`
fi
}
echo SENDING SIGINT TO ALL PROCESSES
../../../SimulationX/scenarios/stopScenario.sh
skill PlatformUnitObserverRun 2
skill SystemObserverRun 2
skill ConditionHandlerRun 2
skill RobotStateComponentRun 2
skill RobotControlRun 2
skill MovePlatformAppRun 2
sleep 1
echo SENDING SIGKILL TO ALL PROCESSES
skill PlatformUnitObserverRun 9
skill SystemObserverRun 9
skill ConditionHandlerRun 9
skill RobotStateComponentRun 9
skill RobotControlRun 9
skill MovePlatformAppRun 9
skill ()
{
STR=`ps aux | grep -re "$1 --Ice.Default" | grep -v grep | awk '{print $2}'`
if [ ${#STR} == 0 ]
then
echo skipping $1
else
echo killing $1
kill -s $2 `ps aux | grep -re "$1 --Ice.Default" | grep -v grep | awk '{print $2}'`
fi
}
echo SENDING SIGINT TO ALL PROCESSES
skill PlatformUnitObserverRun 2
skill SystemObserverRun 2
skill ConditionHandlerRun 2
skill RobotStateComponentRun 2
skill RobotControlRun 2
skill MovePlatformAppRun 2
sleep 1
echo SENDING SIGKILL TO ALL PROCESSES
skill PlatformUnitObserverRun 9
skill SystemObserverRun 9
skill ConditionHandlerRun 9
skill RobotStateComponentRun 9
skill RobotControlRun 9
skill MovePlatformAppRun 9
......@@ -4,4 +4,5 @@ add_subdirectory(applications)
add_subdirectory(units)
#add_subdirectory(armarx-objects)
add_subdirectory(statecharts)
add_subdirectory(MovePlatform)
armarx_set_target("RobotAPI Library: MovePlatform")
find_package(Eigen3 QUIET)
find_package(Simox QUIET)
armarx_build_if(Eigen3_FOUND "Eigen3 not available")
armarx_build_if(Simox_FOUND "Simox-VirtualRobot not available")
if (Eigen3_FOUND AND Simox_FOUND)
include_directories(
${Eigen3_INCLUDE_DIR}
${Simox_INCLUDE_DIRS})
endif()
set(LIB_NAME MovePlatform)
set(LIB_VERSION 0.1.0)
set(LIB_SOVERSION 0)
set(LIBS RobotAPICore RobotAPIInterfaces ArmarXInterfaces ArmarXCore ArmarXCoreObservers)
set(LIB_FILES MovePlatform.cpp
)
set(LIB_HEADERS
MovePlatform.h
PlatformContext.h
)
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::MovePlatform
* @author Valerij Wittenbeck
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#include "MovePlatform.h"
//#include "../core/RobotStatechartContext.h"
#include <Core/observers/variant/ChannelRef.h>
#include <Core/observers/variant/SingleTypeVariantList.h>
#include <Core/robotstate/remote/ArmarPose.h>
#include <VirtualRobot/IK/DifferentialIK.h>
#include <Core/interface/units/PlatformUnitInterface.h>
namespace armarx
{
void MovePlatformStateChart::onInitRemoteStateOfferer()
{
addState<StatechartMovePlatform>("MovePlatformStateChart");
}
void MovePlatformStateChart::onConnectRemoteStateOfferer()
{
}
// ****************************************************************
// Implementation of StatechartMovePlatform
// ****************************************************************
void StatechartMovePlatform::defineParameters()
{
setConfigFile("RobotAPI/scenarios/MovePlatformTest/configs/MovePlatformExample.xml");
addToInput("targetPositions", VariantType::List(VariantType::Vector3), false);
addToInput("positionalAccuracy", VariantType::Float, false);
addToInput("orientationalAccuracy", VariantType::Float, false);
addToInput("timeoutMoveTo", VariantType::Int, false);
addToLocal("positionCounter", VariantType::ChannelRef);
}
void StatechartMovePlatform::defineSubstates()
{
StatePtr stateMoveToNext = addState<StateMoveToNext>("stateMoveToNext");
StatePtr stateSuccess = addState<SuccessState>("stateSuccess");
StatePtr stateFailure = addState<FailureState>("stateFailure");
ParameterMappingPtr mapMoveToNextInfo = ParameterMapping::createMapping()
->mapFromParent("*", "*");
setInitState(stateMoveToNext, mapMoveToNextInfo);
//transitions
addTransition<EvTargetReached>(stateMoveToNext, stateMoveToNext, mapMoveToNextInfo);
addTransition<EvNoTargets>(stateMoveToNext, stateSuccess);
addTransition<EvTimeoutTargetUnreachable>(stateMoveToNext, stateFailure);
}
void StatechartMovePlatform::onEnter()
{
ARMARX_LOG << eVERBOSE << "Entering StatechartMovePlatform";
PlatformContext* context = getContext<PlatformContext>();
ChannelRefPtr counter = ChannelRefPtr::dynamicCast(context->systemObserverPrx->startCounter(0, "positionCounter"));
setLocal("positionCounter", counter);
}
void StatechartMovePlatform::onExit()
{
ChannelRefPtr r = getLocal<ChannelRef>("positionCounter");
getContext()->systemObserverPrx->removeCounter(r);
ARMARX_LOG << eVERBOSE << "Exiting StatechartMovePlatform...";
}
// ****************************************************************
// Implementation of StateMoveToNext
// ****************************************************************
void StateMoveToNext::defineParameters()
{
addToInput("targetPositions", VariantType::List(VariantType::Vector3), false);
addToInput("positionalAccuracy", VariantType::Float, false);
addToInput("orientationalAccuracy", VariantType::Float, false);
addToInput("timeoutMoveTo", VariantType::Int, false);
addToInput("positionCounter", VariantType::ChannelRef, false);
}
void StateMoveToNext::onEnter()
{
ARMARX_LOG << eVERBOSE << "Entering StateMoveToNext::onEnter";
PlatformContext* context = getContext<PlatformContext>();
ChannelRefPtr counter = getInput<ChannelRef>("positionCounter");
int positionIndex = counter->getDataField("value")->getInt();
SingleTypeVariantListPtr points = getInput<SingleTypeVariantList>("targetPositions");
if (positionIndex < points->getSize()) {
Vector3Ptr currentTarget = getInput<SingleTypeVariantList>("targetPositions")->getVariant(positionIndex)->get<Vector3>();
float positionalAccuracy = getInput<float>("positionalAccuracy");
float orientationalAccuracy = getInput<float>("orientationalAccuracy");
context->platformUnitPrx->moveTo(currentTarget->x, currentTarget->y, currentTarget->z, positionalAccuracy, orientationalAccuracy);
Literal checkX("PlatformUnitObserver.platformPose.positionX", "inrange", Literal::createParameterList(currentTarget->x-positionalAccuracy,currentTarget->x+positionalAccuracy));
Literal checkY("PlatformUnitObserver.platformPose.positionY", "inrange", Literal::createParameterList(currentTarget->y-positionalAccuracy,currentTarget->y+positionalAccuracy));
Literal checkAngle("PlatformUnitObserver.platformPose.rotation", "inrange", Literal::createParameterList(currentTarget->z-orientationalAccuracy,currentTarget->z+orientationalAccuracy));
condTargetReached = installCondition<EvTargetReached>(checkX && checkY && checkAngle);
timeoutMoveToNext = setTimeoutEvent(getInput<int>("timeoutMoveTo"), createEvent<EvTimeoutTargetUnreachable>());
} else {
sendEvent<EvNoTargets>();
}
context->systemObserverPrx->incrementCounter(counter);
ARMARX_LOG << eVERBOSE << "Done MoveToNext::onEnter()";
}
void StateMoveToNext::onExit()
{
removeCondition(condTargetReached);
removeTimeoutEvent(timeoutMoveToNext);
ARMARX_LOG << eVERBOSE << "StateMoveToNext: Done onExit()";
}
}
/**
* 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::GraspingWithTorques
* @author Markus Przybylski
* @date 2014 Markus Przybylski
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#ifndef ARMARX_COMPONENT_MOVE_PLATFORM_H
#define ARMARX_COMPONENT_MOVE_PLATFORM_H
#include <Core/statechart/Statechart.h>
#include <RobotAPI/MovePlatform/PlatformContext.h>
namespace armarx
{
class MovePlatformStateChart : public RemoteStateOfferer<PlatformContext>
{
public:
void onInitRemoteStateOfferer();
void onConnectRemoteStateOfferer();
std::string getStateOffererName() const { return "MovePlatformStateChart"; }
};
// ****************************************************************
// Events
// ****************************************************************
// DEFINEEVENT(EvSuccess)
DEFINEEVENT(EvTimeoutTargetUnreachable)
DEFINEEVENT(EvNoTargets)
DEFINEEVENT(EvTargetReached)
// ****************************************************************
// Definition of StatechartMovePlatform
// ****************************************************************
struct StatechartMovePlatform :
StateTemplate<StatechartMovePlatform>
{
void defineParameters();
void defineSubstates();
void onEnter();
void onExit();
};
// ****************************************************************
// Definition of StateMoveToNext
// ****************************************************************
/**
* StateMoveToNext: Move to next target in list
*/
struct StateMoveToNext :
StateTemplate<StateMoveToNext>
{
void defineParameters();
void onEnter();
void onExit();
ConditionIdentifier condTargetReached;
StateUtility::ActionEventIdentifier timeoutMoveToNext;
};
}
#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::MovePlatform
* @author Valerij Wittenbeck
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#ifndef ARMARX_COMPONENT_PlatformContext_H
#define ARMARX_COMPONENT_PlatformContext_H
#include <Core/core/Component.h>
#include <Core/core/system/ImportExportComponent.h>
#include <Core/statechart/StatechartContext.h>
#include <Core/robotstate/remote/RemoteRobot.h>
#include <Core/interface/units/PlatformUnitInterface.h>
#include <Core/units/PlatformUnitObserver.h>
//#include <VirtualRobot/VirtualRobot.h>
#include <IceUtil/Time.h>
namespace armarx
{
// ****************************************************************
// Component and context
// ****************************************************************
struct PlatformContextProperties : StatechartContextPropertyDefinitions
{
PlatformContextProperties(std::string prefix):
StatechartContextPropertyDefinitions(prefix)
{
defineOptionalProperty<std::string>("PlatformUnitName", "PlatformUnitDynamicSimulation", "Name of the PlatformUnit to use");
defineOptionalProperty<std::string>("PlatformUnitObserverName", "PlatformUnitObserver", "Name of the PlatformUnitObserver to use");
}
};
class ARMARXCOMPONENT_IMPORT_EXPORT PlatformContext :
virtual public StatechartContext
{
public:
// inherited from Component
virtual std::string getDefaultName() { return "PlatformContext"; }
virtual void onInitStatechartContext()
{
ARMARX_LOG << eINFO << "Init PlatformContext" << flush;
platformUnitObserverName = getProperty<std::string>("PlatformUnitObserverName").getValue();
platformUnitDynamicSimulationName = getProperty<std::string>("PlatformUnitName").getValue();
// usingProxy(getProperty<std::string>("PlatformUnitName").getValue());
usingProxy(platformUnitDynamicSimulationName);
usingProxy("RobotStateComponent");
usingProxy(platformUnitObserverName);
}
virtual void onConnectStatechartContext()
{
ARMARX_LOG << eINFO << "Starting PlatformContext" << flush;
// retrieve proxies
robotStateComponent = getProxy<RobotStateComponentInterfacePrx>("RobotStateComponent");
platformUnitPrx = getProxy<PlatformUnitInterfacePrx>(platformUnitDynamicSimulationName);
platformUnitObserverPrx = getProxy<PlatformUnitObserverInterfacePrx>(platformUnitObserverName);
ARMARX_LOG << eINFO << "Fetched proxies" << platformUnitPrx << " " << platformUnitObserverPrx << " " << robotStateComponent << flush;
// initialize remote robot
remoteRobot.reset(new RemoteRobot(robotStateComponent->getSynchronizedRobot()));
ARMARX_LOG << eINFO << "Created remote robot" << flush;
}
/**
* @see PropertyUser::createPropertyDefinitions()
*/
virtual PropertyDefinitionsPtr createPropertyDefinitions()
{
return PropertyDefinitionsPtr(new PlatformContextProperties(
getConfigIdentifier()));
}
std::string getPlatformUnitObserverName() { return platformUnitObserverName; }
//! Prx for the RobotState
RobotStateComponentInterfacePrx robotStateComponent;
PlatformUnitInterfacePrx platformUnitPrx;
PlatformUnitObserverInterfacePrx platformUnitObserverPrx;
//SystemObserverInterfacePrx systemObserver; // already defined in StatechartContext
VirtualRobot::RobotPtr remoteRobot;
private:
std::string platformUnitObserverName;
std::string platformUnitDynamicSimulationName;
};
}
#endif
......@@ -2,4 +2,4 @@
add_subdirectory(ForceTorqueObserver)
add_subdirectory(MotionControlTest)
add_subdirectory(TCPControlUnit)
add_subdirectory(MovePlatform)
#test case to move platform to prespecified positions
armarx_component_set_name(MovePlatformApp)
find_package(Eigen3 QUIET)
find_package(Simox QUIET)
armarx_build_if(Eigen3_FOUND "Eigen3 not available")
armarx_build_if(Simox_FOUND "Simox not available")
#armarx_build_if(MemoryX_FOUND "VisionX not available")
include_directories(${Eigen3_INCLUDE_DIR} ${Simox_INCLUDE_DIRS})
set(COMPONENT_LIBS
MovePlatform
ArmarXInterfaces
ArmarXCore
ArmarXCoreStatechart
ArmarXCoreObservers
ArmarXCoreOperations
ArmarXCoreRemoteRobot
#MemoryXInterfaces
#MemoryXCore
#MemoryXMemoryTypes
${Simox_LIBRARIES})
set(SOURCES main.cpp
MovePlatformApp.h)
armarx_add_component_executable("${SOURCES}")
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