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"?>
<scenario name="memory_to_debug_observer" creation="1970-01-01.01:00:00" globalConfigName="./config/global.cfg" package="RobotAPI" deploymentType="local" nodeName="NodeMain">
<application name="MemoryToDebugObserver" instance="" package="RobotAPI" nodeName="" enabled="true" iceAutoRestart="false"/>
<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"/>
</scenario>
......@@ -84,6 +84,10 @@ namespace armarx
"HistoryPath",
"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;
}
......@@ -165,9 +169,10 @@ namespace armarx
if (history.size() > properties_.componentWarnFrequency)
{
ARMARX_WARNING << "Component `" << componentName << "`"
ARMARX_WARNING << deactivateSpam(10) << "Component `" << componentName << "`"
<< "sends data at a too high rate ("
<< history.size() / maxHistoryDur.toSecondsDouble() << ")";
<< history.size() / maxHistoryDur.toSecondsDouble() << ")"
<< deactivateSpam(10, componentName);
}
}
......
......@@ -109,7 +109,7 @@ namespace armarx
int maxHistorySize = 1000;
std::filesystem::path historyPath = "RobotAPI/ArVizStorage";
float componentWarnFrequency = 25;
float componentWarnFrequency = 30;
} properties_;
......
......@@ -60,6 +60,7 @@ namespace armarx
statechartListenerProviderSegment.defineProperties(defs, prefix + "statechartlistener.");
executableSkillCoreSegment.defineProperties(defs, prefix + "executableskill.");
skillExecutionRequestCoreSegment.defineProperties(defs, prefix + "executionrequest.");
skillEventCoreSegment.defineProperties(defs, prefix + "event.");
setMemoryName(MemoryName);
return defs;
......
......@@ -30,6 +30,7 @@ namespace armarx::ControlModes
static const std::string Position1DoF = "ControlMode_Position1DoF";
static const std::string Torque1DoF = "ControlMode_Torque1DoF";
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 Current1DoF = "ControlMode_Current1DoF";
static const std::string PWM1DoF = "ControlMode_PWM1DoF";
......
......@@ -91,6 +91,11 @@ namespace armarx
ControlTarget1DoFActuatorZeroTorque,
torque,
ControlModes::ZeroTorque1DoF);
make_ControlTarget1DoFActuator(float,
ControllerConstants::ValueNotSetNaN,
ControlTarget1DoFActuatorZeroVelocity,
velocity,
ControlModes::ZeroVelocity1DoF);
make_ControlTarget1DoFActuator(float,
ControllerConstants::ValueNotSetNaN,
ControlTarget1DoFActuatorCurrent,
......
......@@ -45,6 +45,8 @@ namespace armarx
/// @return Whether the device has the given tag
bool hasTag(const std::string& tag) const;
virtual bool hasError(){return false;}
protected:
/// @brief adds the given tag to the Device
void addDeviceTag(const std::string& tag);
......
......@@ -81,7 +81,9 @@ namespace armarx
Eigen::Vector3f result;
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
{
......
......@@ -141,8 +141,6 @@ namespace armarx
GraspTrajectoryPtr
GraspTrajectory::ReadFromFile(const std::string& filename)
{
ARMARX_IMPORTANT << filename;
ARMARX_TRACE;
const auto ext = std::filesystem::path(filename).extension();
if (ext == ".xml")
......
......@@ -47,7 +47,7 @@ namespace armarx::armem::client::plugins
ReaderWriterPlugin(ManagedIceObject& parent, const std::string& pre) :
ComponentPlugin(parent, pre)
{
if (not armemPlugin)
if (armemPlugin == nullptr)
{
addPlugin(armemPlugin);
}
......
......@@ -133,13 +133,17 @@ namespace armarx::armem::server::plugins
statistics_saved = true;
*/
try{
if(longtermMemory.isRecording()){
try
{
if (longtermMemory.isRecording())
{
ARMARX_INFO << "Recording still in progress, stopping component anyways. "
"Saving statistics...";
longtermMemory.getAndSaveStatistics();
}
} catch(...){
}
catch (...)
{
ARMARX_WARNING << "Statistics could not be saved for recording that was interrupted by "
"disconnecting the component";
}
......
......@@ -3,6 +3,7 @@
#include <mutex>
#include <optional>
#include <VirtualRobot/XML/BaseIO.h>
#include <VirtualRobot/XML/RobotIO.h>
#include <ArmarXCore/core/PackagePath.h>
......@@ -28,7 +29,8 @@ namespace armarx::armem::articulated_object
ArticulatedObjectReader::getArticulatedObject(const std::string& typeName,
const armem::Time& timestamp,
const std::optional<std::string>& providerName,
const std::string& instanceName)
const std::string& instanceName,
VirtualRobot::RobotIO::RobotDescription loadMode)
{
const auto descriptions = queryDescriptions(timestamp, providerName);
......@@ -50,8 +52,7 @@ namespace armarx::armem::articulated_object
ARMARX_DEBUG << "Description for articulate object with type <" << typeName
<< "> available!";
auto obj = VirtualRobot::RobotIO::loadRobot(it->xml.toSystemPath(),
VirtualRobot::RobotIO::eStructure);
auto obj = VirtualRobot::RobotIO::loadRobot(it->xml.toSystemPath(), loadMode);
if (not obj)
{
......@@ -77,8 +78,7 @@ namespace armarx::armem::articulated_object
if (not objectState)
{
ARMARX_VERBOSE << deactivateSpam(5) << "Querying object state failed for object `"
<< object.getName() << "` "
<< "(type `" << object.getType() << "`)!";
<< object.getName() << "` " << "(type `" << object.getType() << "`)!";
return false;
}
......
#pragma once
#include <VirtualRobot/XML/RobotIO.h>
#include "Reader.h"
namespace armarx::armem::articulated_object
......@@ -10,10 +12,12 @@ namespace armarx::armem::articulated_object
public:
using Reader::Reader;
VirtualRobot::RobotPtr getArticulatedObject(const std::string& typeName,
const armem::Time& timestamp,
const std::optional<std::string>& providerName,
const std::string& instanceName = "");
VirtualRobot::RobotPtr getArticulatedObject(
const std::string& typeName,
const armem::Time& timestamp,
const std::optional<std::string>& providerName,
const std::string& instanceName = "",
VirtualRobot::RobotIO::RobotDescription loadMode = VirtualRobot::RobotIO::eStructure);
[[nodiscard]] bool
synchronizeArticulatedObject(VirtualRobot::Robot& object,
......
......@@ -84,16 +84,35 @@ namespace armarx::armem::server::robot_state
}
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)
{
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
viz::Robot robotVisu = viz::Robot(robot.description.name)
.file(xmlPath.package, xmlPath.package + "/" + xmlPath.path)
.joints(robot.config.jointMap)
.joints(jointMap)
.pose(robot.config.globalPose);
if (not useColModel)
......@@ -230,10 +249,9 @@ namespace armarx::armem::server::robot_state
// - global pose
// - joint positions
// => this is nothing but an armem::Robot
ARMARX_DEBUG << "Combining robot ..."
<< "\n- " << robotDescriptions.size() << " descriptions"
<< "\n- " << globalPoses.size() << " global poses"
<< "\n- " << sensorValues.size() << " joint positions";
ARMARX_DEBUG << "Combining robot ..." << "\n- " << robotDescriptions.size()
<< " descriptions" << "\n- " << globalPoses.size() << " global poses" << "\n- "
<< sensorValues.size() << " joint positions";
const armem::robot_state::Robots robots =
combine(robotDescriptions, globalPoses, sensorValues, timestamp);
......@@ -324,12 +342,10 @@ namespace armarx::armem::server::robot_state
}
}
void
Visu::visualizeForceTorque(viz::Layer& layer,
const armem::robot_state::Robot& robot,
const proprioception::SensorValues& sensorValues)
Visu::RobotModel*
Visu::getRobotModel(const armem::robot_state::description::RobotDescription& robotDescription)
{
const std::string& robotName = robot.description.name;
const std::string& robotName = robotDescription.name;
RobotModel* robotModel = nullptr;
if (auto it = models.find(robotName); it != models.end())
......@@ -338,12 +354,28 @@ namespace armarx::armem::server::robot_state
}
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
<< " for visualization.";
auto [it2, _] = models.emplace(robotName, robotPath);
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->setGlobalPose(robot.config.globalPose.matrix());
......
......@@ -23,9 +23,9 @@
#include <optional>
#include <ArmarXCore/core/time.h>
#include <ArmarXCore/core/logging/Logging.h>
#include <ArmarXCore/core/services/tasks/TaskUtil.h>
#include <ArmarXCore/core/time.h>
#include <ArmarXCore/core/time/DateTime.h>
#include <ArmarXCore/libraries/DebugObserverHelper/DebugObserverHelper.h>
......@@ -60,7 +60,9 @@ namespace armarx::armem::server::robot_state
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(
viz::Layer& layerFrames,
......@@ -75,6 +77,11 @@ namespace armarx::armem::server::robot_state
const armem::robot_state::Robot& robot,
const proprioception::SensorValues& sensorValues);
struct RobotModel; // forward declaration
RobotModel* getRobotModel(const armem::robot_state::description::RobotDescription& robotDescription);
private:
viz::Client arviz;
std::optional<DebugObserverHelper> debugObserver;
......
......@@ -22,7 +22,8 @@ namespace armarx::skills::segment
ExecutableSkillLibraryCoreSegment::defineProperties(PropertyDefinitionsPtr defs,
const std::string& prefix)
{
// No properties! (meaning no name and no max size)
this->setDefaultMaxHistorySize(10);
Base::defineProperties(defs, prefix);
}
void
......
......@@ -20,7 +20,8 @@ namespace armarx::skills::segment
void
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
......
......@@ -20,7 +20,8 @@ namespace armarx::skills::segment
SkillExecutionRequestCoreSegment::defineProperties(PropertyDefinitionsPtr defs,
const std::string& prefix)
{
// No properties! (meaning no name and no max size)
this->setDefaultMaxHistorySize(10);
Base::defineProperties(defs, prefix);
}
void
......
......@@ -16,6 +16,10 @@ namespace armarx::skills::segment
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.statechartTransitionsTopicName, "tpc.sub.ProfilerListener", "Name of the ProfilerListenerInterface topics to subscribe.");
this->setDefaultMaxHistorySize(10);
coreSegment.setDefaultMaxHistorySize(10);
Base::defineProperties(defs, prefix);
}
void StatechartListenerProviderSegment::init()
......