Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • sw/armarx/robot-api
  • uwkce_singer/robot-api
  • untcg_hofmann/robot-api
  • ulqba_korosakov/RobotAPI
4 results
Show changes
Commits on Source (15)
Showing
with 106 additions and 38 deletions
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<scenario name="memory_to_debug_observer" creation="1970-01-01.01:00:00" globalConfigName="./config/global.cfg" package="RobotAPI" deploymentType="local" nodeName="NodeMain"> <scenario name="memory_to_debug_observer" creation="1970-01-01.01:00:00" globalConfigName="./config/global.cfg" package="RobotAPI" nodeName="NodeMain">
<application name="MemoryToDebugObserver" instance="" package="RobotAPI" nodeName="" enabled="true" iceAutoRestart="false"/> <application name="MemoryToDebugObserver" instance="" package="RobotAPI" nodeName="" enabled="true"/>
</scenario> </scenario>
...@@ -84,6 +84,10 @@ namespace armarx ...@@ -84,6 +84,10 @@ namespace armarx
"HistoryPath", "HistoryPath",
"Destination path where the history is serialized to"); "Destination path where the history is serialized to");
defs->optional(properties_.componentWarnFrequency, "ComponentWarnFrequency",
"Define a frequency in Hz above which the compnent raises a warning. As you should not send data at a too high rate.");
return defs; return defs;
} }
...@@ -165,9 +169,10 @@ namespace armarx ...@@ -165,9 +169,10 @@ namespace armarx
if (history.size() > properties_.componentWarnFrequency) if (history.size() > properties_.componentWarnFrequency)
{ {
ARMARX_WARNING << "Component `" << componentName << "`" ARMARX_WARNING << deactivateSpam(10) << "Component `" << componentName << "`"
<< "sends data at a too high rate (" << "sends data at a too high rate ("
<< history.size() / maxHistoryDur.toSecondsDouble() << ")"; << history.size() / maxHistoryDur.toSecondsDouble() << ")"
<< deactivateSpam(10, componentName);
} }
} }
......
...@@ -109,7 +109,7 @@ namespace armarx ...@@ -109,7 +109,7 @@ namespace armarx
int maxHistorySize = 1000; int maxHistorySize = 1000;
std::filesystem::path historyPath = "RobotAPI/ArVizStorage"; std::filesystem::path historyPath = "RobotAPI/ArVizStorage";
float componentWarnFrequency = 25; float componentWarnFrequency = 30;
} properties_; } properties_;
......
...@@ -60,6 +60,7 @@ namespace armarx ...@@ -60,6 +60,7 @@ namespace armarx
statechartListenerProviderSegment.defineProperties(defs, prefix + "statechartlistener."); statechartListenerProviderSegment.defineProperties(defs, prefix + "statechartlistener.");
executableSkillCoreSegment.defineProperties(defs, prefix + "executableskill."); executableSkillCoreSegment.defineProperties(defs, prefix + "executableskill.");
skillExecutionRequestCoreSegment.defineProperties(defs, prefix + "executionrequest."); skillExecutionRequestCoreSegment.defineProperties(defs, prefix + "executionrequest.");
skillEventCoreSegment.defineProperties(defs, prefix + "event.");
setMemoryName(MemoryName); setMemoryName(MemoryName);
return defs; return defs;
......
...@@ -30,6 +30,7 @@ namespace armarx::ControlModes ...@@ -30,6 +30,7 @@ namespace armarx::ControlModes
static const std::string Position1DoF = "ControlMode_Position1DoF"; static const std::string Position1DoF = "ControlMode_Position1DoF";
static const std::string Torque1DoF = "ControlMode_Torque1DoF"; static const std::string Torque1DoF = "ControlMode_Torque1DoF";
static const std::string ZeroTorque1DoF = "ControlMode_ZeroTorque1DoF"; static const std::string ZeroTorque1DoF = "ControlMode_ZeroTorque1DoF";
static const std::string ZeroVelocity1DoF = "ControlMode_ZeroVelocity1DoF";
static const std::string Velocity1DoF = "ControlMode_Velocity1DoF"; static const std::string Velocity1DoF = "ControlMode_Velocity1DoF";
static const std::string Current1DoF = "ControlMode_Current1DoF"; static const std::string Current1DoF = "ControlMode_Current1DoF";
static const std::string PWM1DoF = "ControlMode_PWM1DoF"; static const std::string PWM1DoF = "ControlMode_PWM1DoF";
......
...@@ -91,6 +91,11 @@ namespace armarx ...@@ -91,6 +91,11 @@ namespace armarx
ControlTarget1DoFActuatorZeroTorque, ControlTarget1DoFActuatorZeroTorque,
torque, torque,
ControlModes::ZeroTorque1DoF); ControlModes::ZeroTorque1DoF);
make_ControlTarget1DoFActuator(float,
ControllerConstants::ValueNotSetNaN,
ControlTarget1DoFActuatorZeroVelocity,
velocity,
ControlModes::ZeroVelocity1DoF);
make_ControlTarget1DoFActuator(float, make_ControlTarget1DoFActuator(float,
ControllerConstants::ValueNotSetNaN, ControllerConstants::ValueNotSetNaN,
ControlTarget1DoFActuatorCurrent, ControlTarget1DoFActuatorCurrent,
......
...@@ -45,6 +45,8 @@ namespace armarx ...@@ -45,6 +45,8 @@ namespace armarx
/// @return Whether the device has the given tag /// @return Whether the device has the given tag
bool hasTag(const std::string& tag) const; bool hasTag(const std::string& tag) const;
virtual bool hasError(){return false;}
protected: protected:
/// @brief adds the given tag to the Device /// @brief adds the given tag to the Device
void addDeviceTag(const std::string& tag); void addDeviceTag(const std::string& tag);
......
...@@ -81,7 +81,9 @@ namespace armarx ...@@ -81,7 +81,9 @@ namespace armarx
Eigen::Vector3f result; Eigen::Vector3f result;
if (activationTime > rtGetControlStruct().commandTimestamp) if (activationTime > rtGetControlStruct().commandTimestamp)
{ {
result = ramp.update(activationVelocity, timeSinceLastIteration.toSecondsDouble()); // No valid command has been specified. Sane default: come to rest.
const Eigen::Vector3f targetVelocity = Eigen::Vector3f::Zero();
result = ramp.update(targetVelocity, timeSinceLastIteration.toSecondsDouble());
} }
else else
{ {
......
...@@ -141,8 +141,6 @@ namespace armarx ...@@ -141,8 +141,6 @@ namespace armarx
GraspTrajectoryPtr GraspTrajectoryPtr
GraspTrajectory::ReadFromFile(const std::string& filename) GraspTrajectory::ReadFromFile(const std::string& filename)
{ {
ARMARX_IMPORTANT << filename;
ARMARX_TRACE; ARMARX_TRACE;
const auto ext = std::filesystem::path(filename).extension(); const auto ext = std::filesystem::path(filename).extension();
if (ext == ".xml") if (ext == ".xml")
......
...@@ -47,7 +47,7 @@ namespace armarx::armem::client::plugins ...@@ -47,7 +47,7 @@ namespace armarx::armem::client::plugins
ReaderWriterPlugin(ManagedIceObject& parent, const std::string& pre) : ReaderWriterPlugin(ManagedIceObject& parent, const std::string& pre) :
ComponentPlugin(parent, pre) ComponentPlugin(parent, pre)
{ {
if (not armemPlugin) if (armemPlugin == nullptr)
{ {
addPlugin(armemPlugin); addPlugin(armemPlugin);
} }
......
...@@ -133,13 +133,17 @@ namespace armarx::armem::server::plugins ...@@ -133,13 +133,17 @@ namespace armarx::armem::server::plugins
statistics_saved = true; statistics_saved = true;
*/ */
try{ try
if(longtermMemory.isRecording()){ {
if (longtermMemory.isRecording())
{
ARMARX_INFO << "Recording still in progress, stopping component anyways. " ARMARX_INFO << "Recording still in progress, stopping component anyways. "
"Saving statistics..."; "Saving statistics...";
longtermMemory.getAndSaveStatistics(); longtermMemory.getAndSaveStatistics();
} }
} catch(...){ }
catch (...)
{
ARMARX_WARNING << "Statistics could not be saved for recording that was interrupted by " ARMARX_WARNING << "Statistics could not be saved for recording that was interrupted by "
"disconnecting the component"; "disconnecting the component";
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <mutex> #include <mutex>
#include <optional> #include <optional>
#include <VirtualRobot/XML/BaseIO.h>
#include <VirtualRobot/XML/RobotIO.h> #include <VirtualRobot/XML/RobotIO.h>
#include <ArmarXCore/core/PackagePath.h> #include <ArmarXCore/core/PackagePath.h>
...@@ -28,7 +29,8 @@ namespace armarx::armem::articulated_object ...@@ -28,7 +29,8 @@ namespace armarx::armem::articulated_object
ArticulatedObjectReader::getArticulatedObject(const std::string& typeName, ArticulatedObjectReader::getArticulatedObject(const std::string& typeName,
const armem::Time& timestamp, const armem::Time& timestamp,
const std::optional<std::string>& providerName, const std::optional<std::string>& providerName,
const std::string& instanceName) const std::string& instanceName,
VirtualRobot::RobotIO::RobotDescription loadMode)
{ {
const auto descriptions = queryDescriptions(timestamp, providerName); const auto descriptions = queryDescriptions(timestamp, providerName);
...@@ -50,8 +52,7 @@ namespace armarx::armem::articulated_object ...@@ -50,8 +52,7 @@ namespace armarx::armem::articulated_object
ARMARX_DEBUG << "Description for articulate object with type <" << typeName ARMARX_DEBUG << "Description for articulate object with type <" << typeName
<< "> available!"; << "> available!";
auto obj = VirtualRobot::RobotIO::loadRobot(it->xml.toSystemPath(), auto obj = VirtualRobot::RobotIO::loadRobot(it->xml.toSystemPath(), loadMode);
VirtualRobot::RobotIO::eStructure);
if (not obj) if (not obj)
{ {
...@@ -77,8 +78,7 @@ namespace armarx::armem::articulated_object ...@@ -77,8 +78,7 @@ namespace armarx::armem::articulated_object
if (not objectState) if (not objectState)
{ {
ARMARX_VERBOSE << deactivateSpam(5) << "Querying object state failed for object `" ARMARX_VERBOSE << deactivateSpam(5) << "Querying object state failed for object `"
<< object.getName() << "` " << object.getName() << "` " << "(type `" << object.getType() << "`)!";
<< "(type `" << object.getType() << "`)!";
return false; return false;
} }
......
#pragma once #pragma once
#include <VirtualRobot/XML/RobotIO.h>
#include "Reader.h" #include "Reader.h"
namespace armarx::armem::articulated_object namespace armarx::armem::articulated_object
...@@ -10,10 +12,12 @@ namespace armarx::armem::articulated_object ...@@ -10,10 +12,12 @@ namespace armarx::armem::articulated_object
public: public:
using Reader::Reader; using Reader::Reader;
VirtualRobot::RobotPtr getArticulatedObject(const std::string& typeName, VirtualRobot::RobotPtr getArticulatedObject(
const armem::Time& timestamp, const std::string& typeName,
const std::optional<std::string>& providerName, const armem::Time& timestamp,
const std::string& instanceName = ""); const std::optional<std::string>& providerName,
const std::string& instanceName = "",
VirtualRobot::RobotIO::RobotDescription loadMode = VirtualRobot::RobotIO::eStructure);
[[nodiscard]] bool [[nodiscard]] bool
synchronizeArticulatedObject(VirtualRobot::Robot& object, synchronizeArticulatedObject(VirtualRobot::Robot& object,
......
...@@ -84,16 +84,35 @@ namespace armarx::armem::server::robot_state ...@@ -84,16 +84,35 @@ namespace armarx::armem::server::robot_state
} }
void void
Visu::visualizeRobots(viz::Layer& layer, const armem::robot_state::Robots& robots, bool useColModel) Visu::visualizeRobots(viz::Layer& layer,
const armem::robot_state::Robots& robots,
bool useColModel)
{ {
for (const armem::robot_state::Robot& robot : robots) for (const armem::robot_state::Robot& robot : robots)
{ {
const armarx::data::PackagePath xmlPath = robot.description.xml.serialize(); const armarx::data::PackagePath xmlPath = robot.description.xml.serialize();
const auto* robotModel = getRobotModel(robot.description);
std::map<std::string, float> jointMap = robot.config.jointMap;
// we override the jointMap with the joint values from the robot model if it has not been set explicitly
if(robotModel != nullptr)
{
for(const auto& [jointName, jointValue]: robotModel->model->getJointValues())
{
if(jointMap.count(jointName) == 0)
{
jointMap[jointName] = jointValue;
}
}
}
// clang-format off // clang-format off
viz::Robot robotVisu = viz::Robot(robot.description.name) viz::Robot robotVisu = viz::Robot(robot.description.name)
.file(xmlPath.package, xmlPath.package + "/" + xmlPath.path) .file(xmlPath.package, xmlPath.package + "/" + xmlPath.path)
.joints(robot.config.jointMap) .joints(jointMap)
.pose(robot.config.globalPose); .pose(robot.config.globalPose);
if (not useColModel) if (not useColModel)
...@@ -230,10 +249,9 @@ namespace armarx::armem::server::robot_state ...@@ -230,10 +249,9 @@ namespace armarx::armem::server::robot_state
// - global pose // - global pose
// - joint positions // - joint positions
// => this is nothing but an armem::Robot // => this is nothing but an armem::Robot
ARMARX_DEBUG << "Combining robot ..." ARMARX_DEBUG << "Combining robot ..." << "\n- " << robotDescriptions.size()
<< "\n- " << robotDescriptions.size() << " descriptions" << " descriptions" << "\n- " << globalPoses.size() << " global poses" << "\n- "
<< "\n- " << globalPoses.size() << " global poses" << sensorValues.size() << " joint positions";
<< "\n- " << sensorValues.size() << " joint positions";
const armem::robot_state::Robots robots = const armem::robot_state::Robots robots =
combine(robotDescriptions, globalPoses, sensorValues, timestamp); combine(robotDescriptions, globalPoses, sensorValues, timestamp);
...@@ -324,12 +342,10 @@ namespace armarx::armem::server::robot_state ...@@ -324,12 +342,10 @@ namespace armarx::armem::server::robot_state
} }
} }
void Visu::RobotModel*
Visu::visualizeForceTorque(viz::Layer& layer, Visu::getRobotModel(const armem::robot_state::description::RobotDescription& robotDescription)
const armem::robot_state::Robot& robot,
const proprioception::SensorValues& sensorValues)
{ {
const std::string& robotName = robot.description.name; const std::string& robotName = robotDescription.name;
RobotModel* robotModel = nullptr; RobotModel* robotModel = nullptr;
if (auto it = models.find(robotName); it != models.end()) if (auto it = models.find(robotName); it != models.end())
...@@ -338,12 +354,28 @@ namespace armarx::armem::server::robot_state ...@@ -338,12 +354,28 @@ namespace armarx::armem::server::robot_state
} }
else else
{ {
const std::filesystem::path robotPath = robot.description.xml.toSystemPath(); const std::filesystem::path robotPath = robotDescription.xml.toSystemPath();
ARMARX_INFO << "Loading robot model for '" << robotName << "' from " << robotPath ARMARX_INFO << "Loading robot model for '" << robotName << "' from " << robotPath
<< " for visualization."; << " for visualization.";
auto [it2, _] = models.emplace(robotName, robotPath); auto [it2, _] = models.emplace(robotName, robotPath);
robotModel = &it2->second; robotModel = &it2->second;
} }
return robotModel;
}
void
Visu::visualizeForceTorque(viz::Layer& layer,
const armem::robot_state::Robot& robot,
const proprioception::SensorValues& sensorValues)
{
Visu::RobotModel* robotModel = getRobotModel(robot.description);
if(robotModel == nullptr)
{
// ARMARX_WARNING << "Robot model is null";
return;
}
robotModel->model->setJointValues(robot.config.jointMap); robotModel->model->setJointValues(robot.config.jointMap);
robotModel->model->setGlobalPose(robot.config.globalPose.matrix()); robotModel->model->setGlobalPose(robot.config.globalPose.matrix());
......
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
#include <optional> #include <optional>
#include <ArmarXCore/core/time.h>
#include <ArmarXCore/core/logging/Logging.h> #include <ArmarXCore/core/logging/Logging.h>
#include <ArmarXCore/core/services/tasks/TaskUtil.h> #include <ArmarXCore/core/services/tasks/TaskUtil.h>
#include <ArmarXCore/core/time.h>
#include <ArmarXCore/core/time/DateTime.h> #include <ArmarXCore/core/time/DateTime.h>
#include <ArmarXCore/libraries/DebugObserverHelper/DebugObserverHelper.h> #include <ArmarXCore/libraries/DebugObserverHelper/DebugObserverHelper.h>
...@@ -60,7 +60,9 @@ namespace armarx::armem::server::robot_state ...@@ -60,7 +60,9 @@ namespace armarx::armem::server::robot_state
void visualizeOnce(const core::time::DateTime& timestamp); void visualizeOnce(const core::time::DateTime& timestamp);
static void visualizeRobots(viz::Layer& layer, const armem::robot_state::Robots& robots, bool useColModel = false); void visualizeRobots(viz::Layer& layer,
const armem::robot_state::Robots& robots,
bool useColModel = false);
static void visualizeFrames( static void visualizeFrames(
viz::Layer& layerFrames, viz::Layer& layerFrames,
...@@ -75,6 +77,11 @@ namespace armarx::armem::server::robot_state ...@@ -75,6 +77,11 @@ namespace armarx::armem::server::robot_state
const armem::robot_state::Robot& robot, const armem::robot_state::Robot& robot,
const proprioception::SensorValues& sensorValues); const proprioception::SensorValues& sensorValues);
struct RobotModel; // forward declaration
RobotModel* getRobotModel(const armem::robot_state::description::RobotDescription& robotDescription);
private: private:
viz::Client arviz; viz::Client arviz;
std::optional<DebugObserverHelper> debugObserver; std::optional<DebugObserverHelper> debugObserver;
......
...@@ -22,7 +22,8 @@ namespace armarx::skills::segment ...@@ -22,7 +22,8 @@ namespace armarx::skills::segment
ExecutableSkillLibraryCoreSegment::defineProperties(PropertyDefinitionsPtr defs, ExecutableSkillLibraryCoreSegment::defineProperties(PropertyDefinitionsPtr defs,
const std::string& prefix) const std::string& prefix)
{ {
// No properties! (meaning no name and no max size) this->setDefaultMaxHistorySize(10);
Base::defineProperties(defs, prefix);
} }
void void
......
...@@ -20,7 +20,8 @@ namespace armarx::skills::segment ...@@ -20,7 +20,8 @@ namespace armarx::skills::segment
void void
SkillEventCoreSegment::defineProperties(PropertyDefinitionsPtr defs, const std::string& prefix) SkillEventCoreSegment::defineProperties(PropertyDefinitionsPtr defs, const std::string& prefix)
{ {
// No properties! (meaning no name and no max size) this->setDefaultMaxHistorySize(10);
Base::defineProperties(defs, prefix);
} }
void void
......
...@@ -20,7 +20,8 @@ namespace armarx::skills::segment ...@@ -20,7 +20,8 @@ namespace armarx::skills::segment
SkillExecutionRequestCoreSegment::defineProperties(PropertyDefinitionsPtr defs, SkillExecutionRequestCoreSegment::defineProperties(PropertyDefinitionsPtr defs,
const std::string& prefix) const std::string& prefix)
{ {
// No properties! (meaning no name and no max size) this->setDefaultMaxHistorySize(10);
Base::defineProperties(defs, prefix);
} }
void void
......
...@@ -16,6 +16,10 @@ namespace armarx::skills::segment ...@@ -16,6 +16,10 @@ namespace armarx::skills::segment
defs->optional(p.statechartCoreSegmentName, "StatechartCoreSegmentName", "Name of the core segment for statecharts."); defs->optional(p.statechartCoreSegmentName, "StatechartCoreSegmentName", "Name of the core segment for statecharts.");
defs->optional(p.statechartTransitionsProviderSegmentName, "TransitionsProviderSegmentName", "Name of the provider segment for statechart transitions."); defs->optional(p.statechartTransitionsProviderSegmentName, "TransitionsProviderSegmentName", "Name of the provider segment for statechart transitions.");
defs->optional(p.statechartTransitionsTopicName, "tpc.sub.ProfilerListener", "Name of the ProfilerListenerInterface topics to subscribe."); defs->optional(p.statechartTransitionsTopicName, "tpc.sub.ProfilerListener", "Name of the ProfilerListenerInterface topics to subscribe.");
this->setDefaultMaxHistorySize(10);
coreSegment.setDefaultMaxHistorySize(10);
Base::defineProperties(defs, prefix);
} }
void StatechartListenerProviderSegment::init() void StatechartListenerProviderSegment::init()
......