Skip to content
Snippets Groups Projects
Commit b0c7e02a authored by Fabian Tërnava's avatar Fabian Tërnava
Browse files

Merge remote-tracking branch 'origin/master' into feature/skillMemoryGUI

# Conflicts:
#	source/RobotAPI/gui-plugins/SkillManagerPlugin/SkillManagerMonitorWidgetController.cpp
parents 9ec3a41b 2a2e1d93
No related branches found
No related tags found
No related merge requests found
Showing
with 587 additions and 155 deletions
......@@ -68,6 +68,15 @@
# ArmarX.ArVizStorage.TopicName = ArVizTopic
# ArmarX.AutodiscoverPackages: If enabled, will discover all ArmarX packages based on the environment variables. Otherwise, the `DefaultPackages` and `AdditionalPackages` properties are used.
# Attributes:
# - Default: true
# - Case sensitivity: yes
# - Required: no
# - Possible values: {0, 1, false, no, true, yes}
# ArmarX.AutodiscoverPackages = true
# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config)
# Attributes:
# - Default: mongo/.cache
......
......@@ -18,6 +18,15 @@
# ArmarX.ApplicationName = ""
# ArmarX.AutodiscoverPackages: If enabled, will discover all ArmarX packages based on the environment variables. Otherwise, the `DefaultPackages` and `AdditionalPackages` properties are used.
# Attributes:
# - Default: true
# - Case sensitivity: yes
# - Required: no
# - Possible values: {0, 1, false, no, true, yes}
# ArmarX.AutodiscoverPackages = true
# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config)
# Attributes:
# - Default: mongo/.cache
......
......@@ -18,6 +18,15 @@
# ArmarX.ApplicationName = ""
# ArmarX.AutodiscoverPackages: If enabled, will discover all ArmarX packages based on the environment variables. Otherwise, the `DefaultPackages` and `AdditionalPackages` properties are used.
# Attributes:
# - Default: true
# - Case sensitivity: yes
# - Required: no
# - Possible values: {0, 1, false, no, true, yes}
# ArmarX.AutodiscoverPackages = true
# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config)
# Attributes:
# - Default: mongo/.cache
......
......@@ -18,6 +18,15 @@
# ArmarX.ApplicationName = ""
# ArmarX.AutodiscoverPackages: If enabled, will discover all ArmarX packages based on the environment variables. Otherwise, the `DefaultPackages` and `AdditionalPackages` properties are used.
# Attributes:
# - Default: true
# - Case sensitivity: yes
# - Required: no
# - Possible values: {0, 1, false, no, true, yes}
# ArmarX.AutodiscoverPackages = true
# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config)
# Attributes:
# - Default: mongo/.cache
......
......@@ -18,6 +18,15 @@
# ArmarX.ApplicationName = ""
# ArmarX.AutodiscoverPackages: If enabled, will discover all ArmarX packages based on the environment variables. Otherwise, the `DefaultPackages` and `AdditionalPackages` properties are used.
# Attributes:
# - Default: true
# - Case sensitivity: yes
# - Required: no
# - Possible values: {0, 1, false, no, true, yes}
# ArmarX.AutodiscoverPackages = true
# ArmarX.CachePath: Path for cache files. If relative path AND env. variable ARMARX_CONFIG_DIR is set, the cache path will be made relative to ARMARX_CONFIG_DIR. Otherwise if relative it will be relative to the default ArmarX config dir (${ARMARX_WORKSPACE}/armarx_config)
# Attributes:
# - Default: mongo/.cache
......
......@@ -27,6 +27,7 @@ add_subdirectory(NaturalIKTest)
add_subdirectory(ObjectPoseClientExample)
add_subdirectory(ObjectPoseProviderExample)
add_subdirectory(RobotHealth)
add_subdirectory(RobotDefinition)
add_subdirectory(RobotNameService)
add_subdirectory(RobotState)
add_subdirectory(RobotToArViz)
......
armarx_component_set_name("RobotDefinition")
set(COMPONENT_LIBS
ArmarXCore
ArmarXCoreInterfaces # for DebugObserverInterface
ArmarXGuiComponentPlugins
RobotAPICore
RobotAPIInterfaces
RobotAPISkills
armem
robot_name_service_core
robot_name_service_client
)
set(SOURCES
RobotDefinition.cpp
)
set(HEADERS
RobotDefinition.h
)
armarx_add_component("${SOURCES}" "${HEADERS}")
#generate the application
armarx_generate_and_add_component_executable(COMPONENT_NAMESPACE "armarx")
/*
* 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::RobotNameService
* @author [Author Name] ( [Author Email] )
* @date 2018
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include "RobotDefinition.h"
namespace armarx
{
void
RobotDefinition::onInitComponent()
{
}
void
RobotDefinition::onConnectComponent()
{
}
void
RobotDefinition::onDisconnectComponent()
{
}
void
RobotDefinition::onExitComponent()
{
}
armarx::PropertyDefinitionsPtr
RobotDefinition::createPropertyDefinitions()
{
armarx::PropertyDefinitionsPtr defs =
new ComponentPropertyDefinitions(getConfigIdentifier());
return defs;
}
} // namespace armarx
/*
* 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::RobotNameService
* @author [Author Name] ( [Author Email] )
* @date 2018
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
#include <map>
#include <mutex>
#include <string>
#include <ArmarXCore/core/Component.h>
#include <RobotAPI/interface/robot_name_service/RobotNameServiceInterface.h>
#include <RobotAPI/libraries/robot_name_service/client/Plugin.h>
#include <RobotAPI/libraries/robot_name_service/core/Robot.h>
namespace armarx
{
/**
* @defgroup Component-RobotNameService RobotNameService
* @ingroup RobotAPI-Components
* A description of the component RobotNameService.
*
* @class RobotNameService
* @ingroup Component-RobotNameService
* @brief Brief description of class RobotNameService.
*
* Detailed description of class RobotNameService.
*/
class RobotDefinition :
virtual public armarx::Component,
virtual public armarx::RobotNameServiceComponentPluginUser
{
public:
/**
* @see armarx::ManagedIceObject::getDefaultName()
*/
std::string
getDefaultName() const override
{
return "RobotDefinition";
}
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;
};
} // namespace armarx
# Libs required for the tests
SET(LIBS ${LIBS} ArmarXCore RobotNameService)
armarx_add_test(RobotNameServiceTest RobotNameServiceTest.cpp "${LIBS}")
\ No newline at end of file
......@@ -13,19 +13,25 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @author Simon Ottenhaus ( simon dot ottenhaus at kit dot edu )
* @package RobotAPI::ArmarXObjects::RobotNameService
* @author [Author Name] ( [Author Email] )
* @date 2018
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#include <RobotAPI/interface/observers/KinematicUnitObserverInterface.ice>
#define BOOST_TEST_MODULE RobotAPI::ArmarXObjects::RobotNameService
#pragma once
#define ARMARX_BOOST_TEST
module armarx
#include <RobotAPI/Test.h>
#include <RobotAPI/components/RobotNameService/RobotNameService.h>
#include <iostream>
BOOST_AUTO_TEST_CASE(testExample)
{
interface RobotNameServiceInterface
{
};
};
armarx::RobotNameService instance;
BOOST_CHECK_EQUAL(true, true);
}
armarx_component_set_name("RobotNameService")
set(COMPONENT_LIBS ArmarXCore)
set(SOURCES RobotNameService.cpp)
set(HEADERS RobotNameService.h)
armarx_add_component("${SOURCES}" "${HEADERS}")
# add unit tests
add_subdirectory(test)
set(COMPONENT_LIBS
ArmarXCore
ArmarXCoreInterfaces # for DebugObserverInterface
ArmarXGuiComponentPlugins
RobotAPICore
RobotAPIInterfaces
RobotAPISkills
armem
robot_name_service_core
robot_name_service_server
)
set(SOURCES
RobotNameService.cpp
)
set(HEADERS
RobotNameService.h
)
armarx_add_component("${SOURCES}" "${HEADERS}")
armarx_generate_and_add_component_executable(APPLICATION_APP_SUFFIX)
#generate the application
armarx_generate_and_add_component_executable(COMPONENT_NAMESPACE "armarx")
......@@ -22,35 +22,76 @@
#include "RobotNameService.h"
namespace armarx
{
void RobotNameService::onInitComponent()
void
RobotNameService::onInitComponent()
{
}
void RobotNameService::onConnectComponent()
void
RobotNameService::onConnectComponent()
{
}
void
RobotNameService::onDisconnectComponent()
{
}
void
RobotNameService::onExitComponent()
{
}
void RobotNameService::onDisconnectComponent()
armarx::PropertyDefinitionsPtr
RobotNameService::createPropertyDefinitions()
{
armarx::PropertyDefinitionsPtr defs =
new ComponentPropertyDefinitions(getConfigIdentifier());
return defs;
}
bool
RobotNameService::registerRobot(const robot_name_service::dto::Robot& robot,
const Ice::Current& current)
{
std::scoped_lock l(robotsMutex);
ARMARX_INFO << "Register a new robot with name '" << robot.name << "' in RNS";
if (auto it = robots.find(robot.name); it != robots.end())
{
ARMARX_ERROR << "The robot with name '" << robot.name
<< "' is already registered. Ignoring it.";
return false;
}
robots[robot.name].fromIce(robot);
return true;
}
void RobotNameService::onExitComponent()
void
RobotNameService::unregisterRobot(const std::string& name, const Ice::Current& current)
{
std::scoped_lock l(robotsMutex);
if (auto it = robots.find(name); it != robots.end())
{
robots.erase(it);
}
}
armarx::PropertyDefinitionsPtr RobotNameService::createPropertyDefinitions()
IceUtil::Optional<robot_name_service::dto::Robot>
RobotNameService::getRobot(const std::string& name, const Ice::Current& current)
{
return armarx::PropertyDefinitionsPtr(new RobotNameServicePropertyDefinitions(
getConfigIdentifier()));
std::scoped_lock l(robotsMutex);
if (auto it = robots.find(name); it == robots.end())
{
return {};
}
return robots[name].toIce();
}
}
} // namespace armarx
......@@ -22,27 +22,17 @@
#pragma once
#include <map>
#include <mutex>
#include <string>
#include <ArmarXCore/core/Component.h>
#include <RobotAPI/interface/robot_name_service/RobotNameServiceInterface.h>
#include <RobotAPI/libraries/robot_name_service/core/Robot.h>
namespace armarx
{
/**
* @class RobotNameServicePropertyDefinitions
* @brief
*/
class RobotNameServicePropertyDefinitions:
public armarx::ComponentPropertyDefinitions
{
public:
RobotNameServicePropertyDefinitions(std::string prefix):
armarx::ComponentPropertyDefinitions(prefix)
{
//defineRequiredProperty<std::string>("PropertyName", "Description");
//defineOptionalProperty<std::string>("PropertyName", "DefaultValue", "Description");
}
};
/**
* @defgroup Component-RobotNameService RobotNameService
* @ingroup RobotAPI-Components
......@@ -55,13 +45,15 @@ namespace armarx
* Detailed description of class RobotNameService.
*/
class RobotNameService :
virtual public armarx::Component
virtual public armarx::Component,
virtual public armarx::robot_name_service::dti::RobotNameServiceInterface
{
public:
/**
* @see armarx::ManagedIceObject::getDefaultName()
*/
std::string getDefaultName() const override
std::string
getDefaultName() const override
{
return "RobotNameService";
}
......@@ -91,6 +83,18 @@ namespace armarx
* @see PropertyUser::createPropertyDefinitions()
*/
armarx::PropertyDefinitionsPtr createPropertyDefinitions() override;
};
}
// RobotNameServiceInterface interface
public:
bool registerRobot(const robot_name_service::dto::Robot& robot,
const Ice::Current& current) override;
void unregisterRobot(const std::string& name, const Ice::Current& current) override;
IceUtil::Optional<robot_name_service::dto::Robot>
getRobot(const std::string& name, const Ice::Current& current) override;
private:
mutable std::mutex robotsMutex;
std::map<std::string, robot_name_service::core::Robot> robots;
};
} // namespace armarx
......@@ -10,12 +10,13 @@ set(SOURCES
aronTreeWidget/visitors/AronTreeWidgetSetter.cpp
aronTreeWidget/visitors/AronTreeWidgetModalCreator.cpp
aronTreeWidget/visitors/AronTreeWidgetContextMenu.cpp
aronTreeWidget/Data.cpp
aronTreeWidget/widgets/CustomWidget.cpp
aronTreeWidget/widgets/EditMatrixWidget.cpp
aronTreeWidget/widgets/IntEnumWidget.cpp
aronTreeWidget/ListDictHelper.cpp
aronTreeWidget/widgets/QuaternionWidget.cpp
aronTreeWidget/widgets/SkillDescriptionWidget.cpp
aronTreeWidget/Data.cpp
aronTreeWidget/ListDictHelper.cpp
aronTreeWidget/AronTreeWidgetItem.cpp
aronTreeWidget/AronTreeWidgetController.cpp
aronTreeWidget/modal/text/AronTreeWidgetTextInputModalController.cpp
......@@ -34,13 +35,14 @@ set(HEADERS
aronTreeWidget/visitors/AronTreeWidgetSetter.h
aronTreeWidget/visitors/AronTreeWidgetModalCreator.h
aronTreeWidget/visitors/AronTreeWidgetContextMenu.h
aronTreeWidget/Data.h
aronTreeWidget/widgets/NDArrayHelper.h
aronTreeWidget/widgets/EditMatrixWidget.h
aronTreeWidget/widgets/CustomWidget.h
aronTreeWidget/widgets/IntEnumWidget.h
aronTreeWidget/ListDictHelper.h
aronTreeWidget/widgets/QuaternionWidget.h
aronTreeWidget/widgets/SkillDescriptionWidget.h
aronTreeWidget/Data.h
aronTreeWidget/ListDictHelper.h
aronTreeWidget/AronTreeWidgetItem.h
aronTreeWidget/AronTreeWidgetController.h
aronTreeWidget/modal/AronTreeWidgetModal.h
......
......@@ -20,6 +20,9 @@
<string>SkillManagerMonitorWidget</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBoxUpdateFreq"/>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="checkBoxAutoUpdate">
<property name="text">
......@@ -27,16 +30,6 @@
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonRefreshNow">
<property name="text">
<string>Refresh Now</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBoxUpdateFreq"/>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label">
<property name="text">
......@@ -47,6 +40,13 @@
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonRefreshNow">
<property name="text">
<string>Refresh Now</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="4">
<widget class="QSplitter" name="splitter_2">
<property name="enabled">
......@@ -176,72 +176,137 @@
<property name="title">
<string>Skill Details</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="8" column="3">
<widget class="QPushButton" name="pushButtonExecuteSkill">
<property name="text">
<string>Request Execution</string>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QSplitter" name="splitter_2">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButtonPaste">
<property name="text">
<string>Set args from clipboard</string>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButtonReset">
<property name="text">
<string>Reset args to profile</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="QTreeWidget" name="treeWidgetSkillDetails">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<column>
<property name="text">
<string>Key</string>
<widget class="QWidget" name="groupBoxSkillDetailsTop" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
</column>
<column>
<property name="text">
<string>Value</string>
<property name="topMargin">
<number>0</number>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
<property name="rightMargin">
<number>0</number>
</property>
</column>
<column>
<property name="text">
<string>defaultValue (hidden in GUI)</string>
<property name="bottomMargin">
<number>0</number>
</property>
</column>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButtonCopy">
<property name="text">
<string>Copy args to clipboard</string>
</property>
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QPushButton" name="pushButtonPaste">
<property name="text">
<string>Set args from clipboard</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButtonReset">
<property name="text">
<string>Reset args to profile</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="QComboBox" name="comboBoxProfiles">
<item>
<property name="text">
<string>&lt;No Profile selected. Using root&gt;</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButtonCopy">
<property name="text">
<string>Copy args to clipboard</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="skillDescription" native="true"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="comboBoxProfiles">
<item>
<property name="text">
<string>&lt;No Profile selected. Using root&gt;</string>
</property>
</item>
<widget class="QWidget" name="groupBoxSkillDetailsBottom" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTreeWidget" name="treeWidgetSkillDetails">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed</set>
</property>
<column>
<property name="text">
<string>Key</string>
</property>
</column>
<column>
<property name="text">
<string>Value</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>defaultValue (hidden in GUI)</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonExecuteSkill">
<property name="text">
<string>Request Execution</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
......
......@@ -25,8 +25,6 @@
#include <regex>
#include <string>
#include <boost/algorithm/string.hpp>
#include <RobotAPI/libraries/skills/core/Skill.h>
#include "aronTreeWidget/visitors/AronTreeWidgetConverter.h"
......@@ -34,19 +32,24 @@
#include "aronTreeWidget/visitors/AronTreeWidgetModalCreator.h"
// modals
#include "aronTreeWidget/modal/text/AronTreeWidgetTextInputModalController.h"
// debug
#include <QAction>
#include <QClipboard>
#include <QDoubleSpinBox>
#include <QMenu>
#include <QGridLayout>
#include <QTextBrowser>
#include <RobotAPI/libraries/aron/converter/json/NLohmannJSONConverter.h>
#include <RobotAPI/libraries/skills/core/Skill.h>
#include <RobotAPI/libraries/skills/core/SkillExecutionRequest.h>
#include "aronTreeWidget/Data.h"
#include "aronTreeWidget/modal/text/AronTreeWidgetTextInputModalController.h"
#include "aronTreeWidget/visitors/AronTreeWidgetConverter.h"
#include "aronTreeWidget/visitors/AronTreeWidgetCreator.h"
#include "aronTreeWidget/visitors/AronTreeWidgetModalCreator.h"
#include "aronTreeWidget/widgets/SkillDescriptionWidget.h"
//configSk
namespace armarx
......@@ -85,38 +88,6 @@ namespace armarx
// Others
namespace armarx
{
void
SkillManagerMonitorWidgetController::prepareAndRunMenu(const QPoint& pos)
{
QMenu* menu = new QMenu();
// Stop skill
QAction* stopSkillAction = new QAction("Stop Skill", this);
skills::SkillStatus currentStatus =
skillStatusUpdates.at(selectedSkill.skillExecutionId).status;
stopSkillAction->setDisabled(currentStatus == skills::SkillStatus::Aborted ||
currentStatus == skills::SkillStatus::Failed ||
currentStatus == skills::SkillStatus::Succeeded);
QAction* rerunSkillAction = new QAction("Re-run with similar params", this);
menu->addAction(stopSkillAction);
menu->addAction(rerunSkillAction);
connect(stopSkillAction,
&QAction::triggered,
this,
&SkillManagerMonitorWidgetController::stopSkill);
connect(rerunSkillAction,
&QAction::triggered,
this,
&SkillManagerMonitorWidgetController::rerunSkillWithSimilarParams);
// Temporarily disable rerun-skill-Action
rerunSkillAction->setDisabled(true);
// open menu
menu->popup(widget.treeWidgetSkillExecutions->viewport()->mapToGlobal(pos));
}
SkillExecutionInfoTreeWidgetItem*
SkillExecutionInfoTreeWidgetItem::SearchRecursiveForMatch(
SkillExecutionInfoTreeWidgetItem* haystack,
......@@ -149,7 +120,12 @@ namespace armarx
widget.doubleSpinBoxUpdateFreq->setMaximum(20);
widget.doubleSpinBoxUpdateFreq->setSingleStep(0.5);
widget.doubleSpinBoxUpdateFreq->setSuffix(" Hz");
this->currentSkillSearch = QString("");
skillDescriptionWidget = new SkillDescriptionWidget();
widget.skillDescription->parentWidget()->layout()->replaceWidget(widget.skillDescription,
skillDescriptionWidget);
widget.skillDescription = skillDescriptionWidget;
refreshSkillsResultTimer = new QTimer(this);
updateTimerFrequency();
......
......@@ -46,6 +46,8 @@
namespace armarx
{
class SkillDescriptionWidget;
class SkillInfoTreeWidgetItem : public QTreeWidgetItem
{
public:
......@@ -185,6 +187,7 @@ namespace armarx
// others
QTimer* refreshSkillsResultTimer;
SkillDescriptionWidget* skillDescriptionWidget = nullptr;
// connected flag
std::atomic_bool connected = false;
......
#include "SkillDescriptionWidget.h"
#include <sstream>
#include <QGridLayout>
#include <QLabel>
#include <QTextEdit>
#include <ArmarXGui/libraries/ArmarXGuiBase/widgets/cpp-markdown/markdown.h> // ToDo: Move cpp-markdown to own Axii module.
namespace armarx
{
static std::string
markdownToHtml(const std::string& markdownText, size_t spacesPerTab = 2)
{
::markdown::Document document(spacesPerTab);
document.read(markdownText);
std::stringstream html;
document.write(html);
return html.str();
}
SkillDescriptionWidget::SkillDescriptionWidget(QWidget* parent) : QWidget{parent}
{
QGridLayout* layout = new QGridLayout;
setLayout(layout);
layout->setMargin(0);
int row = 0;
int col = 0;
layout->addWidget(new QLabel("Name:"), row, col++);
name = new QLabel;
layout->addWidget(name, row, col++);
// Add some padding.
layout->addWidget(new QLabel(), row, col++);
{
QLabel* label = new QLabel("Timeout:");
label->setAlignment(Qt::AlignmentFlag::AlignRight);
layout->addWidget(label, row, col++);
}
timeout = new QLabel;
timeout->setAlignment(Qt::AlignmentFlag::AlignRight);
layout->addWidget(timeout, row, col++);
++row;
int numCols = col;
col = 0;
description = new QTextEdit;
description->setReadOnly(true);
layout->addWidget(description, row, col, 1, numCols);
++row;
}
void
SkillDescriptionWidget::setSkillDescription(const skills::SkillDescription& desc)
{
name->setText(QString::fromStdString(desc.skillId.skillName));
description->setHtml(QString::fromStdString(markdownToHtml(desc.description)));
std::stringstream timeoutStr;
timeoutStr << desc.timeout;
timeout->setText(QString::fromStdString(timeoutStr.str()));
}
} // namespace armarx
#pragma once
#include <QWidget>
#include <RobotAPI/libraries/skills/core/SkillDescription.h>
class QLabel;
class QTextEdit;
namespace armarx
{
class SkillDescriptionWidget : public QWidget
{
public:
SkillDescriptionWidget(QWidget* parent = nullptr);
void setSkillDescription(const skills::SkillDescription& desc);
private:
QLabel* name = nullptr;
QTextEdit* description = nullptr;
QLabel* timeout = nullptr;
};
} // namespace armarx
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