35 const std::string& robotName,
38 robotReader(robotReader), robotName(robotName),
hand(
hand), params(params)
48 const auto getForce = [&]()
57 if (not ft.has_value())
85 const float directionalForce =
88 return directionalForce;
97 const float force = getForce();
100 spikes.push_back(force);
103 float refValue = spikes.at(0);
105 bool risingEdgeDetected =
false;
106 bool fallingEdgeDetected =
false;
108 bool f2rDetected =
false;
109 bool r2fDetected =
false;
111 for (
const float spike : spikes)
115 if (spike < refValue)
122 risingEdgeDetected =
true;
123 f2rDetected |= fallingEdgeDetected;
129 if (spike > refValue)
136 fallingEdgeDetected =
true;
137 r2fDetected |= risingEdgeDetected;
176 std::this_thread::sleep_for(std::chrono::milliseconds{params.
cycleTimeMs});
185 const auto getForce = [&]()
194 if (not ft.has_value())
224 Eigen::Vector3f force_init = getForce();
229 const float force_delta = (getForce() - force_init).
norm();
232 if (force_delta > threshold)
235 ARMARX_INFO <<
"----- force torque is triggered at value " << force_delta;
238 std::this_thread::sleep_for(std::chrono::milliseconds{params.
cycleTimeMs});