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 #include <VirtualRobot/IK/IKSolver.h>
27 #include <VirtualRobot/VirtualRobot.h>
28 
29 #include "../ControlTargets/ControlTarget1DoFActuator.h"
30 #include "../SensorValues/SensorValue1DoFActuator.h"
32 
33 namespace armarx
34 {
35 
36  TYPEDEF_PTRS_HANDLE(NJointTCPController);
37  TYPEDEF_PTRS_HANDLE(NJointTCPControllerConfig);
38 
39  class NJointTCPControllerConfig : virtual public NJointControllerConfig
40  {
41  public:
42  NJointTCPControllerConfig(std::string const& nodeSetName, const std::string& tcpName) :
44  {
45  }
46 
47  const std::string nodeSetName;
48  const std::string tcpName;
49  };
50 
52 
54  {
55  public:
56  float xVel = 0;
57  float yVel = 0;
58  float zVel = 0;
59  float rollVel = 0;
60  float pitchVel = 0;
61  float yawVel = 0;
62  VirtualRobot::IKSolver::CartesianSelection mode = VirtualRobot::IKSolver::All;
63  };
64 
65  /**
66  * @brief The NJointTCPController class
67  * @ingroup Library-RobotUnit-NJointControllers
68  */
70  public NJointControllerWithTripleBuffer<NJointTCPControllerControlData>
71  {
72  public:
73  using ConfigPtrT = NJointTCPControllerConfigPtr;
75  const NJointTCPControllerConfigPtr& config,
76  const VirtualRobot::RobotPtr& r);
77 
78  // NJointControllerInterface interface
79  std::string getClassName(const Ice::Current&) const override;
81  getFunctionDescriptions(const Ice::Current&) const override;
82  void callDescribedFunction(const std::string& name,
83  const StringVariantBaseMap& valueMap,
84  const Ice::Current&) override;
85 
86  // NJointController interface
87  void rtRun(const IceUtil::Time& sensorValuesTimestamp,
88  const IceUtil::Time& timeSinceLastIteration) override;
91  const std::map<std::string, ConstControlDevicePtr>&,
92  const std::map<std::string, ConstSensorDevicePtr>&);
93 
94  static NJointTCPControllerConfigPtr
96 
97  // for TCPControlUnit
98  void setVelocities(float xVel,
99  float yVel,
100  float zVel,
101  float rollVel,
102  float pitchVel,
103  float yawVel,
105  std::string getNodeSetName() const;
106  static ::armarx::WidgetDescription::WidgetSeq createSliders();
107 
108  protected:
109  void rtPreActivateController() override;
110  void rtPostDeactivateController() override;
111 
112  private:
113  std::vector<ControlTarget1DoFActuatorVelocity*> targets;
114  std::vector<const SensorValue1DoFActuatorPosition*> sensors;
115 
116  VirtualRobot::RobotNodePtr tcp;
117  VirtualRobot::DifferentialIKPtr ik;
118 
119  std::string nodeSetName;
120  };
121 
122 } // 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:206
NJointControllerWithTripleBuffer.h
armarx::StringVariantBaseMap
std::map< std::string, VariantBasePtr > StringVariantBaseMap
Definition: ManagedIceObject.h:110
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:123
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:247
armarx::WidgetDescription::StringWidgetDictionary
::std::map<::std::string, ::armarx::WidgetDescription::WidgetPtr > StringWidgetDictionary
Definition: NJointControllerBase.h:70
armarx::NJointTCPController
The NJointTCPController class.
Definition: NJointTCPController.h:69
ProsthesisInterface.values
values
Definition: ProsthesisInterface.py:190
armarx::NJointTCPControllerConfig::nodeSetName
const std::string nodeSetName
Definition: NJointTCPController.h:47
armarx::NJointControllerBase::ConfigPtrT
NJointControllerConfigPtr ConfigPtrT
Definition: NJointControllerBase.h:587
armarx::NJointTCPController::NJointTCPController
NJointTCPController(RobotUnit *prov, const NJointTCPControllerConfigPtr &config, const VirtualRobot::RobotPtr &r)
Definition: NJointTCPController.cpp:178
armarx::NJointTCPControllerControlData::yawVel
float yawVel
Definition: NJointTCPController.h:61
armarx::NJointTCPControllerControlData::pitchVel
float pitchVel
Definition: NJointTCPController.h:60
armarx::NJointTCPControllerControlData::rollVel
float rollVel
Definition: NJointTCPController.h:59
armarx::NJointTCPController::getFunctionDescriptions
WidgetDescription::StringWidgetDictionary getFunctionDescriptions(const Ice::Current &) const override
Definition: NJointTCPController.cpp:237
armarx::NJointTCPController::rtPostDeactivateController
void rtPostDeactivateController() override
This function is called after the controller is deactivated.
Definition: NJointTCPController.cpp:232
IceInternal::Handle
Definition: forward_declarations.h:8
armarx::NJointTCPController::getClassName
std::string getClassName(const Ice::Current &) const override
Definition: NJointTCPController.cpp:44
armarx::NJointTCPControllerControlData
Definition: NJointTCPController.h:53
armarx::NJointTCPControllerControlData::xVel
float xVel
Definition: NJointTCPController.h:56
armarx::NJointTCPControllerConfig::NJointTCPControllerConfig
NJointTCPControllerConfig(std::string const &nodeSetName, const std::string &tcpName)
Definition: NJointTCPController.h:42
armarx::NJointTaskSpaceDMPControllerMode::CartesianSelection
CartesianSelection
Definition: ControllerInterface.ice:34
armarx::NJointTCPController::getNodeSetName
std::string getNodeSetName() const
Definition: NJointTCPController.cpp:226
armarx::NJointTCPControllerControlData::zVel
float zVel
Definition: NJointTCPController.h:58
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:56
armarx::NJointTCPController::createSliders
::armarx::WidgetDescription::WidgetSeq createSliders()
Definition: NJointTCPController.cpp:96
armarx::NJointTCPController::rtPreActivateController
void rtPreActivateController() override
This function is called before the controller is activated.
Definition: NJointTCPController.cpp:50
armarx::NJointTCPControllerControlData::mode
VirtualRobot::IKSolver::CartesianSelection mode
Definition: NJointTCPController.h:62
armarx::NJointTCPControllerConfig::tcpName
const std::string tcpName
Definition: NJointTCPController.h:48
armarx::RobotUnit
The RobotUnit class manages a robot and its controllers.
Definition: RobotUnit.h:180
armarx::NJointTCPControllerConfig
Definition: NJointTCPController.h:39
armarx::NJointTCPController::GenerateConfigFromVariants
static NJointTCPControllerConfigPtr GenerateConfigFromVariants(const StringVariantBaseMap &values)
Definition: NJointTCPController.cpp:172
armarx::NJointTCPControllerControlData::yVel
float yVel
Definition: NJointTCPController.h:57
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:19