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
32
33namespace armarx
34{
35
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,
104 VirtualRobot::IKSolver::CartesianSelection mode);
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
#define TYPEDEF_PTRS_HANDLE(T)
NJointControllerWithTripleBuffer(const NJointTCPControllerControlData &initialCommands=NJointTCPControllerControlData())
NJointTCPControllerConfig(std::string const &nodeSetName, const std::string &tcpName)
VirtualRobot::IKSolver::CartesianSelection mode
The NJointTCPController class.
NJointTCPControllerConfigPtr ConfigPtrT
static WidgetDescription::WidgetPtr GenerateConfigDescription(const VirtualRobot::RobotPtr &, const std::map< std::string, ConstControlDevicePtr > &, const std::map< std::string, ConstSensorDevicePtr > &)
NJointTCPController(RobotUnit *prov, const NJointTCPControllerConfigPtr &config, const VirtualRobot::RobotPtr &r)
WidgetDescription::StringWidgetDictionary getFunctionDescriptions(const Ice::Current &) const override
::armarx::WidgetDescription::WidgetSeq createSliders()
static NJointTCPControllerConfigPtr GenerateConfigFromVariants(const StringVariantBaseMap &values)
void rtPostDeactivateController() override
This function is called after the controller is deactivated.
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
void setVelocities(float xVel, float yVel, float zVel, float rollVel, float pitchVel, float yawVel, VirtualRobot::IKSolver::CartesianSelection mode)
std::string getClassName(const Ice::Current &) const override
void callDescribedFunction(const std::string &name, const StringVariantBaseMap &valueMap, const Ice::Current &) override
void rtPreActivateController() override
This function is called before the controller is activated.
The RobotUnit class manages a robot and its controllers.
Definition RobotUnit.h:192
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
::IceInternal::Handle<::armarx::WidgetDescription::Widget > WidgetPtr
::std::map<::std::string, ::armarx::WidgetDescription::WidgetPtr > StringWidgetDictionary
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::map< std::string, VariantBasePtr > StringVariantBaseMap