JointControlSkill.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @author Fabian Reister ( fabian dot reister at kit dot edu )
17  * @date 2021
18  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
19  * GNU General Public License
20  */
21 
22 #pragma once
23 
24 // STD/STL
25 #include <string>
26 
27 // ArmarX
29 
30 // RobotAPI
31 #include <RobotAPI/libraries/skills/provider/PeriodicSimpleSpecializedSkill.h>
34 
35 // Mixins
37 
38 // Proxies
39 #include <RobotAPI/interface/units/KinematicUnitInterface.h>
40 
41 // ArmarX
44 
45 namespace armarx::skills
46 {
48  {
49  // Properties
50  KinematicUnitInterfacePrx kinematicUnitPrx;
51 
52  void defineProperties(const armarx::PropertyDefinitionsPtr& defs, const std::string& prefix) final
53  {
54  defs->component(kinematicUnitPrx, "KinematicUnitName", prefix + "KinematicUnitInterfaceName");
55  }
56  };
57 
59  {
60  public:
62  mns(mns),
63  context(c)
64  {
65  };
66 
67  protected:
68  TerminatedSkillStatus stopJointMovement(const std::vector<std::string>& joints)
69  {
70  std::map<std::string, float> zeroVel;
71  for (const auto& p : joints)
72  {
73  zeroVel[p] = 0.0f;
74  }
75  context.kinematicUnitPrx->setJointVelocities(zeroVel);
76  std::this_thread::sleep_for(std::chrono::milliseconds(100));
78  }
79 
80  protected:
82 
84  };
85 }
armarx::skills::JointControlSkill
Definition: JointControlSkill.h:58
armarx::skills::TerminatedSkillStatus
TerminatedSkillStatus
Definition: SkillStatusUpdate.h:39
armarx::skills::TerminatedSkillStatus::Succeeded
@ Succeeded
armarx::skills
This file is part of ArmarX.
Definition: PeriodicUpdateWidget.cpp:11
armarx::skills::JointControlSkill::JointControlSkill
JointControlSkill(armem::client::MemoryNameSystem &mns, JointControlSkillContext &c)
Definition: JointControlSkill.h:61
armarx::skills::JointControlSkill::mns
armem::client::MemoryNameSystem & mns
Definition: JointControlSkill.h:81
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
armarx::skills::JointControlSkillContext::defineProperties
void defineProperties(const armarx::PropertyDefinitionsPtr &defs, const std::string &prefix) final
Definition: JointControlSkill.h:52
SimpleSpecializedSkill.h
armarx::skills::SkillContext
Definition: SkillContext.h:13
armarx::skills::JointControlSkillContext
Definition: JointControlSkill.h:47
All.h
Component.h
SkillContext.h
IceUtil::Handle< class PropertyDefinitionContainer >
armarx::skills::JointControlSkill::stopJointMovement
TerminatedSkillStatus stopJointMovement(const std::vector< std::string > &joints)
Definition: JointControlSkill.h:68
armarx::skills::JointControlSkillContext::kinematicUnitPrx
KinematicUnitInterfacePrx kinematicUnitPrx
Definition: JointControlSkill.h:50
armarx::armem::client::MemoryNameSystem
The memory name system (MNS) client.
Definition: MemoryNameSystem.h:69
MemoryNameSystem.h
armarx::skills::JointControlSkill::context
JointControlSkillContext & context
Definition: JointControlSkill.h:83