Go to the documentation of this file.
34 #include <RobotAPI/libraries/armem_robot_state/aron/Proprioception.aron.generated.h>
35 #include <RobotAPI/libraries/armem_robot_state/aron/Transform.aron.generated.h>
42 template <
class... Args>
44 concatenate(
const std::vector<Args...>& lhs,
const std::vector<Args...>& rhs)
46 std::vector<Args...> conc = lhs;
47 std::copy(rhs.begin(), rhs.end(), std::back_inserter(conc));
51 template <
class KeyT,
class ValueT>
52 std::map<KeyT, ValueT>
55 const size_t size =
std::min(lhs.size(), rhs.size());
57 std::map<KeyT, ValueT> map;
58 for (
size_t i = 0; i < size; ++i)
60 map.emplace(lhs[i], rhs[i]);
65 template <
class KeyT,
class ValueT>
68 const std::vector<KeyT>& keys,
69 bool skipMissing =
false)
71 std::vector<ValueT>
values;
72 values.reserve(keys.size());
74 for (
const KeyT& key : keys)
78 if (
auto it = map.find(key); it != map.end())
80 values.push_back(it->second);
86 values.push_back(map.at(key));
93 template <
class... Args>
95 slice(
const std::vector<Args...>& vector,
97 std::optional<size_t> end = std::nullopt)
99 std::vector<Args...> result;
100 auto beginIt = vector.begin() + start;
101 auto endIt = end ? vector.begin() + *end : vector.end();
102 std::copy(beginIt, endIt, std::back_inserter(result));
120 const std::string& prefix)
125 prefix +
"predictAheadSeconds",
126 "How far into the future to predict [s].");
128 client.
remote.robotReader->registerPropertyDefinitions(defs);
168 while (
task and not
task->isStopped())
188 if (desc.has_value())
193 .overrideColor(simox::Color::cyan(255, 64));
210 const std::vector<armem::MemoryID> propEntityIDs =
221 if (prediction.globalPose.has_value())
224 robotViz->pose(prediction.globalPose->matrix());
229 this->localizationEntityIDs = locEntityIDs;
232 if (prediction.jointPositions.has_value())
234 robotViz->joints(prediction.jointPositions.value());
238 this->propioceptionEntityIDs = propEntityIDs;
std::vector< Args... > slice(const std::vector< Args... > &vector, size_t start=0, std::optional< size_t > end=std::nullopt)
CommitResult commit(StagedCommit const &commit)
std::optional< std::vector< armem::MemoryID > > localizationEntityIDs
std::vector< ValueT > multi_at(const std::map< KeyT, ValueT > &map, const std::vector< KeyT > &keys, bool skipMissing=false)
std::optional< std::vector< armem::MemoryID > > propioceptionEntityIDs
const std::string memoryName
std::vector< armem::MemoryID > queryProprioceptionEntityIDs()
void add(ElementT const &element)
#define ARMARX_CHECK(expression)
Shortcut for ARMARX_CHECK_EXPRESSION.
data::PackagePath serialize() const
armem::robot_state::RobotStatePredictionClient client
std::optional< viz::Robot > robotViz
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to copy
armarx::SimpleRunningTask ::pointer_type task
Reader useReader(const MemoryID &memoryID)
Use a memory server and get a reader for it.
void defineProperties(IceUtil::Handle< armarx::PropertyDefinitionContainer > &defs, const std::string &prefix)
static Duration SecondsDouble(double seconds)
Constructs a duration in seconds.
Duration waitForNextTick()
Wait and block until the target period is met.
std::vector< armem::MemoryID > queryLocalizationEntityIDs()
Represents a point in time.
WholeBodyPrediction predictWholeBody(const std::vector< armem::MemoryID > &localizationEntityIDs, const std::vector< armem::MemoryID > &proprioceptionEntityIDs, armem::Time predictedTime, const std::string &robotName, const std::string &engineID="Linear")
std::map< KeyT, ValueT > map_from_key_value_pairs(const std::vector< KeyT > &lhs, const std::vector< ValueT > &rhs)
Simple rate limiter for use in loops to maintain a certain frequency given a clock.
std::vector< Args... > concatenate(const std::vector< Args... > &lhs, const std::vector< Args... > &rhs)
The memory name system (MNS) client.
float predictAheadSeconds
Indicates that a query to the Memory Name System failed.
static DateTime Now()
Current time on the virtual clock.
static Frequency Hertz(std::int64_t hertz)
Layer layer(std::string const &name) const
void connect(armem::client::MemoryNameSystem &mns, viz::Client arviz)