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 
32 
35 #include <ArmarXSimulation/interface/simulator/SimulatorInterface.h>
37 
38 #include <string>
39 #include <mutex>
40 
41 namespace armarx
42 {
44  {
45  public:
48  {
49 
50  //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.");
51  defineOptionalProperty<std::string>("ReportFrames", "", "Comma separated list of robotNodes in which the force information should be transformed and reported.");
52  defineOptionalProperty<std::string>("SensorRobotNodeMapping", "FT L:TCP L,FT R:TCP R", "Comma separated list of a sensor->robotNodes mapping. The sensors will be reported with the robot node name as as sensor name and in the frame of the robot node.");
53  //defineOptionalProperty<std::string>("SimulatorProxyName", "Simulator", "Name of the simulator proxy to use.");
54  defineOptionalProperty<std::string>("RobotStateComponentName", "RobotStateComponent", "Name of the RobotStateComponent that should be used");
55  defineOptionalProperty<bool>("ReportInSensorFrame", true, "Report the sensor values also in the frame of the sensor.");
56 
57  }
58  };
59 
60  /**
61  * @class ForceTorqueUnitDynamicSimulation
62  * @brief This unit connects to the physics simulator topic (default: "Simulator") and reports force torque values.
63  *
64  * @ingroup SensorActorUnits
65  * @ingroup ArmarXSimulatorComponents
66  */
68  virtual public ForceTorqueUnit,
69  virtual public ForceTorqueUnitDynamicSimulationInterface
70  {
71  public:
72  std::string getDefaultName() const override
73  {
74  return "ForceTorqueUnitDynamicSimulation";
75  }
76 
77  void onInitForceTorqueUnit() override;
78  void onStartForceTorqueUnit() override;
79  void onExitForceTorqueUnit() override;
80 
82  protected:
83 
84  // implement SimulatorForceTorqueListenerInterface to receive robot updates from simulator
85  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;
86  Vector3BasePtr filterValues(const std::string& sensorName, const Vector3BasePtr& torques, std::map<std::string, DatafieldFilterBasePtr>& filters);
87  std::string agentName;
88  // ForceTorqueUnitInterface interface
89  public:
90  void setOffset(const FramedDirectionBasePtr&, const FramedDirectionBasePtr&, const Ice::Current&) override;
91  void setToNull(const Ice::Current&) override;
92 
95  std::vector<std::string> frames;
96  armarx::StringStringDictionary sensorRobotNodeMapping;
97  std::map<std::string, DatafieldFilterBasePtr> torqueFilters;
98  std::map<std::string, DatafieldFilterBasePtr> forceFilters;
99  bool reportInSensorFrame = true;
100  std::mutex reportMutex;
101  };
102 }
103 
104 
RemoteRobot.h
armarx::ForceTorqueUnitDynamicSimulationPropertyDefinitions
Definition: ForceTorqueUnitDynamicSimulation.h:43
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:333
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
ButterworthFilter.h
armarx::ForceTorqueUnitDynamicSimulation::onStartForceTorqueUnit
void onStartForceTorqueUnit() override
Definition: ForceTorqueUnitDynamicSimulation.cpp:54
armarx::ForceTorqueUnitDynamicSimulation::remoteRobot
VirtualRobot::RobotPtr remoteRobot
Definition: ForceTorqueUnitDynamicSimulation.h:93
armarx::ForceTorqueUnit
The ForceTorqueUnit class.
Definition: ForceTorqueUnit.h:72
armarx::ForceTorqueUnitDynamicSimulation::onExitForceTorqueUnit
void onExitForceTorqueUnit() override
Definition: ForceTorqueUnitDynamicSimulation.cpp:80
armarx::ForceTorqueUnitDynamicSimulation::filterValues
Vector3BasePtr filterValues(const std::string &sensorName, const Vector3BasePtr &torques, std::map< std::string, DatafieldFilterBasePtr > &filters)
Definition: ForceTorqueUnitDynamicSimulation.cpp:153
armarx::ForceTorqueUnitDynamicSimulation::setToNull
void setToNull(const Ice::Current &) override
Definition: ForceTorqueUnitDynamicSimulation.cpp:184
ForceTorqueUnit.h
armarx::ForceTorqueUnitDynamicSimulation
This unit connects to the physics simulator topic (default: "Simulator") and reports force torque val...
Definition: ForceTorqueUnitDynamicSimulation.h:67
SensorActorUnit.h
armarx::ForceTorqueUnitDynamicSimulation::sensorRobotNodeMapping
armarx::StringStringDictionary sensorRobotNodeMapping
Definition: ForceTorqueUnitDynamicSimulation.h:96
armarx::ForceTorqueUnitDynamicSimulation::onInitForceTorqueUnit
void onInitForceTorqueUnit() override
Definition: ForceTorqueUnitDynamicSimulation.cpp:32
armarx::ForceTorqueUnitDynamicSimulation::frames
std::vector< std::string > frames
Definition: ForceTorqueUnitDynamicSimulation.h:95
Component.h
armarx::ForceTorqueUnitDynamicSimulation::forceFilters
std::map< std::string, DatafieldFilterBasePtr > forceFilters
Definition: ForceTorqueUnitDynamicSimulation.h:98
armarx::ForceTorqueUnitDynamicSimulation::reportInSensorFrame
bool reportInSensorFrame
Definition: ForceTorqueUnitDynamicSimulation.h:99
IceUtil::Handle
Definition: forward_declarations.h:29
armarx::ForceTorqueUnitDynamicSimulationPropertyDefinitions::ForceTorqueUnitDynamicSimulationPropertyDefinitions
ForceTorqueUnitDynamicSimulationPropertyDefinitions(std::string prefix)
Definition: ForceTorqueUnitDynamicSimulation.h:46
IceInternal::ProxyHandle< ::IceProxy::armarx::SharedRobotInterface >
armarx::ForceTorqueUnitDynamicSimulation::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ForceTorqueUnitDynamicSimulation.cpp:85
armarx::ForceTorqueUnitDynamicSimulation::reportMutex
std::mutex reportMutex
Definition: ForceTorqueUnitDynamicSimulation.h:100
armarx::ForceTorqueUnitDynamicSimulation::sharedRobot
SharedRobotInterfacePrx sharedRobot
Definition: ForceTorqueUnitDynamicSimulation.h:94
armarx::ForceTorqueUnitDynamicSimulation::agentName
std::string agentName
Definition: ForceTorqueUnitDynamicSimulation.h:87
armarx::ForceTorqueUnitDynamicSimulation::setOffset
void setOffset(const FramedDirectionBasePtr &, const FramedDirectionBasePtr &, const Ice::Current &) override
Definition: ForceTorqueUnitDynamicSimulation.cpp:179
armarx::ForceTorqueUnitDynamicSimulation::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: ForceTorqueUnitDynamicSimulation.h:72
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:91
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::ForceTorqueUnitDynamicSimulation::torqueFilters
std::map< std::string, DatafieldFilterBasePtr > torqueFilters
Definition: ForceTorqueUnitDynamicSimulation.h:97
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18
ImportExportComponent.h