diff --git a/source/RobotAPI/statecharts/CMakeLists.txt b/source/RobotAPI/statecharts/CMakeLists.txt index 17fa472e974f7c24c540105e8aab23fa842e6191..9674d17827b4ccdbbbb27200138ee005c56bd60e 100644 --- a/source/RobotAPI/statecharts/CMakeLists.txt +++ b/source/RobotAPI/statecharts/CMakeLists.txt @@ -1,4 +1,5 @@ add_subdirectory(operations) -add_subdirectory(WeissHapticGroup) \ No newline at end of file +add_subdirectory(WeissHapticGroup) +add_subdirectory(StatechartProfilesTestGroup) \ No newline at end of file diff --git a/source/RobotAPI/statecharts/StatechartProfilesTestGroup/CMakeLists.txt b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c00b9e340c0cc1e5f5c9b372cd9e5b4d4cbbf5d --- /dev/null +++ b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/CMakeLists.txt @@ -0,0 +1,51 @@ +armarx_component_set_name("StatechartProfilesTestGroup") + +#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() + +#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(COMPONENT_LIBS +# RobotAPIInterfaces RobotAPICore + ArmarXInterfaces ArmarXCore ArmarXCoreStatechart ArmarXCoreObservers) + +# Sources + +set(SOURCES +StatechartProfilesTestGroupRemoteStateOfferer.cpp +./TestState.cpp +#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@.cpp +) + +set(HEADERS +StatechartProfilesTestGroupRemoteStateOfferer.h +StatechartProfilesTestGroup.scgxml +StatechartProfilesTestGroupStatechartContext.generated.h +./TestState.h +#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@.h +./TestState.xml +#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@.xml +./TestState.generated.h +#@TEMPLATE_LINE@@COMPONENT_PATH@/@COMPONENT_NAME@.generated.h +) + +armarx_add_component("${SOURCES}" "${HEADERS}") diff --git a/source/RobotAPI/statecharts/StatechartProfilesTestGroup/StatechartProfilesTestGroup.scgxml b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/StatechartProfilesTestGroup.scgxml new file mode 100644 index 0000000000000000000000000000000000000000..c40311209e84d1dd872645ded6f675b095b60e5f --- /dev/null +++ b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/StatechartProfilesTestGroup.scgxml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<StatechartGroup name="StatechartProfilesTestGroup" package="RobotAPI" generateContext="true"> + <Proxies/> + <State filename="TestState.xml" visibility="public"/> +</StatechartGroup> + diff --git a/source/RobotAPI/statecharts/StatechartProfilesTestGroup/StatechartProfilesTestGroupRemoteStateOfferer.cpp b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/StatechartProfilesTestGroupRemoteStateOfferer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c81db898dd7187b88f4e355c5969f17c06e429db --- /dev/null +++ b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/StatechartProfilesTestGroupRemoteStateOfferer.cpp @@ -0,0 +1,66 @@ +/* + * 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::StatechartProfilesTestGroup::StatechartProfilesTestGroupRemoteStateOfferer + * @author Valerij Wittenbeck ( valerij dot wittenbeck at student dot kit dot edu ) + * @date 2015 + * @copyright http://www.gnu.org/licenses/gpl.txt + * GNU General Public License + */ + +#include "StatechartProfilesTestGroupRemoteStateOfferer.h" + +using namespace armarx; +using namespace StatechartProfilesTestGroup; + +// DO NOT EDIT NEXT LINE +StatechartProfilesTestGroupRemoteStateOfferer::SubClassRegistry StatechartProfilesTestGroupRemoteStateOfferer::Registry(StatechartProfilesTestGroupRemoteStateOfferer::GetName(), &StatechartProfilesTestGroupRemoteStateOfferer::CreateInstance); + + + +StatechartProfilesTestGroupRemoteStateOfferer::StatechartProfilesTestGroupRemoteStateOfferer(StatechartGroupXmlReaderPtr reader) : + XMLRemoteStateOfferer < StatechartProfilesTestGroupStatechartContext > (reader) +{ +} + +void StatechartProfilesTestGroupRemoteStateOfferer::onInitXMLRemoteStateOfferer() +{ + +} + +void StatechartProfilesTestGroupRemoteStateOfferer::onConnectXMLRemoteStateOfferer() +{ + +} + +void StatechartProfilesTestGroupRemoteStateOfferer::onExitXMLRemoteStateOfferer() +{ + +} + +// DO NOT EDIT NEXT FUNCTION +std::string StatechartProfilesTestGroupRemoteStateOfferer::GetName() +{ + return "StatechartProfilesTestGroupRemoteStateOfferer"; +} + +// DO NOT EDIT NEXT FUNCTION +XMLStateOffererFactoryBasePtr StatechartProfilesTestGroupRemoteStateOfferer::CreateInstance(StatechartGroupXmlReaderPtr reader) +{ + return XMLStateOffererFactoryBasePtr(new StatechartProfilesTestGroupRemoteStateOfferer(reader)); +} + + + diff --git a/source/RobotAPI/statecharts/StatechartProfilesTestGroup/StatechartProfilesTestGroupRemoteStateOfferer.h b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/StatechartProfilesTestGroupRemoteStateOfferer.h new file mode 100644 index 0000000000000000000000000000000000000000..1b93984f8ca05e506ef907c8cbf4478ce1e9d1a5 --- /dev/null +++ b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/StatechartProfilesTestGroupRemoteStateOfferer.h @@ -0,0 +1,54 @@ +/* + * 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::StatechartProfilesTestGroup + * @author Valerij Wittenbeck ( valerij dot wittenbeck at student dot kit dot edu ) + * @date 2015 + * @copyright http://www.gnu.org/licenses/gpl.txt + * GNU General Public License + */ + +#ifndef _ARMARX_XMLUSERCODE_RobotAPI_StatechartProfilesTestGroup_REMOTESTATEOFFERER_H +#define _ARMARX_XMLUSERCODE_RobotAPI_StatechartProfilesTestGroup_REMOTESTATEOFFERER_H + +#include <Core/statechart/xmlstates/XMLRemoteStateOfferer.h> +#include "StatechartProfilesTestGroupStatechartContext.generated.h" + +namespace armarx +{ + namespace StatechartProfilesTestGroup + { + class StatechartProfilesTestGroupRemoteStateOfferer : + virtual public XMLRemoteStateOfferer < StatechartProfilesTestGroupStatechartContext > // Change this statechart context if you need another context (dont forget to change in the constructor as well) + { + public: + StatechartProfilesTestGroupRemoteStateOfferer(StatechartGroupXmlReaderPtr reader); + + // inherited from RemoteStateOfferer + void onInitXMLRemoteStateOfferer(); + void onConnectXMLRemoteStateOfferer(); + void onExitXMLRemoteStateOfferer(); + + // static functions for AbstractFactory Method + static std::string GetName(); + static XMLStateOffererFactoryBasePtr CreateInstance(StatechartGroupXmlReaderPtr reader); + static SubClassRegistry Registry; + + + }; + } +} + +#endif diff --git a/source/RobotAPI/statecharts/StatechartProfilesTestGroup/TestState.cpp b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/TestState.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e98f31d5b09c7f1691907d1d09749e45c4a2ac27 --- /dev/null +++ b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/TestState.cpp @@ -0,0 +1,77 @@ +/* + * 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::StatechartProfilesTestGroup + * @author Valerij Wittenbeck ( valerij dot wittenbeck at student dot kit dot edu ) + * @date 2015 + * @copyright http://www.gnu.org/licenses/gpl.txt + * GNU General Public License + */ + +#include "TestState.h" + +using namespace armarx; +using namespace StatechartProfilesTestGroup; + +// DO NOT EDIT NEXT LINE +TestState::SubClassRegistry TestState::Registry(TestState::GetName(), &TestState::CreateInstance); + + + +TestState::TestState(const XMLStateConstructorParams& stateData) : + XMLStateTemplate<TestState>(stateData), TestStateGeneratedBase<TestState>(stateData) +{ +} + +void TestState::onEnter() +{ + // put your user code for the enter-point here + // execution time should be short (<100ms) +} + +void TestState::run() +{ + // put your user code for the execution-phase here + // runs in seperate thread, thus can do complex operations + // should check constantly whether isRunningTaskStopped() returns true + +// uncomment this if you need a continous run function. Make sure to use sleep or use blocking wait to reduce cpu load. +// while (!isRunningTaskStopped()) // stop run function if returning true +// { +// // do your calculations +// } + +} + +void TestState::onBreak() +{ + // put your user code for the breaking point here + // execution time should be short (<100ms) +} + +void TestState::onExit() +{ + // put your user code for the exit point here + // execution time should be short (<100ms) + +} + + +// DO NOT EDIT NEXT FUNCTION +XMLStateFactoryBasePtr TestState::CreateInstance(XMLStateConstructorParams stateData) +{ + return XMLStateFactoryBasePtr(new TestState(stateData)); +} + diff --git a/source/RobotAPI/statecharts/StatechartProfilesTestGroup/TestState.h b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/TestState.h new file mode 100644 index 0000000000000000000000000000000000000000..6a2e87bdf12270ca84fce63547c0ea6155292d04 --- /dev/null +++ b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/TestState.h @@ -0,0 +1,55 @@ +/* + * 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::StatechartProfilesTestGroup + * @author Valerij Wittenbeck ( valerij dot wittenbeck at student dot kit dot edu ) + * @date 2015 + * @copyright http://www.gnu.org/licenses/gpl.txt + * GNU General Public License + */ + +#ifndef _ARMARX_XMLUSERCODE_RobotAPI_StatechartProfilesTestGroup_TestState_H +#define _ARMARX_XMLUSERCODE_RobotAPI_StatechartProfilesTestGroup_TestState_H + +#include "TestState.generated.h" + +namespace armarx +{ + namespace StatechartProfilesTestGroup + { + class TestState : + public TestStateGeneratedBase<TestState> + { + public: + TestState(const XMLStateConstructorParams& stateData); + + // inherited from StateBase + void onEnter(); + void run(); + void onBreak(); + void onExit(); + + // static functions for AbstractFactory Method + static XMLStateFactoryBasePtr CreateInstance(XMLStateConstructorParams stateData); + static SubClassRegistry Registry; + + // DO NOT INSERT ANY CLASS MEMBERS, + // use stateparameters instead, + // if classmember are neccessary nonetheless, reset them in onEnter + }; + } +} + +#endif diff --git a/source/RobotAPI/statecharts/StatechartProfilesTestGroup/TestState.xml b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/TestState.xml new file mode 100644 index 0000000000000000000000000000000000000000..4822edd8f52deb32393f9f7f0c0298713484e3d1 --- /dev/null +++ b/source/RobotAPI/statecharts/StatechartProfilesTestGroup/TestState.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<State version="1.2" name="TestState" uuid="84AE0A5A-9F6A-4CD7-B185-2173009CB87C" width="800" height="600" type="Normal State"> + <InputParameters> + <Parameter name="EmptyStringTest" type="::armarx::StringVariantData" optional="no"> + <DefaultValue value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::StringVariantData","value":""}}'/> + </Parameter> + <Parameter name="TestParam1" type="::armarx::StringVariantData" optional="no"> + <DefaultValue value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::StringVariantData","value":"OnlyRootSet"}}'/> + </Parameter> + <Parameter name="TestParam2" type="::armarx::StringVariantData" optional="no"> + <DefaultValue profile="Armar3Base" value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::StringVariantData","value":"Armar3BaseSet"}}'/> + <DefaultValue value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::StringVariantData","value":"RootSet"}}'/> + </Parameter> + <Parameter name="TestParam3" type="::armarx::StringVariantData" optional="no"> + <DefaultValue profile="Armar3a" value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::StringVariantData","value":"Armar3aSet"}}'/> + <DefaultValue profile="Armar3b" value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::StringVariantData","value":"Armar3bSet"}}'/> + <DefaultValue value='{"type":"::armarx::SingleVariantBase","variant":{"typeName":"::armarx::StringVariantData","value":"RootSet"}}'/> + </Parameter> + </InputParameters> + <OutputParameters/> + <LocalParameters/> + <Substates/> + <Events/> + <Transitions/> +</State> +