Skip to content
Snippets Groups Projects
Commit 618617ff authored by Nikolaus Vahrenkamp's avatar Nikolaus Vahrenkamp
Browse files

worked on pick and place

parents 7df72338 2f3326fd
No related branches found
No related tags found
No related merge requests found
Showing
with 347 additions and 3 deletions
......@@ -20,3 +20,5 @@ add_subdirectory(PlatformUnitSimulation)
add_subdirectory(PlatformUnitObserver)
add_subdirectory(RobotStateComponent)
add_subdirectory(RobotStateObserver)
add_subdirectory(HandUnitObserver)
\ No newline at end of file
armarx_component_set_name("HandUnitObserverApp")
#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 RobotAPIUnits ArmarXInterfaces ArmarXCore)
set(EXE_SOURCE main.cpp)
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::HandUnitObserver
* @author Mirko Waechter ( mirko dot waechter at kit dot edu )
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#ifndef _ARMARX_APPLICATION_RobotAPI_HandUnitObserver_H
#define _ARMARX_APPLICATION_RobotAPI_HandUnitObserver_H
#include <RobotAPI/units/HandUnitObserver.h>
#include <Core/core/application/Application.h>
namespace armarx
{
/**
* @class HandUnitObserverApp
* @brief A brief description
*
* Detailed Description
*/
class HandUnitObserverApp :
virtual public armarx::Application
{
/**
* @see armarx::Application::setup()
*/
void setup(const ManagedIceObjectRegistryInterfacePtr& registry,
Ice::PropertiesPtr properties)
{
registry->addObject( Component::create<HandUnitObserver>(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::HandUnitObserver
* @author Mirko Waechter ( mirko dot waechter at kit dot edu )
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#include "HandUnitObserverApp.h"
#include <Core/core/logging/Logging.h>
int main(int argc, char* argv[])
{
armarx::ApplicationPtr app = armarx::Application::createInstance < armarx::HandUnitObserverApp > ();
app->setName("HandUnitObserver");
return app->main(argc, argv);
}
......@@ -30,6 +30,8 @@
#include <Core/interface/core/UserException.ice>
#include <Core/interface/core/BasicTypes.ice>
#include <Core/interface/observers/VariantContainers.ice>
#include <Core/interface/observers/ObserverInterface.ice>
module armarx
{
......@@ -56,14 +58,21 @@ module armarx
void setObjectReleased(string objectName);
};
interface HandUnitListener
interface HandUnitListener extends armarx::ObserverInterface
{
<<<<<<< HEAD
void reportHandClosed();
void reportHandOpened();
void reportHandPreshaped();
// informs all listeners that we grasped an object
void reportObjectGrasped(string robotName, string robotNodeName, string objectName);
=======
void reportHandClosed(bool isLeftHand);
void reportHandOpened(bool isLeftHand);
void reportHandPreshaped(bool isLeftHand);
void reportNewHandShapeName(bool isLeftHand, string handShapeName);
>>>>>>> 2f3326fdfecad75fe7a1047e694a6857ba78b6aa
};
};
......
armarx_set_target("Core Library: ArmarXCoreRemoteRobot")
armarx_set_target("Core Library: RobotAPIRemoteRobot")
find_package(Eigen3 QUIET)
if (NOT Simox_FOUND)
find_package(Simox 2.3.0 QUIET)
......@@ -24,6 +24,7 @@ set(LIB_FILES ArmarPose.cpp
RemoteRobot.cpp
RemoteRobotNode.cpp
checks/ConditionCheckMagnitudeChecks.cpp
RobotStateObjectFactories.cpp
)
set(LIB_HEADERS ArmarPose.h
LinkedPose.h
......
......@@ -158,6 +158,8 @@ namespace armarx {
void LinkedVector3::changeFrame(const std::string &newFrame, const Ice::Current &c)
{
ARMARX_WARNING_S << "This function doesn't work!";
if(newFrame == frame)
return;
......
/*
* 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::
* @author Mirko Waechter ( mirko.waechter at kit dot edu)
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#include "RobotStateObjectFactories.h"
using namespace armarx;
using namespace armarx::ObjectFactories;
const FactoryCollectionBaseCleanUp RobotStateObjectFactories::RobotStateObjectFactoriesVar = FactoryCollectionBase::addToPreregistration(new RobotStateObjectFactories());
......@@ -169,8 +169,8 @@ namespace armarx
return map;
}
static const FactoryCollectionBaseCleanUp RobotStateObjectFactoriesVar;
};
const FactoryCollectionBaseCleanUp RobotStateObjectFactoriesVar = FactoryCollectionBase::addToPreregistration(new RobotStateObjectFactories());
}
}
......
......@@ -37,6 +37,7 @@ set(LIB_HEADERS
TCPControlUnitObserver.h
HandUnit.h
HandUnitObserver.h
HardwareUnit.h
KinematicUnit.h
KinematicUnitSimulation.h
......@@ -58,6 +59,7 @@ set(LIB_FILES
TCPControlUnitObserver.cpp
HandUnit.cpp
HandUnitObserver.cpp
HardwareUnit.cpp
KinematicUnit.cpp
KinematicUnitSimulation.cpp
......
#include "HandUnitObserver.h"
#include <Core/observers/checks/ConditionCheckEquals.h>
#include <Core/observers/checks/ConditionCheckUpdated.h>
using namespace armarx;
void HandUnitObserver::onInitObserver()
{
usingTopic("LeftHandState");
usingTopic("RightHandState");
offerChannel("leftHand", "Gives information about the state of the left robot hand.");
offerDataField("leftHand", "isOpen", VariantType::Bool, "Is true when the hand is open, false if not.");
setDataField("leftHand", "isOpen", false);
offerDataField("leftHand", "isClosed", VariantType::Bool, "Is true when the hand is closed, false if not.");
setDataField("leftHand", "isClosed", false);
offerDataField("leftHand", "shapeName", VariantType::String, "Contains the name of the current hand shape.");
setDataField("leftHand", "shapeName", "unknown");
updateChannel("leftHand");
offerChannel("rightHand", "Gives information about the state of the right robot hand.");
offerDataField("rightHand", "isOpen", VariantType::Bool, "Is true when the hand is open, false if not.");
setDataField("rightHand", "isOpen", false);
offerDataField("rightHand", "isClosed", VariantType::Bool, "Is true when the hand is closed, false if not.");
setDataField("rightHand", "isClosed", false);
offerDataField("rightHand", "shapeName", VariantType::String, "Contains the name of the current hand shape.");
setDataField("rightHand", "shapeName", "unknown");
updateChannel("rightHand");
offerConditionCheck("equals", new armarx::ConditionCheckEquals());
offerConditionCheck("updated", new armarx::ConditionCheckUpdated());
}
void HandUnitObserver::onConnectObserver()
{
}
void HandUnitObserver::onExitObserver()
{
}
void HandUnitObserver::reportHandClosed(bool isLeftHand, const Ice::Current&)
{
if (isLeftHand)
{
setDataField("leftHand", "isOpen", false);
setDataField("leftHand", "isClosed", true);
updateChannel("leftHand");
}
else
{
setDataField("rightHand", "isOpen", false);
setDataField("rightHand", "isClosed", true);
updateChannel("rightHand");
}
}
void HandUnitObserver::reportHandOpened(bool isLeftHand, const Ice::Current&)
{
if (isLeftHand)
{
setDataField("leftHand", "isOpen", true);
setDataField("leftHand", "isClosed", false);
updateChannel("leftHand");
}
else
{
setDataField("rightHand", "isOpen", true);
setDataField("rightHand", "isClosed", false);
updateChannel("rightHand");
}
}
void HandUnitObserver::reportHandPreshaped(bool isLeftHand, const Ice::Current&)
{
if (isLeftHand)
{
setDataField("leftHand", "isOpen", false);
setDataField("leftHand", "isClosed", false);
updateChannel("leftHand");
}
else
{
setDataField("rightHand", "isOpen", false);
setDataField("rightHand", "isClosed", false);
updateChannel("rightHand");
}
}
void HandUnitObserver::reportNewHandShapeName(bool isLeftHand, const std::string& handShapeName, const Ice::Current&)
{
if (isLeftHand)
{
setDataField("leftHand", "shapeName", handShapeName);
updateChannel("leftHand");
}
else
{
setDataField("rightHand", "shapeName", handShapeName);
updateChannel("rightHand");
}
}
/*
* 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 David Schiebener <schiebener at kit dot edu>
* @date 2014
* @copyright http://www.gnu.org/licenses/gpl.txt
* GNU General Public License
*/
#ifndef _ARMARX_ROBOTAPI_HAND_UNIT_OBSERVER_H
#define _ARMARX_ROBOTAPI_HAND_UNIT_OBSERVER_H
#include <RobotAPI/interface/units/HandUnitInterface.h>
#include <Core/observers/Observer.h>
namespace armarx
{
class HandUnitObserverPropertyDefinitions:
public ComponentPropertyDefinitions
{
public:
HandUnitObserverPropertyDefinitions(std::string prefix):
ComponentPropertyDefinitions(prefix)
{
//defineRequiredProperty<std::string>("HapticTopicName", "Name of the HapticUnit Topic");
}
};
class HandUnitObserver :
virtual public Observer,
virtual public HandUnitListener
{
public:
HandUnitObserver(){}
//void setTopicName(std::string topicName);
// framework hooks
virtual std::string getDefaultName() const { return "HandUnitObserver"; }
virtual void onInitObserver();
virtual void onConnectObserver();
virtual void onExitObserver();
// observer interface
virtual void reportHandClosed(bool isLeftHand, const ::Ice::Current& = ::Ice::Current());
virtual void reportHandOpened(bool isLeftHand, const ::Ice::Current& = ::Ice::Current());
virtual void reportHandPreshaped(bool isLeftHand, const ::Ice::Current& = ::Ice::Current());
virtual void reportNewHandShapeName(bool isLeftHand, const ::std::string& handShapeName, const ::Ice::Current& = ::Ice::Current());
/**
* @see PropertyUser::createPropertyDefinitions()
*/
//virtual PropertyDefinitionsPtr createPropertyDefinitions();
private:
};
}
#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