Skip to content
Snippets Groups Projects
Commit d9d50803 authored by Mirko Wächter's avatar Mirko Wächter
Browse files

KinematicUnitObserver rejects now joint that are not in the joint set instead of throwing an error

parent 3eb93d6a
No related branches found
No related tags found
No related merge requests found
......@@ -91,11 +91,12 @@ void KinematicUnitObserver::onConnectObserver()
throw UserException("RobotNodeSet not defined");
}
VirtualRobot::RobotNodeSetPtr robotNodeSetPtr = robot->getRobotNodeSet(robotNodeSetName);
auto robotNodeSetPtr = robot->getRobotNodeSet(robotNodeSetName);
std::vector< VirtualRobot::RobotNodePtr > robotNodes;
robotNodes = robotNodeSetPtr->getAllRobotNodes();
auto robotNodeNames = robotNodeSetPtr->getNodeNames();
this->robotNodes = std::set<std::string>(robotNodeNames.begin(), robotNodeNames.end());
// register all channels
offerChannel("jointangles", "Joint values of the " + robotNodeSetName + " kinematic chain");
offerChannel("jointvelocities", "Joint velocities of the " + robotNodeSetName + " kinematic chain");
......@@ -298,14 +299,20 @@ void KinematicUnitObserver::nameValueMapToDataFields(const std::string& channelN
{
for (const auto& it : nameValueMap)
{
map[it.first] = new Variant(it.second);
if (robotNodes.count(it.first))
{
map[it.first] = new Variant(it.second);
}
}
}
else
{
for (const auto& it : nameValueMap)
{
map[it.first] = new TimedVariant(new Variant(it.second), IceUtil::Time::microSeconds(timestamp));
if (robotNodes.count(it.first))
{
map[it.first] = new TimedVariant(new Variant(it.second), IceUtil::Time::microSeconds(timestamp));
}
}
}
setDataFieldsFlatCopy(channelName, map);
......
......@@ -155,6 +155,7 @@ namespace armarx
Mutex initializedChannelsMutex;
private:
std::string robotNodeSetName;
std::set<std::string> robotNodes;
};
......
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