ForceTorqueUnitDynamicSimulation.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2013-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarXCore::units
19  * @author Nikolaus Vahrenkamp <vahrenkamp at kit dot edu>
20  * @date 2014
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
25 #pragma once
26 
27 
28 #include <mutex>
29 #include <string>
30 
35 
39 
40 #include <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
41 
42 namespace armarx
43 {
46  {
47  public:
50  {
51 
52  //defineRequiredProperty<std::string>("RobotNodeName","Name of the robot node as stored in the XML file. There must be a force/torque sensor attached to this node.");
53  defineOptionalProperty<std::string>(
54  "ReportFrames",
55  "",
56  "Comma separated list of robotNodes in which the force information should be "
57  "transformed and reported.");
58  defineOptionalProperty<std::string>(
59  "SensorRobotNodeMapping",
60  "FT L:TCP L,FT R:TCP R",
61  "Comma separated list of a sensor->robotNodes mapping. The sensors will be "
62  "reported with the robot node name as as sensor name and in the frame of the robot "
63  "node.");
64  //defineOptionalProperty<std::string>("SimulatorProxyName", "Simulator", "Name of the simulator proxy to use.");
65  defineOptionalProperty<std::string>(
66  "RobotStateComponentName",
67  "RobotStateComponent",
68  "Name of the RobotStateComponent that should be used");
69  defineOptionalProperty<bool>(
70  "ReportInSensorFrame",
71  true,
72  "Report the sensor values also in the frame of the sensor.");
73  }
74  };
75 
76  /**
77  * @class ForceTorqueUnitDynamicSimulation
78  * @brief This unit connects to the physics simulator topic (default: "Simulator") and reports force torque values.
79  *
80  * @ingroup SensorActorUnits
81  * @ingroup ArmarXSimulatorComponents
82  */
84  virtual public ForceTorqueUnit,
85  virtual public ForceTorqueUnitDynamicSimulationInterface
86  {
87  public:
88  std::string
89  getDefaultName() const override
90  {
91  return "ForceTorqueUnitDynamicSimulation";
92  }
93 
94  void onInitForceTorqueUnit() override;
95  void onStartForceTorqueUnit() override;
96  void onExitForceTorqueUnit() override;
97 
99 
100  protected:
101  // implement SimulatorForceTorqueListenerInterface to receive robot updates from simulator
102  void reportForceTorque(const Vector3BasePtr& force,
103  const Vector3BasePtr& torque,
104  const std::string& sensorName,
105  const std::string& nodeName,
106  bool aValueChanged,
107  const Ice::Current& c = Ice::emptyCurrent) override;
108  Vector3BasePtr filterValues(const std::string& sensorName,
109  const Vector3BasePtr& torques,
110  std::map<std::string, DatafieldFilterBasePtr>& filters);
111  std::string agentName;
112  // ForceTorqueUnitInterface interface
113  public:
114  void setOffset(const FramedDirectionBasePtr&,
115  const FramedDirectionBasePtr&,
116  const Ice::Current&) override;
117  void setToNull(const Ice::Current&) override;
118 
121  std::vector<std::string> frames;
122  armarx::StringStringDictionary sensorRobotNodeMapping;
123  std::map<std::string, DatafieldFilterBasePtr> torqueFilters;
124  std::map<std::string, DatafieldFilterBasePtr> forceFilters;
125  bool reportInSensorFrame = true;
126  std::mutex reportMutex;
127  };
128 } // namespace armarx
RemoteRobot.h
armarx::ForceTorqueUnitDynamicSimulationPropertyDefinitions
Definition: ForceTorqueUnitDynamicSimulation.h:44
armarx::ForceTorqueUnitPropertyDefinitions
Definition: ForceTorqueUnit.h:43
Properties.h
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:345
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
ButterworthFilter.h
armarx::ForceTorqueUnitDynamicSimulation::onStartForceTorqueUnit
void onStartForceTorqueUnit() override
Definition: ForceTorqueUnitDynamicSimulation.cpp:61
armarx::ForceTorqueUnitDynamicSimulation::remoteRobot
VirtualRobot::RobotPtr remoteRobot
Definition: ForceTorqueUnitDynamicSimulation.h:119
armarx::ForceTorqueUnit
The ForceTorqueUnit class.
Definition: ForceTorqueUnit.h:76
armarx::ForceTorqueUnitDynamicSimulation::onExitForceTorqueUnit
void onExitForceTorqueUnit() override
Definition: ForceTorqueUnitDynamicSimulation.cpp:91
armarx::ForceTorqueUnitDynamicSimulation::filterValues
Vector3BasePtr filterValues(const std::string &sensorName, const Vector3BasePtr &torques, std::map< std::string, DatafieldFilterBasePtr > &filters)
Definition: ForceTorqueUnitDynamicSimulation.cpp:178
armarx::ForceTorqueUnitDynamicSimulation::setToNull
void setToNull(const Ice::Current &) override
Definition: ForceTorqueUnitDynamicSimulation.cpp:214
ForceTorqueUnit.h
armarx::ForceTorqueUnitDynamicSimulation
This unit connects to the physics simulator topic (default: "Simulator") and reports force torque val...
Definition: ForceTorqueUnitDynamicSimulation.h:83
SensorActorUnit.h
armarx::ForceTorqueUnitDynamicSimulation::sensorRobotNodeMapping
armarx::StringStringDictionary sensorRobotNodeMapping
Definition: ForceTorqueUnitDynamicSimulation.h:122
armarx::ForceTorqueUnitDynamicSimulation::onInitForceTorqueUnit
void onInitForceTorqueUnit() override
Definition: ForceTorqueUnitDynamicSimulation.cpp:34
armarx::ForceTorqueUnitDynamicSimulation::frames
std::vector< std::string > frames
Definition: ForceTorqueUnitDynamicSimulation.h:121
Component.h
armarx::ForceTorqueUnitDynamicSimulation::forceFilters
std::map< std::string, DatafieldFilterBasePtr > forceFilters
Definition: ForceTorqueUnitDynamicSimulation.h:124
armarx::ForceTorqueUnitDynamicSimulation::reportInSensorFrame
bool reportInSensorFrame
Definition: ForceTorqueUnitDynamicSimulation.h:125
IceUtil::Handle
Definition: forward_declarations.h:30
armarx::ForceTorqueUnitDynamicSimulationPropertyDefinitions::ForceTorqueUnitDynamicSimulationPropertyDefinitions
ForceTorqueUnitDynamicSimulationPropertyDefinitions(std::string prefix)
Definition: ForceTorqueUnitDynamicSimulation.h:48
IceInternal::ProxyHandle<::IceProxy::armarx::SharedRobotInterface >
armarx::ForceTorqueUnitDynamicSimulation::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ForceTorqueUnitDynamicSimulation.cpp:96
armarx::ForceTorqueUnitDynamicSimulation::reportMutex
std::mutex reportMutex
Definition: ForceTorqueUnitDynamicSimulation.h:126
armarx::ForceTorqueUnitDynamicSimulation::sharedRobot
SharedRobotInterfacePrx sharedRobot
Definition: ForceTorqueUnitDynamicSimulation.h:120
armarx::ForceTorqueUnitDynamicSimulation::agentName
std::string agentName
Definition: ForceTorqueUnitDynamicSimulation.h:111
armarx::ForceTorqueUnitDynamicSimulation::setOffset
void setOffset(const FramedDirectionBasePtr &, const FramedDirectionBasePtr &, const Ice::Current &) override
Definition: ForceTorqueUnitDynamicSimulation.cpp:206
armarx::ForceTorqueUnitDynamicSimulation::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: ForceTorqueUnitDynamicSimulation.h:89
armarx::ForceTorqueUnitDynamicSimulation::reportForceTorque
void reportForceTorque(const Vector3BasePtr &force, const Vector3BasePtr &torque, const std::string &sensorName, const std::string &nodeName, bool aValueChanged, const Ice::Current &c=Ice::emptyCurrent) override
Definition: ForceTorqueUnitDynamicSimulation.cpp:103
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::ForceTorqueUnitDynamicSimulation::torqueFilters
std::map< std::string, DatafieldFilterBasePtr > torqueFilters
Definition: ForceTorqueUnitDynamicSimulation.h:123
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19
ImportExportComponent.h