Skip to content
Snippets Groups Projects
Commit 6e791e10 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Fix bug: After a reconnect to robot/kinematic unit, local joint values can be...

Fix bug: After a reconnect to robot/kinematic unit, local joint values can be wrong. Need to fetch the real joint values first to avoid large jumps when selecting the joint.
parent c0ccb0a0
No related branches found
No related tags found
1 merge request!241Resolve "Fix bug in KinematicUnitGui controlling Torso Joint of ARMAR-DE to 0 when reconnecting"
......@@ -638,8 +638,26 @@ void KinematicUnitWidgetController::setControlModePosition()
return;
}
// currentNode->getJointValue() can we wrong after we re-connected to the robot unit.
// E.g., it can be 0 although the torso joint was at -365 before the unit disconnected.
// Therefore, we first have to fetch the actual joint values and use that one.
const NameValueMap currentJointAngles = kinematicUnitInterfacePrx->getJointAngles();
if (auto it = currentJointAngles.find(currentNode->getName()); it != currentJointAngles.end())
{
currentNode->setJointValue(it->second);
}
else
{
// Put this into else clause so the message is only constructed when necessary.
ARMARX_CHECK(false)
<< "Expected joint angles to contain '" << currentNode->getName() << ", "
<< "but contained: " << simox::alg::get_keys(currentJointAngles);
return;
}
float pos = currentNode->getJointValue() * conversionFactor;
ARMARX_INFO << "setting position control for current Node Name: " << currentNode->getName() << " with current value: " << pos;
ARMARX_INFO << "Setting position control for current node "
<< "(name '" << currentNode->getName() << "' with current value " << pos << ")";
// Setting the slider position to pos will set the position to the slider tick closest to pos
// This will initially send a position target with a small delta to the joint.
......
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