Skip to content
Snippets Groups Projects
Commit 3018bc30 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Add component DebugDrawerToArViz

parent 692b6568
No related branches found
No related tags found
1 merge request!69Add DebugDrawerToArViz
Showing
with 462 additions and 1 deletion
...@@ -52,4 +52,4 @@ add_subdirectory(MultiHandUnit) ...@@ -52,4 +52,4 @@ add_subdirectory(MultiHandUnit)
add_subdirectory(StatechartExecutorExample) add_subdirectory(StatechartExecutorExample)
add_subdirectory(NaturalIKTest) add_subdirectory(NaturalIKTest)
\ No newline at end of file
...@@ -3,6 +3,7 @@ add_subdirectory(units) ...@@ -3,6 +3,7 @@ add_subdirectory(units)
add_subdirectory(ArViz) add_subdirectory(ArViz)
add_subdirectory(CyberGloveObserver) add_subdirectory(CyberGloveObserver)
add_subdirectory(DebugDrawer) add_subdirectory(DebugDrawer)
add_subdirectory(DebugDrawerToArViz)
add_subdirectory(DummyTextToSpeech) add_subdirectory(DummyTextToSpeech)
add_subdirectory(EarlyVisionGraph) add_subdirectory(EarlyVisionGraph)
add_subdirectory(FrameTracking) add_subdirectory(FrameTracking)
......
armarx_component_set_name("DebugDrawerToArViz")
set(COMPONENT_LIBS
ArmarXCore
${PROJECT_NAME}Interfaces
RobotAPIComponentPlugins
)
set(SOURCES
DebugDrawerToArViz.cpp
DebugDrawerToArVizComponent.cpp
)
set(HEADERS
DebugDrawerToArViz.h
DebugDrawerToArVizComponent.h
)
armarx_add_component("${SOURCES}" "${HEADERS}")
#find_package(MyLib QUIET)
#armarx_build_if(MyLib_FOUND "MyLib not available")
# all target_include_directories must be guarded by if(Xyz_FOUND)
# for multiple libraries write: if(X_FOUND AND Y_FOUND)....
#if(MyLib_FOUND)
# target_include_directories(DebugDrawerToArViz PUBLIC ${MyLib_INCLUDE_DIRS})
#endif()
# add unit tests
add_subdirectory(test)
armarx_component_set_name("DebugDrawerToArVizApp")
set(COMPONENT_LIBS DebugDrawerToArViz)
armarx_add_component_executable(main.cpp)
/*
* 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::ArmarXObjects::DebugDrawerToArViz
* @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
* @date 2020
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "DebugDrawerToArViz.h"
namespace armarx
{
void DebugDrawerToArViz::setArViz(viz::Client arviz)
{
this->arviz = arviz;
}
}
/*
* 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::ArmarXObjects::DebugDrawerToArViz
* @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
* @date 2020
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
#include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
#include <RobotAPI/components/ArViz/Client/Client.h>
namespace armarx
{
/**
* @brief Passes updates to DebugDrawerInterface to ArViz.
*/
class DebugDrawerToArViz :
virtual public armarx::DebugDrawerInterface
{
public:
void setArViz(viz::Client arviz)
{
this->arviz = arviz;
}
// DebugDrawerInterface interface
public:
void exportScene(const std::string& filename, const Ice::Current& = Ice::emptyCurrent) override;
void exportLayer(const std::string& filename, const std::string& layerName, const Ice::Current& = Ice::emptyCurrent) override;
void setPoseVisu(const std::string& layer, const std::string& name, const PoseBasePtr& globalPose, const Ice::Current& = Ice::emptyCurrent) override;
void setScaledPoseVisu(const std::string& layer, const std::string& name, const PoseBasePtr& globalPose, Ice::Float scale, const Ice::Current& = Ice::emptyCurrent) override;
void setLineVisu(const std::string& layer, const std::string& name, const Vector3BasePtr& globalPosition1, const Vector3BasePtr& globalPosition2, Ice::Float lineWidth, const DrawColor& color, const Ice::Current& = Ice::emptyCurrent) override;
void setLineSetVisu(const std::string& layer, const std::string& name, const DebugDrawerLineSet& lineSet, const Ice::Current& = Ice::emptyCurrent) override;
void setBoxVisu(const std::string& layer, const std::string& name, const PoseBasePtr& globalPose, const Vector3BasePtr& dimensions, const DrawColor& color, const Ice::Current& = Ice::emptyCurrent) override;
void setTextVisu(const std::string& layer, const std::string& name, const std::string& text, const Vector3BasePtr& globalPosition, const DrawColor& color, Ice::Int size, const Ice::Current& = Ice::emptyCurrent) override;
void setSphereVisu(const std::string& layer, const std::string& name, const Vector3BasePtr& globalPosition, const DrawColor& color, Ice::Float radius, const Ice::Current& = Ice::emptyCurrent) override;
void setPointCloudVisu(const std::string& layer, const std::string& name, const DebugDrawerPointCloud& pointCloud, const Ice::Current& = Ice::emptyCurrent) override;
void setColoredPointCloudVisu(const std::string& layer, const std::string& name, const DebugDrawerColoredPointCloud& pointCloud, const Ice::Current& = Ice::emptyCurrent) override;
void set24BitColoredPointCloudVisu(const std::string& layer, const std::string& name, const DebugDrawer24BitColoredPointCloud& pointCloud, const Ice::Current& = Ice::emptyCurrent) override;
void setPolygonVisu(const std::string& layer, const std::string& name, const PolygonPointList& polygonPoints, const DrawColor& colorInner, const DrawColor& colorBorder, Ice::Float lineWidth, const Ice::Current& = Ice::emptyCurrent) override;
void setTriMeshVisu(const std::string& layer, const std::string& name, const DebugDrawerTriMesh& triMesh, const Ice::Current& = Ice::emptyCurrent) override;
void setArrowVisu(const std::string& layer, const std::string& name, const Vector3BasePtr& position, const Vector3BasePtr& direction, const DrawColor& color, Ice::Float length, Ice::Float width, const Ice::Current& = Ice::emptyCurrent) override;
void setCylinderVisu(const std::string& layer, const std::string& name, const Vector3BasePtr& globalPosition, const Vector3BasePtr& direction, Ice::Float length, Ice::Float radius, const DrawColor& color, const Ice::Current& = Ice::emptyCurrent) override;
void setCircleArrowVisu(const std::string& layer, const std::string& name, const Vector3BasePtr& globalPosition, const Vector3BasePtr& directionVec, Ice::Float radius, Ice::Float circleCompletion, Ice::Float width, const DrawColor& color, const Ice::Current& = Ice::emptyCurrent) override;
void setRobotVisu(const std::string& layer, const std::string& name, const std::string&, const std::string&, DrawStyle, const Ice::Current& = Ice::emptyCurrent) override;
void updateRobotPose(const std::string& layer, const std::string& name, const PoseBasePtr&, const Ice::Current& = Ice::emptyCurrent) override;
void updateRobotConfig(const std::string& layer, const std::string& name, const NameValueMap&, const Ice::Current& = Ice::emptyCurrent) override;
void updateRobotColor(const std::string& layer, const std::string& name, const DrawColor& color, const Ice::Current& = Ice::emptyCurrent) override;
void updateRobotNodeColor(const std::string& layer, const std::string& name, const std::string&, const DrawColor& color, const Ice::Current& = Ice::emptyCurrent) override;
void removeRobotVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void setPoseDebugLayerVisu(const std::string& name, const PoseBasePtr& globalPose, const Ice::Current& = Ice::emptyCurrent) override;
void setScaledPoseDebugLayerVisu(const std::string& name, const PoseBasePtr& globalPose, Ice::Float scale, const Ice::Current& = Ice::emptyCurrent) override;
void setLineDebugLayerVisu(const std::string& name, const Vector3BasePtr& globalPosition1, const Vector3BasePtr& globalPosition2, Ice::Float lineWidth, const DrawColor& color, const Ice::Current& = Ice::emptyCurrent) override;
void setLineSetDebugLayerVisu(const std::string& name, const DebugDrawerLineSet& lineSet, const Ice::Current& = Ice::emptyCurrent) override;
void setBoxDebugLayerVisu(const std::string& name, const PoseBasePtr& globalPose, const Vector3BasePtr& dimensions, const DrawColor& color, const Ice::Current& = Ice::emptyCurrent) override;
void setTextDebugLayerVisu(const std::string& name, const std::string& text, const Vector3BasePtr& globalPosition, const DrawColor& color, Ice::Int size, const Ice::Current& = Ice::emptyCurrent) override;
void setSphereDebugLayerVisu(const std::string& name, const Vector3BasePtr& globalPosition, const DrawColor& color, Ice::Float radius, const Ice::Current& = Ice::emptyCurrent) override;
void setPointCloudDebugLayerVisu(const std::string& name, const DebugDrawerPointCloud& pointCloud, const Ice::Current& = Ice::emptyCurrent) override;
void set24BitColoredPointCloudDebugLayerVisu(const std::string& name, const DebugDrawer24BitColoredPointCloud& pointCloud, const Ice::Current& = Ice::emptyCurrent) override;
void setPolygonDebugLayerVisu(const std::string& name, const PolygonPointList& polygonPoints, const DrawColor& colorInner, const DrawColor& colorBorder, Ice::Float lineWidth, const Ice::Current& = Ice::emptyCurrent) override;
void setTriMeshDebugLayerVisu(const std::string& name, const DebugDrawerTriMesh& triMesh, const Ice::Current& = Ice::emptyCurrent) override;
void setArrowDebugLayerVisu(const std::string& name, const Vector3BasePtr& position, const Vector3BasePtr& direction, const DrawColor& color, Ice::Float length, Ice::Float width, const Ice::Current& = Ice::emptyCurrent) override;
void setCylinderDebugLayerVisu(const std::string& name, const Vector3BasePtr& globalPosition, const Vector3BasePtr& direction, Ice::Float length, Ice::Float radius, const DrawColor& color, const Ice::Current& = Ice::emptyCurrent) override;
void setCircleDebugLayerVisu(const std::string& name, const Vector3BasePtr& globalPosition, const Vector3BasePtr& directionVec, Ice::Float radius, Ice::Float circleCompletion, Ice::Float width, const DrawColor& color, const Ice::Current& = Ice::emptyCurrent) override;
void removePoseVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeLineVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeLineSetVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeBoxVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeTextVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeSphereVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removePointCloudVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeColoredPointCloudVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void remove24BitColoredPointCloudVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removePolygonVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeTriMeshVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeArrowVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeCylinderVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeCircleVisu(const std::string& layer, const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removePoseDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeLineDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeLineSetDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeBoxDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeTextDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeSphereDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removePointCloudDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeColoredPointCloudDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void remove24BitColoredPointCloudDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removePolygonDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeTriMeshDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeArrowDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeCylinderDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void removeCircleDebugLayerVisu(const std::string& name, const Ice::Current& = Ice::emptyCurrent) override;
void clearAll(const Ice::Current& = Ice::emptyCurrent) override;
void clearLayer(const std::string& layer, const Ice::Current& = Ice::emptyCurrent) override;
void clearDebugLayer(const Ice::Current& = Ice::emptyCurrent) override;
void enableLayerVisu(const std::string& layer, bool visible, const Ice::Current& = Ice::emptyCurrent) override;
void enableDebugLayerVisu(bool visible, const Ice::Current& = Ice::emptyCurrent) override;
Ice::StringSeq layerNames(const Ice::Current& = Ice::emptyCurrent) override;
LayerInformationSequence layerInformation(const Ice::Current& = Ice::emptyCurrent) override;
bool hasLayer(const std::string&, const Ice::Current& = Ice::emptyCurrent) override;
void removeLayer(const std::string&, const Ice::Current& = Ice::emptyCurrent) override;
void disableAllLayers(const Ice::Current& = Ice::emptyCurrent) override;
void enableAllLayers(const Ice::Current& = Ice::emptyCurrent) override;
void enableSelections(const std::string&, const Ice::Current& = Ice::emptyCurrent) override;
void disableSelections(const std::string&, const Ice::Current& = Ice::emptyCurrent) override;
void clearSelections(const std::string&, const Ice::Current& = Ice::emptyCurrent) override;
void select(const std::string& layer, const std::string& elementName, const Ice::Current& = Ice::emptyCurrent) override;
void deselect(const std::string& layer, const std::string& elementName, const Ice::Current& = Ice::emptyCurrent) override;
DebugDrawerSelectionList getSelections(const Ice::Current& = Ice::emptyCurrent) override;
private:
viz::Client arviz;
};
}
/*
* 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::ArmarXObjects::DebugDrawerToArViz
* @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
* @date 2020
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "DebugDrawerToArVizComponent.h"
namespace armarx
{
DebugDrawerToArVizPropertyDefinitions::DebugDrawerToArVizPropertyDefinitions(std::string prefix) :
armarx::ComponentPropertyDefinitions(prefix)
{
defineOptionalProperty<std::string>("DebugDrawerTopicName", "DebugDrawerUpdates",
"Name of the topic the DebugDrawer listens to.");
}
std::string DebugDrawerToArVizComponent::getDefaultName() const
{
return "DebugDrawerToArViz";
}
void DebugDrawerToArVizComponent::onInitComponent()
{
usingTopicFromProperty("DebugDrawerTopicName");
}
void DebugDrawerToArVizComponent::onConnectComponent()
{
DebugDrawerToArViz::setArViz(ArVizComponentPluginUser::arviz);
}
void DebugDrawerToArVizComponent::onDisconnectComponent()
{
}
void DebugDrawerToArVizComponent::onExitComponent()
{
}
armarx::PropertyDefinitionsPtr DebugDrawerToArVizComponent::createPropertyDefinitions()
{
return armarx::PropertyDefinitionsPtr(new DebugDrawerToArVizPropertyDefinitions(
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 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::ArmarXObjects::DebugDrawerToArViz
* @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
* @date 2020
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
#include <ArmarXCore/core/Component.h>
#include <RobotAPI/interface/visualization/DebugDrawerInterface.h>
#include <RobotAPI/libraries/RobotAPIComponentPlugins/ArVizComponentPlugin.h>
#include "DebugDrawerToArViz.h"
namespace armarx
{
/**
* @class DebugDrawerToArVizPropertyDefinitions
* @brief Property definitions of `DebugDrawerToArViz`.
*/
class DebugDrawerToArVizPropertyDefinitions :
public armarx::ComponentPropertyDefinitions
{
public:
DebugDrawerToArVizPropertyDefinitions(std::string prefix);
};
/**
* @defgroup Component-DebugDrawerToArViz DebugDrawerToArViz
* @ingroup RobotAPI-Components
* A description of the component DebugDrawerToArViz.
*
* @class DebugDrawerToArViz
* @ingroup Component-DebugDrawerToArViz
* @brief Brief description of class DebugDrawerToArViz.
*
* Detailed description of class DebugDrawerToArViz.
*/
class DebugDrawerToArVizComponent :
virtual public armarx::Component,
virtual public armarx::ArVizComponentPluginUser,
virtual public armarx::DebugDrawerToArViz // Implements armarx::DebugDrawerInterface
{
public:
/// @see armarx::ManagedIceObject::getDefaultName()
std::string getDefaultName() const override;
protected:
/// @see armarx::ManagedIceObject::onInitComponent()
void onInitComponent() override;
/// @see armarx::ManagedIceObject::onConnectComponent()
void onConnectComponent() override;
/// @see armarx::ManagedIceObject::onDisconnectComponent()
void onDisconnectComponent() override;
/// @see armarx::ManagedIceObject::onExitComponent()
void onExitComponent() override;
/// @see PropertyUser::createPropertyDefinitions()
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override;
};
}
/*
* 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::application::DebugDrawerToArViz
* @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
* @date 2020
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include <RobotAPI/components/DebugDrawerToArViz/DebugDrawerToArVizComponent.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::DebugDrawerToArVizComponent > (argc, argv, "DebugDrawerToArViz");
}
# Libs required for the tests
SET(LIBS ${LIBS} ArmarXCore DebugDrawerToArViz)
armarx_add_test(DebugDrawerToArVizTest DebugDrawerToArVizTest.cpp "${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 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::ArmarXObjects::DebugDrawerToArViz
* @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
* @date 2020
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#define BOOST_TEST_MODULE RobotAPI::ArmarXObjects::DebugDrawerToArViz
#define ARMARX_BOOST_TEST
#include <RobotAPI/Test.h>
#include <RobotAPI/components/DebugDrawerToArViz/DebugDrawerToArVizComponent.h>
#include <iostream>
BOOST_AUTO_TEST_CASE(testExample)
{
armarx::DebugDrawerToArVizComponent instance;
BOOST_CHECK_EQUAL(true, true);
}
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