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
42namespace 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.");
54 "ReportFrames",
55 "",
56 "Comma separated list of robotNodes in which the force information should be "
57 "transformed and reported.");
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.");
66 "RobotStateComponentName",
67 "RobotStateComponent",
68 "Name of the RobotStateComponent that should be used");
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;
126 std::mutex reportMutex;
127 };
128} // namespace armarx
constexpr T c
This unit connects to the physics simulator topic (default: "Simulator") and reports force torque val...
std::map< std::string, DatafieldFilterBasePtr > forceFilters
Vector3BasePtr filterValues(const std::string &sensorName, const Vector3BasePtr &torques, std::map< std::string, DatafieldFilterBasePtr > &filters)
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
std::map< std::string, DatafieldFilterBasePtr > torqueFilters
void setOffset(const FramedDirectionBasePtr &, const FramedDirectionBasePtr &, const Ice::Current &) override
std::string getDefaultName() const override
Retrieve default name of component.
The ForceTorqueUnit class.
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
PropertyDefinition< PropertyType > & defineOptionalProperty(const std::string &name, PropertyType defaultValue, const std::string &description="", PropertyDefinitionBase::PropertyConstness constness=PropertyDefinitionBase::eConstant)
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
::IceInternal::ProxyHandle<::IceProxy::armarx::SharedRobotInterface > SharedRobotInterfacePrx
Definition FramedPose.h:59