NJointTCPController.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 2017
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #pragma once
25 
26 
27 #include <VirtualRobot/IK/DifferentialIK.h>
28 #include <VirtualRobot/Robot.h>
29 
30 #include "../ControlTargets/ControlTarget1DoFActuator.h"
31 #include "../SensorValues/SensorValue1DoFActuator.h"
33 
34 namespace armarx
35 {
36 
37  TYPEDEF_PTRS_HANDLE(NJointTCPController);
38  TYPEDEF_PTRS_HANDLE(NJointTCPControllerConfig);
39 
40  class NJointTCPControllerConfig : virtual public NJointControllerConfig
41  {
42  public:
43  NJointTCPControllerConfig(std::string const& nodeSetName, const std::string& tcpName) :
45  {
46  }
47 
48  const std::string nodeSetName;
49  const std::string tcpName;
50  };
51 
53 
55  {
56  public:
57  float xVel = 0;
58  float yVel = 0;
59  float zVel = 0;
60  float rollVel = 0;
61  float pitchVel = 0;
62  float yawVel = 0;
63  VirtualRobot::IKSolver::CartesianSelection mode = VirtualRobot::IKSolver::All;
64  };
65 
66  /**
67  * @brief The NJointTCPController class
68  * @ingroup Library-RobotUnit-NJointControllers
69  */
71  public NJointControllerWithTripleBuffer<NJointTCPControllerControlData>
72  {
73  public:
74  using ConfigPtrT = NJointTCPControllerConfigPtr;
76  const NJointTCPControllerConfigPtr& config,
77  const VirtualRobot::RobotPtr& r);
78 
79  // NJointControllerInterface interface
80  std::string getClassName(const Ice::Current&) const override;
82  getFunctionDescriptions(const Ice::Current&) const override;
83  void callDescribedFunction(const std::string& name,
84  const StringVariantBaseMap& valueMap,
85  const Ice::Current&) override;
86 
87  // NJointController interface
88  void rtRun(const IceUtil::Time& sensorValuesTimestamp,
89  const IceUtil::Time& timeSinceLastIteration) override;
92  const std::map<std::string, ConstControlDevicePtr>&,
93  const std::map<std::string, ConstSensorDevicePtr>&);
94 
95  static NJointTCPControllerConfigPtr
97 
98  // for TCPControlUnit
99  void setVelocities(float xVel,
100  float yVel,
101  float zVel,
102  float rollVel,
103  float pitchVel,
104  float yawVel,
106  std::string getNodeSetName() const;
107  static ::armarx::WidgetDescription::WidgetSeq createSliders();
108 
109  protected:
110  void rtPreActivateController() override;
111  void rtPostDeactivateController() override;
112 
113  private:
114  std::vector<ControlTarget1DoFActuatorVelocity*> targets;
115  std::vector<const SensorValue1DoFActuatorPosition*> sensors;
116 
117  VirtualRobot::RobotNodePtr tcp;
118  VirtualRobot::DifferentialIKPtr ik;
119 
120  std::string nodeSetName;
121  };
122 
123 } // namespace armarx
armarx::NJointTCPController::setVelocities
void setVelocities(float xVel, float yVel, float zVel, float rollVel, float pitchVel, float yawVel, VirtualRobot::IKSolver::CartesianSelection mode)
Definition: NJointTCPController.cpp:204
NJointControllerWithTripleBuffer.h
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:111
armarx::TYPEDEF_PTRS_HANDLE
TYPEDEF_PTRS_HANDLE(NJointCartesianNaturalPositionController)
armarx::NJointTCPController::GenerateConfigDescription
static WidgetDescription::WidgetPtr GenerateConfigDescription(const VirtualRobot::RobotPtr &, const std::map< std::string, ConstControlDevicePtr > &, const std::map< std::string, ConstSensorDevicePtr > &)
Definition: NJointTCPController.cpp:121
armarx::NJointControllerWithTripleBuffer
Definition: NJointControllerWithTripleBuffer.h:10
armarx::NJointTCPController::callDescribedFunction
void callDescribedFunction(const std::string &name, const StringVariantBaseMap &valueMap, const Ice::Current &) override
Definition: NJointTCPController.cpp:245
armarx::WidgetDescription::StringWidgetDictionary
::std::map<::std::string, ::armarx::WidgetDescription::WidgetPtr > StringWidgetDictionary
Definition: NJointControllerBase.h:69
armarx::NJointTCPController
The NJointTCPController class.
Definition: NJointTCPController.h:70
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::NJointTCPControllerConfig::nodeSetName
const std::string nodeSetName
Definition: NJointTCPController.h:48
armarx::NJointControllerBase::ConfigPtrT
NJointControllerConfigPtr ConfigPtrT
Definition: NJointControllerBase.h:586
armarx::NJointTCPController::NJointTCPController
NJointTCPController(RobotUnit *prov, const NJointTCPControllerConfigPtr &config, const VirtualRobot::RobotPtr &r)
Definition: NJointTCPController.cpp:176
armarx::NJointTCPControllerControlData::yawVel
float yawVel
Definition: NJointTCPController.h:62
armarx::NJointTCPControllerControlData::pitchVel
float pitchVel
Definition: NJointTCPController.h:61
armarx::NJointTCPControllerControlData::rollVel
float rollVel
Definition: NJointTCPController.h:60
armarx::NJointTCPController::getFunctionDescriptions
WidgetDescription::StringWidgetDictionary getFunctionDescriptions(const Ice::Current &) const override
Definition: NJointTCPController.cpp:235
armarx::NJointTCPController::rtPostDeactivateController
void rtPostDeactivateController() override
This function is called after the controller is deactivated.
Definition: NJointTCPController.cpp:230
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::NJointTCPController::getClassName
std::string getClassName(const Ice::Current &) const override
Definition: NJointTCPController.cpp:42
armarx::NJointTCPControllerControlData
Definition: NJointTCPController.h:54
armarx::NJointTCPControllerControlData::xVel
float xVel
Definition: NJointTCPController.h:57
armarx::NJointTCPControllerConfig::NJointTCPControllerConfig
NJointTCPControllerConfig(std::string const &nodeSetName, const std::string &tcpName)
Definition: NJointTCPController.h:43
armarx::NJointTaskSpaceDMPControllerMode::CartesianSelection
CartesianSelection
Definition: ControllerInterface.ice:34
armarx::NJointTCPController::getNodeSetName
std::string getNodeSetName() const
Definition: NJointTCPController.cpp:224
armarx::NJointTCPControllerControlData::zVel
float zVel
Definition: NJointTCPController.h:59
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
armarx::NJointTCPController::rtRun
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
Definition: NJointTCPController.cpp:54
armarx::NJointTCPController::createSliders
::armarx::WidgetDescription::WidgetSeq createSliders()
Definition: NJointTCPController.cpp:94
armarx::NJointTCPController::rtPreActivateController
void rtPreActivateController() override
This function is called before the controller is activated.
Definition: NJointTCPController.cpp:48
armarx::NJointTCPControllerControlData::mode
VirtualRobot::IKSolver::CartesianSelection mode
Definition: NJointTCPController.h:63
armarx::NJointTCPControllerConfig::tcpName
const std::string tcpName
Definition: NJointTCPController.h:49
armarx::RobotUnit
The RobotUnit class manages a robot and its controllers.
Definition: RobotUnit.h:180
armarx::NJointTCPControllerConfig
Definition: NJointTCPController.h:40
armarx::NJointTCPController::GenerateConfigFromVariants
static NJointTCPControllerConfigPtr GenerateConfigFromVariants(const StringVariantBaseMap &values)
Definition: NJointTCPController.cpp:170
armarx::NJointTCPControllerControlData::yVel
float yVel
Definition: NJointTCPController.h:58
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18