ForceTorqueUnitSimulation.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-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 RobotAPI::units
19  * @author Peter Kaiser (peter dot kaiser 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 #include "ForceTorqueUnit.h"
28 
32 
33 #include <IceUtil/Time.h>
34 
35 #include <string>
36 
37 namespace armarx
38 {
39  /**
40  * \class ForceTorqueUnitSimulationPropertyDefinitions
41  * \brief
42  */
45  {
46  public:
49  {
50  defineRequiredProperty<std::string>("SensorNames", "simulated sensor name. seperated by comma");
51  defineRequiredProperty<std::string>("AgentName", "name of the robot agent");
52  defineOptionalProperty<int>("IntervalMs", 50, "The time in milliseconds between two calls to the simulation method.");
53  }
54  };
55 
56  /**
57  * \class ForceTorqueUnitSimulation
58  * \brief Simulates a set of Force/Torque sensors.
59  * \ingroup RobotAPI-SensorActorUnits-simulation
60  *
61  * The unit is given a list of sensor names as a property. It then publishes force/torque values under these names.
62  * The published values will always be zero.
63  */
65  virtual public ForceTorqueUnit
66  {
67  public:
68  std::string getDefaultName() const override
69  {
70  return "ForceTorqueUnitSimulation";
71  }
72 
73  void onInitForceTorqueUnit() override;
74  void onStartForceTorqueUnit() override;
75  void onExitForceTorqueUnit() override;
76 
77  void simulationFunction();
78 
79  /**
80  * \warning Not implemented yet
81  */
82  void setOffset(const FramedDirectionBasePtr& forceOffsets, const FramedDirectionBasePtr& torqueOffsets, const Ice::Current& c = Ice::emptyCurrent) override;
83 
84  /**
85  * \warning Not implemented yet
86  */
87  void setToNull(const Ice::Current& c = Ice::emptyCurrent) override;
88 
89  /**
90  * \see PropertyUser::createPropertyDefinitions()
91  */
93 
94  protected:
95  std::map<std::string, armarx::FramedDirectionPtr> forces;
96  std::map<std::string, armarx::FramedDirectionPtr> torques;
97  Ice::StringSeq sensorNamesList;
99  };
100 }
101 
armarx::ForceTorqueUnitSimulation::torques
std::map< std::string, armarx::FramedDirectionPtr > torques
Definition: ForceTorqueUnitSimulation.h:96
armarx::ForceTorqueUnitSimulationPropertyDefinitions
Definition: ForceTorqueUnitSimulation.h:43
armarx::ForceTorqueUnitSimulation::onInitForceTorqueUnit
void onInitForceTorqueUnit() override
Definition: ForceTorqueUnitSimulation.cpp:34
armarx::ForceTorqueUnitSimulation::onStartForceTorqueUnit
void onStartForceTorqueUnit() override
Definition: ForceTorqueUnitSimulation.cpp:54
armarx::ForceTorqueUnitSimulation
Simulates a set of Force/Torque sensors.
Definition: ForceTorqueUnitSimulation.h:64
armarx::ForceTorqueUnitSimulation::simulationFunction
void simulationFunction()
Definition: ForceTorqueUnitSimulation.cpp:66
armarx::ForceTorqueUnitSimulationPropertyDefinitions::ForceTorqueUnitSimulationPropertyDefinitions
ForceTorqueUnitSimulationPropertyDefinitions(std::string prefix)
Definition: ForceTorqueUnitSimulation.h:47
armarx::ForceTorqueUnitPropertyDefinitions
Definition: ForceTorqueUnit.h:43
armarx::PropertyDefinitionContainer::prefix
std::string prefix
Prefix of the properties such as namespace, domain, component name, etc.
Definition: PropertyDefinitionContainer.h:333
PeriodicTask.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::ForceTorqueUnitSimulation::onExitForceTorqueUnit
void onExitForceTorqueUnit() override
Definition: ForceTorqueUnitSimulation.cpp:60
armarx::ForceTorqueUnitSimulation::forces
std::map< std::string, armarx::FramedDirectionPtr > forces
Definition: ForceTorqueUnitSimulation.h:95
armarx::ForceTorqueUnit
The ForceTorqueUnit class.
Definition: ForceTorqueUnit.h:72
armarx::ForceTorqueUnitSimulation::simulationTask
PeriodicTask< ForceTorqueUnitSimulation >::pointer_type simulationTask
Definition: ForceTorqueUnitSimulation.h:98
FramedPose.h
ForceTorqueUnit.h
armarx::ForceTorqueUnitSimulation::sensorNamesList
Ice::StringSeq sensorNamesList
Definition: ForceTorqueUnitSimulation.h:97
armarx::ForceTorqueUnitSimulation::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ForceTorqueUnitSimulation.cpp:89
IceUtil::Handle
Definition: forward_declarations.h:29
armarx::ForceTorqueUnitSimulation::getDefaultName
std::string getDefaultName() const override
Retrieve default name of component.
Definition: ForceTorqueUnitSimulation.h:68
armarx::ForceTorqueUnitSimulation::setToNull
void setToNull(const Ice::Current &c=Ice::emptyCurrent) override
Definition: ForceTorqueUnitSimulation.cpp:83
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::ForceTorqueUnitSimulation::setOffset
void setOffset(const FramedDirectionBasePtr &forceOffsets, const FramedDirectionBasePtr &torqueOffsets, const Ice::Current &c=Ice::emptyCurrent) override
Definition: ForceTorqueUnitSimulation.cpp:78
ImportExportComponent.h