Pointing.h
Go to the documentation of this file.
1#pragma once
2
3#include <VirtualRobot/VirtualRobot.h>
4
6#include <RobotAPI/interface/components/TrajectoryPlayerInterface.h>
10
11#include "Side.h"
12
14{
15 class PointingException : public armarx::LocalException
16 {
17 };
18
20 {
21 };
22
26} // namespace armarx::exceptions::local
27
29{
30
31 /**
32 * @brief Implementation of a 'Pointing'-gesture.
33 *
34 * Lets the robot point somewhere by aligning the forearm with the passed target, aligning the
35 * wrist, and setting a hand shape.
36 *
37 * @ingroup Library-pointing
38 */
39 class Pointing : virtual public armarx::Logging
40 {
41 public:
49
51 {
52 /** Side of the arm to point with. */
54
55 /** Position to point at. */
57
58 /** Name of the hand preshape to use. If none is provided, the hand will be ignored. */
59 std::optional<std::string> handShape;
60
61 /** Maximum velocity */
63
64 /** Maximum acceleration */
66 };
67
68 public:
69 Pointing(const Remote& remote);
70
71 /**
72 * @brief Executes the pointing gesture.
73 *
74 * Let's the robot point at the passed target. Blocks unitl the target configuration is
75 * reached or the execution is aborted with @ref abort.
76 *
77 * @param params Parameterization of the pointing gesture.
78 *
79 * @throws armarx::exceptions::local::PointingFailedException Thrown if the pointing gesture
80 * could not be executed.
81 * @throws armarx::exceptions::local::PointingAbortedException Thrown when the execution is
82 * aborted with @ref abort() before reaching the target configuration.
83 */
84 void execute(const Parameters params);
85
86 /**
87 * @brief Aborts a running execution.
88 */
89 void abort();
90
91
92 private:
93 VirtualRobot::RobotPtr getRobot();
94
95 Eigen::Vector3f toGlobal(const armarx::FramedPosition&, VirtualRobot::RobotPtr);
96
97 void visualizeTarget(const Eigen::Vector3f& target);
98
100 computeArmTrajectory(VirtualRobot::RobotPtr robot, Side side, Eigen::Vector3f target);
101
102 void
103 addWristTrajectory(VirtualRobot::RobotPtr robot, Side side, armarx::TrajectoryPtr traj);
104
105 std::map<std::string, float>
106 getShapeJointValues(VirtualRobot::RobotPtr robot, Side side, const std::string& shapeName);
107
108 void addHandTrajectory(VirtualRobot::RobotPtr robot,
110 const std::map<std::string, float>& shapeJointValues);
111
112 void playTrajectory(armarx::TrajectoryPtr traj);
113
114 private:
115 Remote remote_;
116 std::atomic_bool aborted;
117 };
118
119} // namespace armarx::control::pointing::core
The FramedPosition class.
Definition FramedPose.h:158
Base Class for all Logging classes.
Definition Logging.h:240
The memory name system (MNS) client.
void execute(const Parameters params)
Executes the pointing gesture.
Definition Pointing.cpp:21
void abort()
Aborts a running execution.
Definition Pointing.cpp:53
Side
Describes the side of an arm.
Definition Side.h:11
std::shared_ptr< class Robot > RobotPtr
Definition Bus.h:19
IceInternal::Handle< Trajectory > TrajectoryPtr
Definition Trajectory.h:52
Side side
Side of the arm to point with.
Definition Pointing.h:53
armarx::FramedPosition target
Position to point at.
Definition Pointing.h:56
std::optional< std::string > handShape
Name of the hand preshape to use.
Definition Pointing.h:59
armarx::armem::client::MemoryNameSystem & memoryNameSystem
Definition Pointing.h:46
armarx::TrajectoryPlayerInterfacePrx trajectoryPlayer
Definition Pointing.h:47