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 (5)
...@@ -482,6 +482,12 @@ void armarx::ArVizStorage::recordBatch(armarx::viz::data::RecordingBatch& batch) ...@@ -482,6 +482,12 @@ void armarx::ArVizStorage::recordBatch(armarx::viz::data::RecordingBatch& batch)
batch.header.lastRevision = last.revision; batch.header.lastRevision = last.revision;
batch.header.firstTimestampInMicroSeconds = first.timestampInMicroseconds; batch.header.firstTimestampInMicroSeconds = first.timestampInMicroseconds;
batch.header.lastTimestampInMicroSeconds = last.timestampInMicroseconds; batch.header.lastTimestampInMicroSeconds = last.timestampInMicroseconds;
if (firstBatch)
{
batch.initialState = currentState;
firstBatch = false;
}
std::string filename = batchFileName(batch.header); std::string filename = batchFileName(batch.header);
std::filesystem::path filePath = recordingPath / filename; std::filesystem::path filePath = recordingPath / filename;
...@@ -571,6 +577,7 @@ std::string armarx::ArVizStorage::startRecording(std::string const& newRecording ...@@ -571,6 +577,7 @@ std::string armarx::ArVizStorage::startRecording(std::string const& newRecording
recordingMetaData.batchHeaders.clear(); recordingMetaData.batchHeaders.clear();
} }
firstBatch = true;
recordingTask = new RunningTask<ArVizStorage>(this, &ArVizStorage::record); recordingTask = new RunningTask<ArVizStorage>(this, &ArVizStorage::record);
recordingTask->start(); recordingTask->start();
...@@ -640,7 +647,7 @@ armarx::viz::data::RecordingBatch armarx::ArVizStorage::getRecordingBatch(std::s ...@@ -640,7 +647,7 @@ armarx::viz::data::RecordingBatch armarx::ArVizStorage::getRecordingBatch(std::s
return result; return result;
} }
if (batchIndex < 0 && batchIndex >= (long)recording->batchHeaders.size()) if (batchIndex < 0 || batchIndex >= (long)recording->batchHeaders.size())
{ {
ARMARX_WARNING << "Batch index is not valid. Index = " << batchIndex ARMARX_WARNING << "Batch index is not valid. Index = " << batchIndex
<< "Batch count: " << recording->batchHeaders.size(); << "Batch count: " << recording->batchHeaders.size();
......
...@@ -110,6 +110,7 @@ namespace armarx ...@@ -110,6 +110,7 @@ namespace armarx
std::vector<viz::data::TimestampedLayerUpdate> currentState; std::vector<viz::data::TimestampedLayerUpdate> currentState;
std::vector<viz::data::TimestampedLayerUpdate> history; std::vector<viz::data::TimestampedLayerUpdate> history;
long revision = 0; long revision = 0;
bool firstBatch = false;
// We store all interactions in here // We store all interactions in here
// But we curate them, so that only the last interaction with an element is reported // But we curate them, so that only the last interaction with an element is reported
......
...@@ -24,12 +24,13 @@ ...@@ -24,12 +24,13 @@
#pragma once #pragma once
// STD/STL // STD/STL
#include <memory>
#include <map> #include <map>
#include <memory>
#include <optional> #include <optional>
// ArmarX // ArmarX
#include <SimoxUtility/xml.h> #include <SimoxUtility/xml.h>
#include <ArmarXCore/core/rapidxml/wrapper/RapidXmlReader.h> #include <ArmarXCore/core/rapidxml/wrapper/RapidXmlReader.h>
/** /**
...@@ -116,36 +117,80 @@ namespace armarx::aron::typereader::xml ...@@ -116,36 +117,80 @@ namespace armarx::aron::typereader::xml
}; };
// Replacements ({tagName, {replacementsTag, additionalAronDTOXMLIncludePackagePath}, deprecationwarning}) // Replacements ({tagName, {replacementsTag, additionalAronDTOXMLIncludePackagePath}, deprecationwarning})
const std::map<std::string, Replacement> REPLACEMENTS = const std::map<std::string, Replacement> REPLACEMENTS = {
{ {"int",
{"int", {"<int32 />", {}, "The <int />-tag is deprecated. Please use <int32 /> instead."}}, {"<int32 />", {}, "The <int />-tag is deprecated. Please use <int32 /> instead."}},
{"long", {"<int64 />", {}, "The <long />-tag is deprecated. Please use <int64 /> instead."}}, {"long",
{"float", {"<float32 />", {}, "The <float />-tag is deprecated. Please use <float32 /> instead."}}, {"<int64 />", {}, "The <long />-tag is deprecated. Please use <int64 /> instead."}},
{"double", {"<float64 />", {}, "The <double />-tag is deprecated. Please use <float64 /> instead."}}, {"float",
{"position", {"<matrix rows='3' cols='1' type='float32' />", {}, ""}}, {"<float32 />",
{"pose", {"<matrix rows='4' cols='4' type='float32' />", {}, ""}}, {},
{"orientation", {"<quaternion type='float32' />", {}, ""}}, "The <float />-tag is deprecated. Please use <float32 /> instead."}},
{"double",
{"<float64 />",
{},
"The <double />-tag is deprecated. Please use <float64 /> instead."}},
// should that be deprecated?
{"position", {"<matrix rows='3' cols='1' type='float32' />", {}, ""}},
{"pose", {"<matrix rows='4' cols='4' type='float32' />", {}, ""}},
{"orientation", {"<quaternion type='float32' />", {}, ""}},
// values similar to eigen
{"quaternionf", {"<quaternion type='float32' />", {}, ""}},
{"quaterniond", {"<quaternion type='float64' />", {}, ""}},
{"vector2f", {"<matrix rows='2' cols='1' type='float32' />", {}, ""}},
{"vector2d", {"<matrix rows='2' cols='1' type='float64' />", {}, ""}},
{"vector3f", {"<matrix rows='3' cols='1' type='float32' />", {}, ""}},
{"vector3d", {"<matrix rows='3' cols='1' type='float64' />", {}, ""}},
{"vector4f", {"<matrix rows='4' cols='1' type='float32' />", {}, ""}},
{"vector4d", {"<matrix rows='4' cols='1' type='float64' />", {}, ""}},
{"matrix2f", {"<matrix rows='2' cols='2' type='float32' />", {}, ""}},
{"matrix2d", {"<matrix rows='2' cols='2' type='float64' />", {}, ""}},
{"matrix3f", {"<matrix rows='3' cols='3' type='float32' />", {}, ""}},
{"matrix3d", {"<matrix rows='3' cols='3' type='float64' />", {}, ""}},
{"matrix4f", {"<matrix rows='4' cols='4' type='float32' />", {}, ""}},
{"matrix4d", {"<matrix rows='4' cols='4' type='float64' />", {}, ""}},
// You can also add replacements for arondtos here! // You can also add replacements for arondtos here!
// structure: {xml-identifier, {replacement, auto-include}, deprecationwarning} // structure: {xml-identifier, {replacement, auto-include}, deprecationwarning}
{"datetime", {"<armarx::arondto::DateTime />", {"RobotAPI", "libraries/aron/common/aron/time.xml"}, ""}}, {"datetime",
{"time", {"<armarx::arondto::DateTime />", {"RobotAPI", "libraries/aron/common/aron/time.xml"}, ""}}, {"<armarx::arondto::DateTime />",
{"duration", {"<armarx::arondto::Duration />", {"RobotAPI", "libraries/aron/common/aron/time.xml"}, ""}}, {"RobotAPI", "libraries/aron/common/aron/time.xml"},
{"framedposition", {"<armarx::arondto::FramedPosition />", {"RobotAPI", "libraries/aron/common/aron/framed.xml"}, ""}}, ""}},
{"framedorientation", {"<armarx::arondto::FramedOrientation />", {"RobotAPI", "libraries/aron/common/aron/framed.xml"}, ""}}, {"time",
{"framedpose", {"<armarx::arondto::FramedPose />", {"RobotAPI", "libraries/aron/common/aron/framed.xml"}, ""}} {"<armarx::arondto::DateTime />",
}; {"RobotAPI", "libraries/aron/common/aron/time.xml"},
} ""}},
{"duration",
{"<armarx::arondto::Duration />",
{"RobotAPI", "libraries/aron/common/aron/time.xml"},
""}},
{"framedposition",
{"<armarx::arondto::FramedPosition />",
{"RobotAPI", "libraries/aron/common/aron/framed.xml"},
""}},
{"framedorientation",
{"<armarx::arondto::FramedOrientation />",
{"RobotAPI", "libraries/aron/common/aron/framed.xml"},
""}},
{"framedpose",
{"<armarx::arondto::FramedPose />",
{"RobotAPI", "libraries/aron/common/aron/framed.xml"},
""}}};
} // namespace constantes
namespace util namespace util
{ {
std::optional<RapidXmlReaderNode> GetFirstNodeWithTag(const RapidXmlReaderNode& node, const std::string& name); std::optional<RapidXmlReaderNode> GetFirstNodeWithTag(const RapidXmlReaderNode& node,
const std::string& name);
void EnforceAttribute(const RapidXmlReaderNode& node, const std::string& att); void EnforceAttribute(const RapidXmlReaderNode& node, const std::string& att);
bool HasAttribute(const RapidXmlReaderNode& node, const std::string& att); bool HasAttribute(const RapidXmlReaderNode& node, const std::string& att);
std::string GetAttribute(const RapidXmlReaderNode& node, const std::string& att); std::string GetAttribute(const RapidXmlReaderNode& node, const std::string& att);
std::string GetAttributeWithDefault(const RapidXmlReaderNode& node, const std::string& att, const std::string& def); std::string GetAttributeWithDefault(const RapidXmlReaderNode& node,
const std::string& att,
const std::string& def);
bool AttributeIsTrue(const RapidXmlReaderNode& node, const std::string& att); bool AttributeIsTrue(const RapidXmlReaderNode& node, const std::string& att);
bool HasTagName(const RapidXmlReaderNode& node, const std::string& name); bool HasTagName(const RapidXmlReaderNode& node, const std::string& name);
...@@ -158,5 +203,5 @@ namespace armarx::aron::typereader::xml ...@@ -158,5 +203,5 @@ namespace armarx::aron::typereader::xml
void EnforceChildSize(const RapidXmlReaderNode& node, const size_t size); void EnforceChildSize(const RapidXmlReaderNode& node, const size_t size);
void EnforceChildSizeGreaterEqual(const RapidXmlReaderNode& node, const size_t size); void EnforceChildSizeGreaterEqual(const RapidXmlReaderNode& node, const size_t size);
void EnforceChildSizeGreater(const RapidXmlReaderNode& node, const size_t size); void EnforceChildSizeGreater(const RapidXmlReaderNode& node, const size_t size);
} } // namespace util
} } // namespace armarx::aron::typereader::xml
...@@ -29,29 +29,21 @@ ...@@ -29,29 +29,21 @@
namespace armarx::aron namespace armarx::aron
{ {
Path::Path() : Path::Path() : rootIdentifier(DEFAULT_ROOT_IDENTIFIER), delimeter(DEFAULT_DELIMETER)
rootIdentifier("_ARON"),
delimeter("->")
{ {
} }
Path::Path(const std::vector<std::string>& p) : Path::Path(const std::vector<std::string>& p) :
rootIdentifier("_ARON"), rootIdentifier(DEFAULT_ROOT_IDENTIFIER), delimeter(DEFAULT_DELIMETER), path(p)
delimeter("->"),
path(p)
{ {
} }
Path::Path(const Path& p) : Path::Path(const Path& p) :
rootIdentifier(p.getRootIdentifier()), rootIdentifier(p.getRootIdentifier()), delimeter(p.getDelimeter()), path(p.getPath())
delimeter(p.getDelimeter()),
path(p.getPath())
{ {
} }
Path::Path(const Path& pa, const std::vector<std::string>& p) : Path::Path(const Path& pa, const std::vector<std::string>& p) : Path(pa)
Path(pa)
{ {
for (const std::string& s : p) for (const std::string& s : p)
{ {
...@@ -59,65 +51,78 @@ namespace armarx::aron ...@@ -59,65 +51,78 @@ namespace armarx::aron
} }
} }
void Path::setRootIdentifier(const std::string& s) void
Path::setRootIdentifier(const std::string& s)
{ {
rootIdentifier = s; rootIdentifier = s;
} }
std::string Path::getRootIdentifier() const std::string
Path::getRootIdentifier() const
{ {
return rootIdentifier; return rootIdentifier;
} }
void Path::setDelimeter(const std::string& d) void
Path::setDelimeter(const std::string& d)
{ {
delimeter = d; delimeter = d;
} }
std::string Path::getDelimeter() const std::string
Path::getDelimeter() const
{ {
return delimeter; return delimeter;
} }
void Path::append(const std::string& str) void
Path::append(const std::string& str)
{ {
path.push_back(str); path.push_back(str);
} }
std::vector<std::string> Path::getPath() const std::vector<std::string>
Path::getPath() const
{ {
return path; return path;
} }
std::string Path::getLastElement() const std::string
Path::getLastElement() const
{ {
if (!hasElement()) if (!hasElement())
{ {
throw error::AronException(__PRETTY_FUNCTION__, "Try to access last element of empty vector."); throw error::AronException(__PRETTY_FUNCTION__,
"Try to access last element of empty vector.");
} }
return path.back(); return path.back();
} }
std::string Path::getFirstElement() const std::string
Path::getFirstElement() const
{ {
if (!hasElement()) if (!hasElement())
{ {
throw error::AronException(__PRETTY_FUNCTION__, "Try to access last element of empty vector."); throw error::AronException(__PRETTY_FUNCTION__,
"Try to access last element of empty vector.");
} }
return path[0]; return path[0];
} }
bool Path::hasElement() const bool
Path::hasElement() const
{ {
return path.size() > 0; return path.size() > 0;
} }
size_t Path::size() const size_t
Path::size() const
{ {
return path.size(); return path.size();
} }
std::string Path::toString() const std::string
Path::toString() const
{ {
std::stringstream ss; std::stringstream ss;
ss << rootIdentifier; ss << rootIdentifier;
...@@ -128,7 +133,10 @@ namespace armarx::aron ...@@ -128,7 +133,10 @@ namespace armarx::aron
return ss.str(); return ss.str();
} }
Path Path::FromString(const std::string& s, const std::string& rootIdentifier, const std::string& delimeter) Path
Path::FromString(const std::string& s,
const std::string& rootIdentifier,
const std::string& delimeter)
{ {
std::vector<std::string> elements = simox::alg::split(s, delimeter); std::vector<std::string> elements = simox::alg::split(s, delimeter);
if (elements.size()) if (elements.size())
...@@ -138,7 +146,8 @@ namespace armarx::aron ...@@ -138,7 +146,8 @@ namespace armarx::aron
return Path(elements); return Path(elements);
} }
Path Path::withIndex(int i, bool escape) const Path
Path::withIndex(int i, bool escape) const
{ {
std::string el = std::to_string(i); std::string el = std::to_string(i);
if (escape) if (escape)
...@@ -148,7 +157,8 @@ namespace armarx::aron ...@@ -148,7 +157,8 @@ namespace armarx::aron
return Path(*this, {el}); return Path(*this, {el});
} }
Path Path::withElement(const std::string& s, bool escape) const Path
Path::withElement(const std::string& s, bool escape) const
{ {
std::string el = s; std::string el = s;
if (escape) if (escape)
...@@ -158,7 +168,8 @@ namespace armarx::aron ...@@ -158,7 +168,8 @@ namespace armarx::aron
return Path(*this, {el}); return Path(*this, {el});
} }
Path Path::withAcceptedType(bool escape) const Path
Path::withAcceptedType(bool escape) const
{ {
std::string el = "::accepted_type"; std::string el = "::accepted_type";
if (escape) if (escape)
...@@ -168,7 +179,8 @@ namespace armarx::aron ...@@ -168,7 +179,8 @@ namespace armarx::aron
return Path(*this, {el}); return Path(*this, {el});
} }
Path Path::withAcceptedTypeIndex(int i, bool escape) const Path
Path::withAcceptedTypeIndex(int i, bool escape) const
{ {
std::string el = "::accepted_type_" + std::to_string(i); std::string el = "::accepted_type_" + std::to_string(i);
if (escape) if (escape)
...@@ -178,7 +190,8 @@ namespace armarx::aron ...@@ -178,7 +190,8 @@ namespace armarx::aron
return Path(*this, {el}); return Path(*this, {el});
} }
Path Path::withDetachedLastElement() const Path
Path::withDetachedLastElement() const
{ {
std::vector<std::string> p = path; std::vector<std::string> p = path;
p.pop_back(); p.pop_back();
...@@ -188,7 +201,8 @@ namespace armarx::aron ...@@ -188,7 +201,8 @@ namespace armarx::aron
return ret; return ret;
} }
Path Path::withDetachedFirstElement() const Path
Path::withDetachedFirstElement() const
{ {
std::vector<std::string> p = path; std::vector<std::string> p = path;
p.erase(p.begin()); p.erase(p.begin());
...@@ -198,7 +212,8 @@ namespace armarx::aron ...@@ -198,7 +212,8 @@ namespace armarx::aron
return ret; return ret;
} }
Path Path::getWithoutPrefix(const Path& pref) const Path
Path::getWithoutPrefix(const Path& pref) const
{ {
unsigned int firstWithoutMatch = 0; unsigned int firstWithoutMatch = 0;
for (const std::string& el : pref.getPath()) for (const std::string& el : pref.getPath())
...@@ -212,11 +227,12 @@ namespace armarx::aron ...@@ -212,11 +227,12 @@ namespace armarx::aron
firstWithoutMatch++; firstWithoutMatch++;
} }
} }
std::vector<std::string> elementsWithoutPrefix(path.begin() + firstWithoutMatch, path.end()); std::vector<std::string> elementsWithoutPrefix(path.begin() + firstWithoutMatch,
path.end());
auto ret = Path(elementsWithoutPrefix); auto ret = Path(elementsWithoutPrefix);
ret.setRootIdentifier(rootIdentifier); ret.setRootIdentifier(rootIdentifier);
ret.setDelimeter(delimeter); ret.setDelimeter(delimeter);
return ret; return ret;
} }
} } // namespace armarx::aron
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
#pragma once #pragma once
// STD/STL // STD/STL
#include<vector> #include <string>
#include<string> #include <vector>
namespace armarx::aron namespace armarx::aron
{ {
...@@ -36,6 +36,9 @@ namespace armarx::aron ...@@ -36,6 +36,9 @@ namespace armarx::aron
class Path class Path
{ {
public: public:
static const constexpr char* DEFAULT_ROOT_IDENTIFIER = "_ARON";
static const constexpr char* DEFAULT_DELIMETER = "->";
/// default constructor /// default constructor
Path(); Path();
...@@ -69,7 +72,9 @@ namespace armarx::aron ...@@ -69,7 +72,9 @@ namespace armarx::aron
std::string getDelimeter() const; std::string getDelimeter() const;
std::string toString() const; std::string toString() const;
static Path FromString(const std::string&, const std::string& rootIdentifier = "_ARON", const std::string& delimeter = "->"); static Path FromString(const std::string&,
const std::string& rootIdentifier = DEFAULT_ROOT_IDENTIFIER,
const std::string& delimeter = DEFAULT_DELIMETER);
Path withDetachedFirstElement() const; Path withDetachedFirstElement() const;
Path withDetachedLastElement() const; Path withDetachedLastElement() const;
...@@ -83,4 +88,4 @@ namespace armarx::aron ...@@ -83,4 +88,4 @@ namespace armarx::aron
std::string delimeter; std::string delimeter;
std::vector<std::string> path; std::vector<std::string> path;
}; };
} } // namespace armarx::aron