ForceTorqueSubUnit.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package RobotAPI::ArmarXObjects::ForceTorqueSubUnit
17  * @author Raphael ( raphael dot grimm at kit dot edu )
18  * @date 2017
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 #include "ForceTorqueSubUnit.h"
23 
25 
27 
28 void
31 {
32  if (!getProxy())
33  {
34  //this unit is not initialized yet
35  ARMARX_IMPORTANT << deactivateSpam(1) << "not initialized yet";
36  return;
37  }
38  if (!listenerPrx)
39  {
40  ARMARX_IMPORTANT << deactivateSpam(1) << "listener is not set";
41  return;
42  }
43  for (DeviceData& dev : devs)
44  {
45  const SensorValueBase* sensorValBase = sc.sensors.at(dev.sensorIndex).get();
47  const SensorValueForceTorque& sensorVal = *sensorValBase->asA<SensorValueForceTorque>();
49  listenerPrx->reportSensorValues(
50  dev.deviceName,
51  new armarx::FramedDirection(sensorVal.force, dev.frame, agentName),
52  new armarx::FramedDirection(sensorVal.torque, dev.frame, agentName));
53  }
54 }
55 
56 void
57 armarx::ForceTorqueSubUnit::setOffset(const armarx::FramedDirectionBasePtr&,
58  const armarx::FramedDirectionBasePtr&,
59  const Ice::Current&)
60 {
61  ARMARX_WARNING << "NYI";
62 }
63 
64 void
66 {
67  ARMARX_WARNING << "NYI";
68 }
69 
70 void
72 {
73  agentName = getProperty<std::string>("AgentName").getValue();
74 }
armarx::ForceTorqueSubUnit::onInitForceTorqueUnit
void onInitForceTorqueUnit() override
Definition: ForceTorqueSubUnit.cpp:71
armarx::JointAndNJointControllers
Structure used by the RobotUnit to swap lists of Joint and NJoint controllers.
Definition: JointAndNJointControllers.h:32
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:183
armarx::SensorValueBase::asA
const T * asA() const
Definition: SensorValueBase.h:82
armarx::SensorValueBase
The SensorValueBase class.
Definition: SensorValueBase.h:40
armarx::ForceTorqueSubUnit::setToNull
void setToNull(const Ice::Current &=Ice::emptyCurrent) override
Definition: ForceTorqueSubUnit.cpp:65
armarx::detail::ControlThreadOutputBufferEntry::sensors
std::vector< PropagateConst< SensorValueBase * > > sensors
Definition: ControlThreadOutputBuffer.h:203
armarx::ForceTorqueSubUnit::devs
std::vector< DeviceData > devs
Definition: ForceTorqueSubUnit.h:65
armarx::SensorValueForceTorque::force
Eigen::Vector3f force
Definition: SensorValueForceTorque.h:35
armarx::detail::ControlThreadOutputBufferEntry
Definition: ControlThreadOutputBuffer.h:177
FramedPose.h
armarx::SensorValueForceTorque::torque
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION Eigen::Vector3f torque
Definition: SensorValueForceTorque.h:34
ForceTorqueSubUnit.h
ExpressionException.h
armarx::ForceTorqueUnit::listenerPrx
ForceTorqueUnitListenerPrx listenerPrx
Definition: ForceTorqueUnit.h:93
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
armarx::ForceTorqueSubUnit::update
void update(const SensorAndControl &sc, const JointAndNJointControllers &c) override
Definition: ForceTorqueSubUnit.cpp:29
armarx::FramedDirection
FramedDirection is a 3 dimensional direction vector with a reference frame. The reference frame can b...
Definition: FramedPose.h:83
armarx::ForceTorqueSubUnit::DeviceData
Definition: ForceTorqueSubUnit.h:58
armarx::Logging::deactivateSpam
SpamFilterDataPtr deactivateSpam(float deactivationDurationSec=10.0f, const std::string &identifier="", bool deactivate=true) const
disables the logging for the current line for the given amount of seconds.
Definition: Logging.cpp:92
armarx::ForceTorqueSubUnit::setOffset
void setOffset(const FramedDirectionBasePtr &, const FramedDirectionBasePtr &, const Ice::Current &=Ice::emptyCurrent) override
Definition: ForceTorqueSubUnit.cpp:57
armarx::SensorValueForceTorque
Definition: SensorValueForceTorque.h:31
ARMARX_WARNING
#define ARMARX_WARNING
Definition: Logging.h:186
armarx::ManagedIceObject::getProxy
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
Definition: ManagedIceObject.cpp:393
armarx::SensorValueBase::isA
bool isA() const
Definition: SensorValueBase.h:75