28 #include <RobotSkillTemplates/statecharts/ForceControlGroup/ForceControlGroupStatechartContext.generated.h>
31 using namespace ForceControlGroup;
50 ForceControlGroupStatechartContext*
c = getContext<ForceControlGroupStatechartContext>();
51 DatafieldRefBasePtr rawforce;
52 DatafieldRefBasePtr rawtorque;
53 DatafieldRefBasePtr force;
54 DatafieldRefBasePtr torque;
55 if (in.isObserverSensorChannelNameSet())
57 rawforce =
c->getForceTorqueObserver()->getDataFieldRef(
new DataFieldIdentifier(
c->getForceTorqueObserver()->getObserverName(),
58 in.getObserverSensorChannelName(),
60 rawtorque =
c->getForceTorqueObserver()->getDataFieldRef(
new DataFieldIdentifier(
c->getForceTorqueObserver()->getObserverName(),
61 in.getObserverSensorChannelName(),
64 else if (in.isSensorNameSet())
66 std::string sensor = in.getSensorName();
68 rawforce =
c->getForceTorqueObserver()->getForceDatafield(sensor);
69 rawtorque =
c->getForceTorqueObserver()->getTorqueDatafield(sensor);
74 throw LocalException() <<
"Either SensorName or ObserverSensorChannelName must be set!";
76 force =
c->getForceTorqueObserver()->createNulledDatafield(rawforce);
77 torque =
c->getForceTorqueObserver()->createNulledDatafield(rawtorque);
79 local.setforceRef(DatafieldRefPtr::dynamicCast(force));
80 local.settorqueRef(DatafieldRefPtr::dynamicCast(torque));
81 ARMARX_IMPORTANT <<
"Installing force torque condition: force threshold: " << in.getForceMagnitudeThreshold()
82 <<
" torque threshold: " << in.getTorqueMagnitudeThreshold();
85 installConditionForForceTorqueThresholdReached(literalForce || literalTorque);
91 while (!isRunningTaskStopped())
105 ForceControlGroupStatechartContext*
c = getContext<ForceControlGroupStatechartContext>();
108 c->getForceTorqueObserver()->removeFilteredDatafield(local.getforceRef());
109 c->getForceTorqueObserver()->removeFilteredDatafield(local.gettorqueRef());