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
28void
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
56void
57armarx::ForceTorqueSubUnit::setOffset(const armarx::FramedDirectionBasePtr&,
58 const armarx::FramedDirectionBasePtr&,
59 const Ice::Current&)
60{
61 ARMARX_WARNING << "NYI";
62}
63
64void
66{
67 ARMARX_WARNING << "NYI";
68}
69
70void
72{
73 agentName = getProperty<std::string>("AgentName").getValue();
74}
Property< PropertyType > getProperty(const std::string &name)
void setToNull(const Ice::Current &=Ice::emptyCurrent) override
void update(const SensorAndControl &sc, const JointAndNJointControllers &c) override
std::vector< DeviceData > devs
void setOffset(const FramedDirectionBasePtr &, const FramedDirectionBasePtr &, const Ice::Current &=Ice::emptyCurrent) override
ForceTorqueUnitListenerPrx listenerPrx
FramedDirection is a 3 dimensional direction vector with a reference frame.
Definition FramedPose.h:87
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:99
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
The SensorValueBase class.
const T * asA() const
DETAIL_SensorValueBase_DEFAULT_METHOD_IMPLEMENTATION Eigen::Vector3f torque
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
Definition Logging.h:190
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
Definition Logging.h:193
detail::ControlThreadOutputBufferEntry SensorAndControl
Structure used by the RobotUnit to swap lists of Joint and NJoint controllers.
std::vector< PropagateConst< SensorValueBase * > > sensors