MoveJointsToPosition.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <RobotAPI/interface/units/KinematicUnitInterface.h>
7 
8 #include <armarx/control/skills/aron/MoveJointsToPositionParams.aron.generated.h>
10 
12 {
13 
14  /**
15  * @class MoveJoints
16  * @brief MoveJoints-skill to move joints to specified target values using the KinematicUnit
17  *
18  * Sets joint values with the KinematicUnit and waits until target values are reached. Can
19  * simulate trajectory when in simulation (otherwise trajectories from joint value updates through
20  * the KinematicUnit are not simulated).
21  */
23  public ::armarx::skills::SimpleSpecializedSkill<arondto::MoveJointsToPositionParams>
24  {
25 
26  public:
27  struct Services
28  {
29  ::armarx::KinematicUnitInterfacePrx kinematicUnit;
31  std::string robotName;
32  };
33 
34  static ::armarx::skills::SkillDescription
36  {
37  ParamType defaults;
38  defaults.timeoutMS = 1000;
39 
40  return ::armarx::skills::SkillDescription{
42  .description = "Moves joints to specified target values using the KinematicUnit",
43  .rootProfileDefaults = defaults.toAron(),
44  .timeout = ::armarx::Duration::Minutes(1),
45  .parametersType = ParamType::ToAronType()};
46  }
47 
48  MoveJointsToPosition(const Services&);
49 
50 
51  private:
52  ::armarx::skills::Skill::MainResult main(const SpecializedMainInput& in) override;
53  ::armarx::skills::Skill::ExitResult exit(const SpecializedExitInput& in) override;
54 
55  std::map<std::string, float>
56  filterJointTargetValues(const NameValueMap& jointsTargetValues,
57  const std::vector<std::string>& disabledJoints) const;
58 
59  bool checkJointsTargetValuesValid(const NameValueMap& jointsTargetValues,
60  const VirtualRobot::RobotPtr& virtualRobot);
61 
62  void switchControlMode(const NameValueMap& jointsTargetValues,
63  const armarx::ControlMode controlMode);
64 
65  void moveJoints(const NameValueMap& jointsTargetValues,
66  float accuracyDefault,
67  const NameValueMap& accuracyOverride,
68  float timeoutDefault,
69  NameValueMap timeoutOverride,
70  const VirtualRobot::RobotPtr& virtualRobot);
71 
72  void moveJointsSimulation(const NameValueMap& jointsTargetValues,
73  float speedDefault,
74  const NameValueMap& speedOverride,
75  const VirtualRobot::RobotPtr& virtualRobot);
76 
77  private:
78  Services srv_;
79  };
80 
81 } // namespace armarx::control::skills::skills
armarx::control::skills::skills::MoveJointsToPosition
Definition: MoveJointsToPosition.h:22
armarx::control::skills::skills::MoveJointsToPosition::Services::virtualRobotReader
::armarx::armem::robot_state::VirtualRobotReader virtualRobotReader
Definition: MoveJointsToPosition.h:30
armarx::armem::robot_state::VirtualRobotReader
The VirtualRobotReader class.
Definition: VirtualRobotReader.h:40
armarx::skills::SimpleSpecializedSkill< arondto::MoveJointsToPositionParams >::ParamType
arondto::MoveJointsToPositionParams ParamType
Definition: SimpleSpecializedSkill.h:14
armarx::skills::SkillID::skillName
std::string skillName
Definition: SkillID.h:60
armarx::control::skills::constants::MOVE_JOINTS_TO_POSITION_SKILL_NAME
std::string MOVE_JOINTS_TO_POSITION_SKILL_NAME
Definition: constants.cpp:8
armarx::control::skills::skills::MoveJointsToPosition::Services::kinematicUnit
::armarx::KinematicUnitInterfacePrx kinematicUnit
Definition: MoveJointsToPosition.h:29
SimpleSpecializedSkill.h
armarx::skills::SimpleSpecializedSkill< arondto::MoveJointsToPositionParams >::exit
Skill::ExitResult exit() final
Definition: SimpleSpecializedSkill.h:81
constants.h
armarx::control::skills::skills::MoveJointsToPosition::Services::robotName
std::string robotName
Definition: MoveJointsToPosition.h:31
armarx::skills::SkillDescription::skillId
SkillID skillId
Definition: SkillDescription.h:20
armarx::skills::SimpleSpecializedSkill
Definition: SimpleSpecializedSkill.h:10
armarx::control::skills::skills::MoveJointsToPosition::MoveJointsToPosition
MoveJointsToPosition(const Services &)
Definition: MoveJointsToPosition.cpp:8
VirtualRobotReader.h
armarx::core::time::Duration::Minutes
static Duration Minutes(std::int64_t minutes)
Constructs a duration in minutes.
Definition: Duration.cpp:111
armarx::skills::Skill::MainResult
A result struct for th main method of a skill.
Definition: Skill.h:48
armarx::skills::Skill::ExitResult
A result struct for skill exit function.
Definition: Skill.h:55
armarx::control::njoint_controller::platform::platform_follower_controller::NameValueMap
std::map< std::string, float > NameValueMap
Definition: PlatformFollowerController.h:91
armarx::skills::SimpleSpecializedSkill< arondto::MoveJointsToPositionParams >::main
Skill::MainResult main() final
Definition: SimpleSpecializedSkill.h:71
armarx::control::skills::skills
Definition: ExecuteTrajectory.cpp:18
armarx::control::skills::skills::MoveJointsToPosition::Services
Definition: MoveJointsToPosition.h:27
MemoryNameSystem.h
armarx::control::skills::skills::MoveJointsToPosition::GetSkillDescription
::armarx::skills::SkillDescription GetSkillDescription()
Definition: MoveJointsToPosition.h:35
VirtualRobot::RobotPtr
std::shared_ptr< class Robot > RobotPtr
Definition: Bus.h:18