DynamicsHelper.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2017, 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 ArmarX
19  * @author Mirko Waechter( mirko.waechter at kit dot edu)
20  * @date 2019
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #pragma once
25 #include <Eigen/Core>
26 
27 #include <VirtualRobot/Dynamics/Dynamics.h>
28 #include <VirtualRobot/RobotNodeSet.h>
29 
31 
32 namespace armarx::rtfilters
33 {
34  class RTFilterBase;
35  using RTFilterBasePtr = std::shared_ptr<RTFilterBase>;
36 } // namespace armarx::rtfilters
37 
38 namespace armarx
39 {
40  class RobotUnit;
41 
43  {
44  public:
45  struct DynamicsData
46  {
47  DynamicsData(VirtualRobot::RobotNodeSetPtr rnsJoints,
48  VirtualRobot::RobotNodeSetPtr rnsBodies) :
50  {
51  q = qDot = qDDot = tau = tauGravity = Eigen::VectorXd::Zero(rnsJoints->getSize());
52  }
53 
54  DynamicsData(const DynamicsData& r) = default;
55  VirtualRobot::RobotNodeSetPtr rnsJoints, rnsBodies;
56  VirtualRobot::Dynamics dynamics;
57  Eigen::VectorXd q, qDot, qDDot, tau, tauGravity;
58  std::vector<std::pair<VirtualRobot::RobotNodePtr, SensorValue1DoFActuator*>>
60  std::vector<rtfilters::RTFilterBasePtr> velocityFilter;
61  std::vector<rtfilters::RTFilterBasePtr> accelerationFilter;
62  };
63 
65  ~DynamicsHelper() = default;
66  void
67  addRobotPart(VirtualRobot::RobotNodeSetPtr rnsJoints,
68  VirtualRobot::RobotNodeSetPtr rnsBodies,
71  void update(const IceUtil::Time& sensorValuesTimestamp,
72  const IceUtil::Time& timeSinceLastIteration);
73 
74  protected:
76  std::map<VirtualRobot::RobotNodeSetPtr, DynamicsData> dataMap;
77  };
78 
79 } // namespace armarx
armarx::DynamicsHelper
Definition: DynamicsHelper.h:42
armarx::DynamicsHelper::robotUnit
RobotUnit * robotUnit
Definition: DynamicsHelper.h:75
armarx::rtfilters::RTFilterBasePtr
std::shared_ptr< RTFilterBase > RTFilterBasePtr
Definition: RTFilterBase.h:34
armarx::DynamicsHelper::DynamicsHelper
DynamicsHelper(RobotUnit *robotUnit)
Definition: DynamicsHelper.cpp:34
armarx::DynamicsHelper::DynamicsData::velocityFilter
std::vector< rtfilters::RTFilterBasePtr > velocityFilter
Definition: DynamicsHelper.h:60
armarx::DynamicsHelper::addRobotPart
void addRobotPart(VirtualRobot::RobotNodeSetPtr rnsJoints, VirtualRobot::RobotNodeSetPtr rnsBodies, rtfilters::RTFilterBasePtr velocityFilter=rtfilters::RTFilterBasePtr(), rtfilters::RTFilterBasePtr accelerationFilter=rtfilters::RTFilterBasePtr())
Definition: DynamicsHelper.cpp:41
armarx::DynamicsHelper::DynamicsData::qDot
Eigen::VectorXd qDot
Definition: DynamicsHelper.h:57
armarx::DynamicsHelper::~DynamicsHelper
~DynamicsHelper()=default
armarx::rtfilters
Definition: AverageFilter.cpp:26
armarx::DynamicsHelper::DynamicsData
Definition: DynamicsHelper.h:45
armarx::DynamicsHelper::DynamicsData::rnsBodies
VirtualRobot::RobotNodeSetPtr rnsBodies
Definition: DynamicsHelper.h:55
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::DynamicsHelper::DynamicsData::rnsJoints
VirtualRobot::RobotNodeSetPtr rnsJoints
Definition: DynamicsHelper.h:55
armarx::DynamicsHelper::dataMap
std::map< VirtualRobot::RobotNodeSetPtr, DynamicsData > dataMap
Definition: DynamicsHelper.h:76
armarx::DynamicsHelper::DynamicsData::q
Eigen::VectorXd q
Definition: DynamicsHelper.h:57
armarx::DynamicsHelper::update
void update(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration)
Definition: DynamicsHelper.cpp:77
armarx::RobotUnit
The RobotUnit class manages a robot and its controllers.
Definition: RobotUnit.h:180
armarx::DynamicsHelper::DynamicsData::accelerationFilter
std::vector< rtfilters::RTFilterBasePtr > accelerationFilter
Definition: DynamicsHelper.h:61
armarx::DynamicsHelper::DynamicsData::tau
Eigen::VectorXd tau
Definition: DynamicsHelper.h:57
armarx::DynamicsHelper::DynamicsData::nodeSensorVec
std::vector< std::pair< VirtualRobot::RobotNodePtr, SensorValue1DoFActuator * > > nodeSensorVec
Definition: DynamicsHelper.h:59
armarx::DynamicsHelper::DynamicsData::DynamicsData
DynamicsData(VirtualRobot::RobotNodeSetPtr rnsJoints, VirtualRobot::RobotNodeSetPtr rnsBodies)
Definition: DynamicsHelper.h:47
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::DynamicsHelper::DynamicsData::dynamics
VirtualRobot::Dynamics dynamics
Definition: DynamicsHelper.h:56
SensorValue1DoFActuator.h
armarx::DynamicsHelper::DynamicsData::qDDot
Eigen::VectorXd qDDot
Definition: DynamicsHelper.h:57
armarx::DynamicsHelper::DynamicsData::tauGravity
Eigen::VectorXd tauGravity
Definition: DynamicsHelper.h:57