25 #include <SimoxUtility/math/convert/pos_rpy_to_mat4f.h>
26 #include <VirtualRobot/XML/RobotIO.h>
44 #include "../Devices/RTThreadTimingsSensorDevice.h"
57 RtDeactivateController(
const NJointControllerBasePtr& nJointCtrl)
59 nJointCtrl->rtDeactivateController();
63 RtActivateController(
const NJointControllerBasePtr& nJointCtrl)
65 nJointCtrl->rtActivateController();
69 RtDeactivateControllerBecauseOfError(
const NJointControllerBasePtr& nJointCtrl)
71 nJointCtrl->rtDeactivateControllerBecauseOfError();
83 static std::vector<JointController*>&
87 .controllersActivated.getWriteBuffer()
91 static std::vector<NJointControllerBase*>&
95 .controllersActivated.getWriteBuffer()
99 static std::vector<std::size_t>&
100 GetActivatedJointToNJointControllerAssignement(
ControlThread* p)
102 return p->
_module<ControlThreadDataBuffer>()
103 .controllersActivated.getWriteBuffer()
104 .jointToNJointControllerAssignement;
107 static const std::vector<JointController*>&
110 return p->_module<ControlThreadDataBuffer>()
111 .controllersActivated.getWriteBuffer()
115 static const std::vector<NJointControllerBase*>&
118 return p->_module<ControlThreadDataBuffer>()
119 .controllersActivated.getWriteBuffer()
123 static const std::vector<std::size_t>&
124 GetActivatedJointToNJointControllerAssignement(
const ControlThread* p)
126 return p->_module<ControlThreadDataBuffer>()
127 .controllersActivated.getWriteBuffer()
128 .jointToNJointControllerAssignement;
132 AcceptRequestedJointToNJointControllerAssignement(
ControlThread* p)
134 p->_module<ControlThreadDataBuffer>()
135 .controllersActivated.getWriteBuffer()
136 .jointToNJointControllerAssignement = p->_module<ControlThreadDataBuffer>()
137 .controllersRequested.getReadBuffer()
138 .jointToNJointControllerAssignement;
144 return p->_module<ControlThreadDataBuffer>().controllersActivated.commitWrite();
150 return p->_module<ControlThreadDataBuffer>()
151 .controllersActivated.getWriteBuffer()
155 static const std::vector<JointController*>&
159 return p->_module<ControlThreadDataBuffer>()
160 .controllersRequested.getReadBuffer()
164 static const std::vector<NJointControllerBase*>&
168 return p->_module<ControlThreadDataBuffer>()
169 .controllersRequested.getReadBuffer()
173 static const std::vector<std::size_t>&
174 GetRequestedJointToNJointControllerAssignement(
const ControlThread* p)
177 return p->_module<ControlThreadDataBuffer>()
178 .controllersRequested.getReadBuffer()
179 .jointToNJointControllerAssignement;
186 return p->_module<ControlThreadDataBuffer>().controllersRequested.updateReadBuffer();
196 p->_module<ControlThreadDataBuffer>().controllersRequested._getNonConstReadBuffer();
197 auto& j = readbuf.jointControllers;
198 auto& assig = readbuf.jointToNJointControllerAssignement;
199 auto& nj = readbuf.nJointControllers;
201 const auto assigNJ = assig.at(
index);
205 nj.at(assigNJ) =
nullptr;
206 for (std::size_t i = 0; i < assig.size(); ++i)
208 if (assig.at(i) == assigNJ)
210 j.at(i) = j.at(i)->rtGetParent().rtGetJointStopMovementController();
226 static const std::vector<ControlDevicePtr>&
232 static const std::vector<SensorDevicePtr>&
238 static const std::vector<const SensorValueBase*>&
241 return p->
_module<Devices>().sensorValues;
244 static const std::vector<std::vector<PropagateConst<ControlTargetBase*>>>&
247 return p->_module<Devices>().controlTargets;
250 static RTThreadTimingsSensorDevice&
253 return *(p->_module<Devices>().rtThreadTimingsSensorDevice);
259 const std::vector<VirtualRobot::RobotNodePtr>& robotNodes)
261 p->_module<Devices>().updateVirtualRobotFromSensorValues(
262 robot, robotNodes, p->_module<Devices>().sensorValues);
279 if (!m.heartbeatRequired || now < m.controlLoopStartTime + m.heartbeatStartupMarginMS)
283 return (now - m.lastHeartbeat) > m.heartbeatMaxCycleMS;
301 preSwitchSetup_ActivatedJointControllers = rtGetActivatedJointControllers();
302 preSwitchSetup_ActivatedJointToNJointControllerAssignement =
303 rtGetActivatedJointToNJointControllerAssignement();
304 preSwitchSetup_ActivatedNJointControllers = rtGetActivatedNJointControllers();
309 const auto& actJC = rtGetActivatedJointControllers();
310 const auto& assig = rtGetActivatedJointToNJointControllerAssignement();
311 const auto& actNJC = rtGetActivatedNJointControllers();
315 postSwitchSetup_ActivatedJointControllers = actJC;
316 postSwitchSetup_ActivatedJointToNJointControllerAssignement = assig;
317 postSwitchSetup_ActivatedNJointControllers = actNJC;
320 std::size_t numSyncNj = 0;
321 std::size_t numAsyncNj = 0;
323 for (std::size_t i = 0; i < actJC.size(); ++i)
325 if (actNJC.at(i) ==
nullptr)
331 _activatedSynchronousNJointControllersIdx.at(numSyncNj++) = i;
335 _activatedAsynchronousNJointControllersIdx.at(numAsyncNj++) = i;
340 "NJoint controller that is neither SynchronousNJointController"
341 " nor AsynchronousNJointController: %s",
342 actNJC.at(i)->rtGetClassName().c_str());
347 for (std::size_t i = numSyncNj;
348 i < _maxControllerCount &&
349 _activatedSynchronousNJointControllersIdx.at(i) != _maxControllerCount;
352 _activatedSynchronousNJointControllersIdx.at(i) = _maxControllerCount;
354 for (std::size_t i = numAsyncNj;
355 i < _maxControllerCount &&
356 _activatedAsynchronousNJointControllersIdx.at(i) != _maxControllerCount;
359 _activatedAsynchronousNJointControllersIdx.at(i) = _maxControllerCount;
364 rtSwitchControllerSetupChangedControllers =
false;
367 if (!emergencyStop && ManagementAttorneyForControlThread::HeartbeatMissing(
this))
380 if (emergencyStop && !rtThreadOverridesControl)
386 rtIsInEmergencyStop_ =
true;
388 for (
auto& nJointCtrl : rtGetActivatedNJointControllers())
392 NJointControllerAttorneyForControlThread::RtDeactivateController(nJointCtrl);
393 nJointCtrl =
nullptr;
394 rtSwitchControllerSetupChangedControllers =
true;
401 const auto active = controlDevice->rtGetActiveJointController();
402 const auto stopMov = controlDevice->rtGetJointStopMovementController();
403 const auto emergency = controlDevice->rtGetJointEmergencyStopController();
404 if (active != stopMov && active != emergency)
406 controlDevice->rtSetActiveJointController(emergency);
407 rtGetActivatedJointControllers().at(i) = emergency;
408 rtSwitchControllerSetupChangedControllers =
true;
411 if (rtSwitchControllerSetupChangedControllers)
413 ControlThreadDataBufferAttorneyForControlThread::
414 ResetActivatedControllerAssignement(
this);
417 return rtSwitchControllerSetupChangedControllers;
420 if (!rtThreadOverridesControl &&
421 !ControlThreadDataBufferAttorneyForControlThread::RequestedControllersChanged(
this) &&
426 rtIsInEmergencyStop_ =
false;
430 const auto& allReqNJ = rtGetRequestedNJointControllers();
431 auto& allActdNJ = rtGetActivatedNJointControllers();
434 std::size_t idxAct = 0;
435 std::size_t idxReq = 0;
436 for (std::size_t i = 0; i < 2 * n; ++i)
439 while (idxAct < n && !allActdNJ.at(idxAct))
443 const NJointControllerBasePtr& req =
444 idxReq < n ? allReqNJ.at(idxReq) :
nullptr;
445 const NJointControllerBasePtr& act =
446 idxAct < n ? allActdNJ.at(idxAct) :
nullptr;
447 const auto reqId =
reinterpret_cast<std::uintptr_t
>(req.get());
448 const auto actId =
reinterpret_cast<std::uintptr_t
>(act.get());
453 rtSyncNJointControllerRobot(req.get());
454 NJointControllerAttorneyForControlThread::RtActivateController(req);
456 rtSwitchControllerSetupChangedControllers =
true;
458 else if (reqId < actId)
460 NJointControllerAttorneyForControlThread::RtDeactivateController(act);
461 rtSwitchControllerSetupChangedControllers =
true;
470 if (idxAct >= n && !req)
475 allActdNJ = allReqNJ;
480 const auto& allReqJ = rtGetRequestedJointControllers();
481 auto& allActdJ = rtGetActivatedJointControllers();
486 const auto requestedJointCtrl = allReqJ.at(i);
487 controlDevice->rtSetActiveJointController(requestedJointCtrl);
488 allActdJ.at(i) = requestedJointCtrl;
491 ControlThreadDataBufferAttorneyForControlThread::
492 AcceptRequestedJointToNJointControllerAssignement(
this);
503 controlDev->rtGetActiveJointController()->rtResetTarget();
512 numberOfInvalidTargetsInThisIteration = 0;
514 for (std::size_t i = 0; i < cdevs.size(); ++i)
516 if (!rtGetActivatedJointControllers().at(i)->rtIsTargetValid())
520 cdevs.at(i)->rtGetDeviceName());
521 ARMARX_ERROR <<
">>>INVALID TARGET for JointController (idx = " << i <<
") '"
522 << cdevs.at(i)->getDeviceName() <<
"'";
524 ++numberOfInvalidTargetsInThisIteration;
538 device->rtReadSensorValues(sensorValuesTimestamp, timeSinceLastIteration);
540 DevicesAttorneyForControlThread::UpdateRobotWithSensorValues(
this, rtRobot, rtRobotNodes);
552 dynamicsHelpers->update(sensorValuesTimestamp, timeSinceLastIteration);
565 device->rtRun(sensorValuesTimestamp, timeSinceLastIteration);
576 auto activatedNjointCtrls = rtGetActivatedNJointControllers();
578 for (std::size_t nJointCtrlIndex : _activatedAsynchronousNJointControllersIdx)
580 if (nJointCtrlIndex == _maxControllerCount)
585 activatedNjointCtrls.at(nJointCtrlIndex));
592 if (nJointCtrl->rtGetErrorState())
595 "NJointControllerBase '%s' requested deactivation while activating it",
596 nJointCtrl->rtGetInstanceName().c_str());
600 rtSyncNJointControllerRobot(nJointCtrl);
601 nJointCtrl->rtRunIterationBegin(sensorValuesTimestamp, timeSinceLastIteration);
603 if (nJointCtrl->rtGetErrorState())
606 "NJointControllerBase '%s' requested deactivation while running it",
607 nJointCtrl->rtGetInstanceName().c_str());
610 if (
static_cast<std::size_t
>(duration.toMicroSeconds()) >
611 nJointCtrl->rtGetNumberOfUsedControlDevices() * usPerDevUntilError)
614 nJointCtrl->rtGetInstanceName().c_str(),
615 duration.toMicroSeconds())
618 else if (
static_cast<std::size_t
>(duration.toMicroSeconds()) >
619 nJointCtrl->rtGetNumberOfUsedControlDevices() * usPerDevUntilWarn)
622 nJointCtrl->rtGetInstanceName().c_str(),
623 duration.toMicroSeconds())
629 ARMARX_ERROR <<
"NJoint Controller " << nJointCtrl->getInstanceName()
630 <<
" threw an exception and is now deactivated: "
637 for (std::size_t nJointCtrlIndex : _activatedSynchronousNJointControllersIdx)
639 if (nJointCtrlIndex == _maxControllerCount)
649 if (nJointCtrl->rtGetErrorState())
652 "NJointControllerBase '%s' requested deactivation while activating it",
653 nJointCtrl->rtGetInstanceName().c_str());
659 rtSyncNJointControllerRobot(nJointCtrl);
660 nJointCtrl->rtSwapBufferAndRun(sensorValuesTimestamp, timeSinceLastIteration);
662 if (nJointCtrl->rtGetErrorState())
665 "NJointControllerBase '%s' requested deactivation while running it",
666 nJointCtrl->rtGetInstanceName().c_str());
670 if (
static_cast<std::size_t
>(duration.toMicroSeconds()) >
671 nJointCtrl->rtGetNumberOfUsedControlDevices() * usPerDevUntilError)
674 nJointCtrl->rtGetInstanceName().c_str(),
675 duration.toMicroSeconds())
678 else if (
static_cast<std::size_t
>(duration.toMicroSeconds()) >
679 nJointCtrl->rtGetNumberOfUsedControlDevices() * usPerDevUntilWarn)
682 nJointCtrl->rtGetInstanceName().c_str(),
683 duration.toMicroSeconds())
690 ARMARX_ERROR <<
"NJoint Controller " << nJointCtrl->getInstanceName()
691 <<
" threw an exception and is now deactivated: "
698 for (std::size_t nJointCtrlIndex : _activatedAsynchronousNJointControllersIdx)
700 if (nJointCtrlIndex == _maxControllerCount)
705 activatedNjointCtrls.at(nJointCtrlIndex));
712 if (nJointCtrl->rtGetErrorState())
715 "NJointControllerBase '%s' requested deactivation while activating it",
716 nJointCtrl->rtGetInstanceName().c_str());
720 rtSyncNJointControllerRobot(nJointCtrl);
721 nJointCtrl->rtRunIterationEnd(sensorValuesTimestamp, timeSinceLastIteration);
723 if (nJointCtrl->rtGetErrorState())
726 "NJointControllerBase '%s' requested deactivation while running it",
727 nJointCtrl->rtGetInstanceName().c_str());
730 if (
static_cast<std::size_t
>(duration.toMicroSeconds()) >
731 nJointCtrl->rtGetNumberOfUsedControlDevices() * usPerDevUntilError)
734 nJointCtrl->rtGetInstanceName().c_str(),
735 duration.toMicroSeconds())
738 else if (
static_cast<std::size_t
>(duration.toMicroSeconds()) >
739 nJointCtrl->rtGetNumberOfUsedControlDevices() * usPerDevUntilWarn)
742 nJointCtrl->rtGetInstanceName().c_str(),
743 duration.toMicroSeconds())
749 ARMARX_ERROR <<
"NJoint Controller " << nJointCtrl->getInstanceName()
750 <<
" threw an exception and is now deactivated: "
762 const NJointControllerBasePtr& nJointCtrl =
763 rtGetActivatedNJointControllers().at(nJointCtrlIndex);
764 NJointControllerAttorneyForControlThread::RtDeactivateControllerBecauseOfError(nJointCtrl);
765 for (
auto ctrlDevIdx : nJointCtrl->rtGetControlDeviceUsedIndices())
768 JointController* es = controlDevice->rtGetJointEmergencyStopController();
772 <<
VAROUT(ctrlDevIdx) <<
"\n"
773 <<
VAROUT(controlDevice->getDeviceName()) <<
"\n"
776 controlDevice->rtSetActiveJointController(es);
777 rtGetActivatedJointControllers().at(ctrlDevIdx) = es;
778 rtGetActivatedJointToNJointControllerAssignement().at(ctrlDevIdx) =
IndexSentinel();
780 rtGetActivatedNJointControllers().at(nJointCtrlIndex) =
nullptr;
783 for (
auto ctrlDevIdx : nJointCtrl->rtGetControlDeviceUsedIndices())
785 const auto& ctrlModeGroups = _module<Devices>().getControlModeGroups();
786 const auto groupIdx = ctrlModeGroups.groupIndices.at(ctrlDevIdx);
796 for (
const auto otherIdx : ctrlModeGroups.deviceIndices.at(groupIdx))
801 if (hwModeHash == otherHwModeHash)
806 const auto otherNJointCtrl1Idx =
807 rtGetActivatedJointToNJointControllerAssignement().at(otherIdx);
817 rtGetActivatedJointControllers().at(otherIdx) = es;
831 std::size_t nJointCtrlIndex =
832 rtGetActivatedJointToNJointControllerAssignement().at(ctrlDevIndex);
834 <<
"no NJoint controller controls this device (name = "
836 << rtGetActivatedJointControllers().at(ctrlDevIndex)->getControlMode() <<
")!"
838 <<
"This means an invariant is violated! Dumping data for debugging:\n"
839 <<
VAROUT(ctrlDevIndex) <<
"\n"
852 ControlThreadDataBufferAttorneyForControlThread::CommitActivatedControllers(
this);
855 SensorAndControl& sc = _module<ControlThreadDataBuffer>().rtGetSensorAndControlBuffer();
870 sc.
control.at(ctrlIdx).size());
878 _module<ControlThreadDataBuffer>().rtSensorAndControlBufferCommitWrite();
884 const std::vector<ControlDevicePtr>&
887 return DevicesAttorneyForControlThread::GetControlDevices(
this);
890 const std::vector<SensorDevicePtr>&
893 return DevicesAttorneyForControlThread::GetSensorDevices(
this);
899 return DevicesAttorneyForControlThread::GetThreadTimingsSensorDevice(
this);
905 if (state == EmergencyStopState::eEmergencyStopActive)
907 emergencyStopStateRequest = EmergencyStopStateRequest::RequestActive;
911 emergencyStopStateRequest = EmergencyStopStateRequest::RequestInactive;
916 ControlThread::_preFinishControlThreadInitialization()
919 controlThreadId = std::this_thread::get_id();
921 _maxControllerCount = rtGetActivatedJointControllers().size();
924 rtGetActivatedJointToNJointControllerAssignement().size());
927 preSwitchSetup_ActivatedJointControllers.resize(_maxControllerCount);
928 postSwitchSetup_ActivatedJointControllers.resize(_maxControllerCount);
930 preSwitchSetup_ActivatedJointToNJointControllerAssignement.resize(_maxControllerCount);
931 postSwitchSetup_ActivatedJointToNJointControllerAssignement.resize(_maxControllerCount);
933 preSwitchSetup_ActivatedNJointControllers.resize(_maxControllerCount);
934 postSwitchSetup_ActivatedNJointControllers.resize(_maxControllerCount);
936 _activatedSynchronousNJointControllersIdx.resize(_maxControllerCount, _maxControllerCount);
937 _activatedAsynchronousNJointControllersIdx.resize(_maxControllerCount, _maxControllerCount);
940 if (getProperty<bool>(
"EnableInverseDynamics").getValue())
944 std::shared_ptr<DynamicsHelper> dynamicsHelpers(
new DynamicsHelper(robotUnit));
945 auto bodySetName = getProperty<std::string>(
"InverseDynamicsRobotBodySet").getValue();
946 auto rtRobotBodySet =
rtGetRobot()->getRobotNodeSet(bodySetName);
948 <<
"could not find robot node set with name: " << bodySetName
949 <<
" - Check property InverseDynamicsRobotBodySet";
956 armarx::Split(getProperty<std::string>(
"InverseDynamicsRobotJointSets").getValue(),
960 for (
auto&
set : setList)
964 <<
" - Check property InverseDynamicsRobotJointSets";
965 dynamicsHelpers->addRobotPart(rns, rtRobotBodySet, velFilter, accFilter);
969 this->dynamicsHelpers = dynamicsHelpers;
974 ControlThread::_preOnInitRobotUnit()
979 rtRobot = VirtualRobot::RobotIO::loadRobot(_module<RobotData>().getRobotFileName(),
980 VirtualRobot::RobotIO::eStructure);
981 rtRobot->setUpdateCollisionModel(
false);
982 rtRobot->setUpdateVisualization(
false);
983 rtRobot->setThreadsafe(
false);
984 rtRobotNodes = rtRobot->getRobotNodes();
986 catch (VirtualRobot::VirtualRobotException& e)
988 throw UserException(e.what());
990 usPerDevUntilWarn = getProperty<std::size_t>(
991 "NjointController_AllowedExecutionTimePerControlDeviceUntilWarning")
993 usPerDevUntilError = getProperty<std::size_t>(
994 "NjointController_AllowedExecutionTimePerControlDeviceUntilError")
1002 _module<Units>().getEmergencyStopMaster()->setEmergencyStopState(state);
1009 return emergencyStop ? EmergencyStopState::eEmergencyStopActive
1010 : EmergencyStopState::eEmergencyStopInactive;
1018 : EmergencyStopState::eEmergencyStopInactive;
1022 ControlThread::setEmergencyStopStateNoReportToTopic(EmergencyStopState state)
1025 emergencyStop = (state == EmergencyStopState::eEmergencyStopActive);
1029 ControlThread::processEmergencyStopRequest()
1032 emergencyStopStateRequest.exchange(EmergencyStopStateRequest::RequestNone);
1035 case EmergencyStopStateRequest::RequestActive:
1038 case EmergencyStopStateRequest::RequestInactive:
1041 case EmergencyStopStateRequest::RequestNone:
1045 <<
"Unkown value for EmergencyStopStateRequest";
1049 const std::vector<JointController*>&
1050 ControlThread::rtGetActivatedJointControllers()
const
1052 return ControlThreadDataBufferAttorneyForControlThread::GetActivatedJointControllers(
this);
1055 const std::vector<NJointControllerBase*>&
1056 ControlThread::rtGetActivatedNJointControllers()
const
1058 return ControlThreadDataBufferAttorneyForControlThread::GetActivatedNJointControllers(
this);
1061 const std::vector<std::size_t>&
1062 ControlThread::rtGetActivatedJointToNJointControllerAssignement()
const
1064 return ControlThreadDataBufferAttorneyForControlThread::
1065 GetActivatedJointToNJointControllerAssignement(
this);
1068 std::vector<JointController*>&
1069 ControlThread::rtGetActivatedJointControllers()
1071 return ControlThreadDataBufferAttorneyForControlThread::GetActivatedJointControllers(
this);
1074 std::vector<NJointControllerBase*>&
1075 ControlThread::rtGetActivatedNJointControllers()
1077 return ControlThreadDataBufferAttorneyForControlThread::GetActivatedNJointControllers(
this);
1080 std::vector<std::size_t>&
1081 ControlThread::rtGetActivatedJointToNJointControllerAssignement()
1083 return ControlThreadDataBufferAttorneyForControlThread::
1084 GetActivatedJointToNJointControllerAssignement(
this);
1087 const std::vector<JointController*>&
1088 ControlThread::rtGetRequestedJointControllers()
const
1090 return ControlThreadDataBufferAttorneyForControlThread::GetRequestedJointControllers(
this);
1093 const std::vector<NJointControllerBase*>&
1094 ControlThread::rtGetRequestedNJointControllers()
const
1096 return ControlThreadDataBufferAttorneyForControlThread::GetRequestedNJointControllers(
this);
1099 const std::vector<std::size_t>&
1100 ControlThread::rtGetRequestedJointToNJointControllerAssignement()
const
1102 return ControlThreadDataBufferAttorneyForControlThread::
1103 GetRequestedJointToNJointControllerAssignement(
this);
1107 ControlThread::rtSyncNJointControllerRobot(NJointControllerBase* njctrl)
1109 if (njctrl->rtGetRobot())
1112 auto& from = rtRobotNodes;
1113 auto& to = njctrl->rtGetRobotNodes();
1114 for (std::size_t i = 0; i < from.size(); ++i)
1116 to.at(i)->copyPoseFrom(from.at(i));
1120 njctrl->rtGetRobot()->setGlobalPose(rtRobot->getGlobalPose(),
false);
1125 ControlThread::dumpRtControllerSetup(
1127 const std::string& indent,
1128 const std::vector<JointController*>& activeJCtrls,
1129 const std::vector<std::size_t>& assignement,
1130 const std::vector<NJointControllerBase*>& activeNJCtrls)
const
1132 out << indent <<
"JointControllers:\n";
1135 for (std::size_t i = 0; i < cdevs.size(); ++i)
1137 const JointController* jctrl = activeJCtrls.at(i);
1138 out << indent <<
"\t(" << i <<
")\t" << cdevs.at(i)->getDeviceName() <<
":\n"
1139 << indent <<
"\t\t Controller: " << jctrl->getControlMode() <<
" (" << jctrl
1141 << indent <<
"\t\t Assigned NJoint: " << assignement.at(i) <<
"\n";
1144 out << indent <<
"NJointControllers:\n";
1146 for (std::size_t i = 0; i < activeNJCtrls.size(); ++i)
1148 const auto* njctrl = activeNJCtrls.at(i);
1149 out << indent <<
"\t(" << i <<
")\t";
1152 out << njctrl->rtGetInstanceName() <<
" (" << njctrl <<
"):"
1153 <<
"\t Class: " << njctrl->rtGetClassName() <<
"\n";
1157 out <<
" (" << njctrl <<
")\n";
1164 ControlThread::dumpRtState()
const
1166 std::stringstream
str;
1167 str <<
"state requested\n";
1168 dumpRtControllerSetup(
str,
1170 rtGetRequestedJointControllers(),
1171 rtGetRequestedJointToNJointControllerAssignement(),
1172 rtGetRequestedNJointControllers());
1174 str <<
"state before rtSwitchControllerSetup() was called\n";
1175 dumpRtControllerSetup(
str,
1177 preSwitchSetup_ActivatedJointControllers,
1178 preSwitchSetup_ActivatedJointToNJointControllerAssignement,
1179 preSwitchSetup_ActivatedNJointControllers);
1181 str <<
"state after rtSwitchControllerSetup() was called\n";
1182 dumpRtControllerSetup(
str,
1184 postSwitchSetup_ActivatedJointControllers,
1185 postSwitchSetup_ActivatedJointToNJointControllerAssignement,
1186 postSwitchSetup_ActivatedNJointControllers);
1188 str <<
"state now\n";
1189 dumpRtControllerSetup(
str,
1191 rtGetActivatedJointControllers(),
1192 rtGetActivatedJointToNJointControllerAssignement(),
1193 rtGetActivatedNJointControllers());
1195 str <<
VAROUT(rtSwitchControllerSetupChangedControllers) <<
"\n";
1196 str <<
VAROUT(numberOfInvalidTargetsInThisIteration) <<
"\n";
1205 if (not globalPoseSensorDevice)
1210 const auto*
const sensorValue =
1212 if (sensorValue ==
nullptr)
1224 rtRobot->setGlobalPose(gp, updateRobot);
1230 ControlThreadDataBufferAttorneyForControlThread::RTSetJointController(
this,
c,
index);