ForceTorqueUnitSimulation.cpp
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 
27 
28 #include <SimoxUtility/algorithm/string/string_tools.h>
29 
31 
32 namespace armarx
33 {
34  void
36  {
37  int intervalMs = getProperty<int>("IntervalMs").getValue();
38 
39  sensorNamesList = Split(getProperty<std::string>("SensorNames").getValue(), ",");
40  for (auto& sensor : sensorNamesList)
41  {
42  simox::alg::trim(sensor);
43  }
44 
45  for (std::vector<std::string>::iterator s = sensorNamesList.begin();
46  s != sensorNamesList.end();
47  s++)
48  {
50  Eigen::Vector3f(0, 0, 0), *s, getProperty<std::string>("AgentName").getValue());
52  Eigen::Vector3f(0, 0, 0), *s, getProperty<std::string>("AgentName").getValue());
53  }
54 
55  ARMARX_VERBOSE << "Starting ForceTorqueUnitSimulation with " << intervalMs
56  << " ms interval";
58  this,
60  intervalMs,
61  false,
62  "ForceTorqueUnitSimulation",
63  false);
64  }
65 
66  void
68  {
69  simulationTask->start();
70  }
71 
72  void
74  {
75  simulationTask->stop();
76  }
77 
78  void
80  {
81 
82  for (auto& sensor : sensorNamesList)
83  {
84  listenerPrx->reportSensorValues(sensor, forces[sensor], torques[sensor]);
85  }
86 
87  //listenerPrx->reportSensorValues(forces);
88  //listenerPrx->reportSensorValues(torques);
89  }
90 
91  void
92  ForceTorqueUnitSimulation::setOffset(const FramedDirectionBasePtr& forceOffsets,
93  const FramedDirectionBasePtr& torqueOffsets,
94  const Ice::Current& c)
95  {
96  // Ignore
97  }
98 
99  void
101  {
102  // Ignore
103  }
104 
107  {
108  return PropertyDefinitionsPtr(
110  }
111 } // namespace armarx
armarx::ForceTorqueUnitSimulation::torques
std::map< std::string, armarx::FramedDirectionPtr > torques
Definition: ForceTorqueUnitSimulation.h:102
armarx::ForceTorqueUnitSimulationPropertyDefinitions
Definition: ForceTorqueUnitSimulation.h:44
ARMARX_VERBOSE
#define ARMARX_VERBOSE
Definition: Logging.h:187
armarx::ForceTorqueUnitSimulation::onInitForceTorqueUnit
void onInitForceTorqueUnit() override
Definition: ForceTorqueUnitSimulation.cpp:35
armarx::ForceTorqueUnitSimulation::onStartForceTorqueUnit
void onStartForceTorqueUnit() override
Definition: ForceTorqueUnitSimulation.cpp:67
armarx::ForceTorqueUnitSimulation::simulationFunction
void simulationFunction()
Definition: ForceTorqueUnitSimulation.cpp:79
armarx::Split
std::vector< std::string > Split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
Definition: StringHelperTemplates.h:36
ForceTorqueUnitSimulation.h
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
armarx::ForceTorqueUnitSimulation::onExitForceTorqueUnit
void onExitForceTorqueUnit() override
Definition: ForceTorqueUnitSimulation.cpp:73
armarx::ForceTorqueUnitSimulation::forces
std::map< std::string, armarx::FramedDirectionPtr > forces
Definition: ForceTorqueUnitSimulation.h:101
armarx::ForceTorqueUnitSimulation::simulationTask
PeriodicTask< ForceTorqueUnitSimulation >::pointer_type simulationTask
Definition: ForceTorqueUnitSimulation.h:104
StringHelpers.h
armarx::Component::getConfigIdentifier
std::string getConfigIdentifier()
Retrieve config identifier for this component as set in constructor.
Definition: Component.cpp:79
armarx::ForceTorqueUnit::listenerPrx
ForceTorqueUnitListenerPrx listenerPrx
Definition: ForceTorqueUnit.h:96
armarx::VariantType::FramedDirection
const VariantTypeId FramedDirection
Definition: FramedPose.h:37
armarx::ForceTorqueUnitSimulation::sensorNamesList
Ice::StringSeq sensorNamesList
Definition: ForceTorqueUnitSimulation.h:103
armarx::ForceTorqueUnitSimulation::createPropertyDefinitions
PropertyDefinitionsPtr createPropertyDefinitions() override
Definition: ForceTorqueUnitSimulation.cpp:106
IceUtil::Handle
Definition: forward_declarations.h:30
armarx::PeriodicTask
Definition: ArmarXManager.h:70
armarx::PropertyDefinitionsPtr
IceUtil::Handle< class PropertyDefinitionContainer > PropertyDefinitionsPtr
PropertyDefinitions smart pointer type.
Definition: forward_declarations.h:35
armarx::ForceTorqueUnitSimulation::setToNull
void setToNull(const Ice::Current &c=Ice::emptyCurrent) override
Definition: ForceTorqueUnitSimulation.cpp:100
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
armarx::ForceTorqueUnitSimulation::setOffset
void setOffset(const FramedDirectionBasePtr &forceOffsets, const FramedDirectionBasePtr &torqueOffsets, const Ice::Current &c=Ice::emptyCurrent) override
Definition: ForceTorqueUnitSimulation.cpp:92