## 5 Method Design  
The core functionality of the proposed framework follows specific consecutive steps. The operator first performs a pointing gesture, pointing to the particular location in the (planar) workspace of the robot. Then, the robot computes the specified location defined by the planar surface and the half-line formed by the operator's joints. When the operator is satisfied with the pointed place, he performs a command gesture, triggering the signal to move the robot's end effector to the desired location. The whole process is illustrated in Figure 5. The half-line is defined by the direction of the index finger, as it is the most common way to represent a pointing gesture. The following command gesture was specifically designed to be performed naturally, fluently connecting with the previous gesture while not significantly influencing the pointing precision. The command gesture is achieved by extending the thumb, forming a so-called \"pistol\" gesture. Both gestures are depicted in Figure 6. Custom ROS packages and nodes were created for gesture recognition and intersection computation. The ROS-enabled machine connected to the robotic arm manages these nodes, ensuring proper communication between the individual parts of the whole application. The method's architecture in ROS framework is depicted in Figure 7. The flowchart of the method's process is in Figure 8. The most prominent geometrical features for the mathematical description of the concept are illustrated in Figure 9. The global coordinate system G defines the planar ground surface \(\pi\). Figure 4: Coordinate system of the LMC. Figure 3: Visualization of detected hand joints. The Leap Motion sensor determines the position of the joints of the human hand in its coordinate system \(L\); furthermore, the robotic manipulator operates in its coordinate system \(R\). The unification of those coordinate systems is vital to obtain points A and B coordinates defining the half-line \(p\), which ultimately determines the coordinates of intersection \(I\). Figure 5: Process of controlling the robot via pointing gestures. 1—The operator points to a location. 2—The operator performs “pistol” gesture. 3—The robot’s TCP moves to the appointed location. Figure 6: Two basic gestures used to interact with the system. Figure 7: The package architecture of the method in ROS. All of the calculations are done in the global coordinate system \(G\). Hence, the following homogeneous transformations between \(R\) and \(G\), \(L\), and \(G\) are defined:  
\[ \begin{pmatrix}X_{G}\\ Y_{G}\\ Z_{G}\\ 1\end{pmatrix} = \begin{pmatrix}1&0&0&d_{x}\\ 0&\cos\alpha&-\sin\alpha&d_{y}\\ 0&\sin\alpha&\cos\alpha&d_{z}\\ 0&0&0&1\end{pmatrix} \cdot \begin{pmatrix}X_{L}\\ Y_{L}\\ Z_{L}\\ 1\end{pmatrix}  \tag{1}\] \[ \begin{pmatrix}X_{G}\\ Y_{G}\\ Z_{G}\\ 1\end{pmatrix} = \begin{pmatrix}0&\cos\alpha&-\sin\alpha&d_{x}\\ 0&\sin\alpha&\cos\alpha&d_{y}\\ 0&0&1&0\\ 0&0&0&1\end{pmatrix} \cdot \begin{pmatrix}X_{R}\\ Y_{R}\\ Z_{R}\\ 1\end{pmatrix} \]  
Analytical geometry and vector algebra are used to calculate the desired coordinates. The data acquired from the Leap Motion sensor are transformed based on Equation (1). The points and vectors used in the calculation are illustrated in Figure 10.  
Figure 8: State machine flowchart of the method. First, the direction of the vector \(\vec{v}\) defined by points A and B needs to be found. Vector \(\vec{v}\) is calculated by subtracting coordinates of point \(A\) from point \(B\) (positions of index finger joints). \[\vec{v}=B-A \tag{2}\]  
The direction of vector \(\vec{v}\) is calculated by dividing the coordinates of vector \(\vec{v}\) with its magnitude. \[\hat{v}=\frac{\vec{v}}{||\vec{v}||} \tag{3}\]  
Figure 10: Extraction of fundamental geometrical features. Figure 9: The abstract overview of the method. Now, it is possible to define the half-line \(p\) by parametric equations. \[ \begin{split} x&=x_{0}+\hat{v_{1}}\times t\\ y&=y_{0}+\hat{v_{2}}\times t\\ z&=z_{0}+\hat{v_{3}}\times t\end{split}  \tag{4}\]  
where \(t\) is the parameter of \(p\).