%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Introduction}
	
	{The world of robotics is probably one of the most engaging and challenging. Since the beginning of the mankind, the dream was to create a fully autonomous robot that could be as similar as possible to the human being. This robot would be able to help humans in difficult tasks or in the fulfillment of their needs. Despite all the work and research, this dream is far from being achieved. In particular, balance and biped locomotion remain open research problems. The locomotion of full-body humanoid robots is a complex problem due, to the high number of degrees-of-freedom (\acs{DOF}) to control, the lack of precise models and the non-closed form for robot control.\paragraph{} From a software point of view, the main difficulty is to pre-program sophisticated \linebreak motions for a broad range of tasks the robot is expected to perform. On the other side of the spectrum, teaching robots appears as a crucial demand in order to automate manual programming. In this context, robot Learning from Demonstration (\acs{LfD}) is a powerful approach in which a robot acquires training examples from human demonstrations. These demonstration examples can be obtained in many different ways, each one with their own advantages and weaknesses. For example, recording state-action pairs whilst the robot is tele-operated by a human supervisor provides the most direct method of information transfer, but it is rarely used with many \acs{DOF} since the movements may be difficult to control via a joystick. A comprehensive survey of \acs{LfD} techniques applied for robot control can be found in \cite{BrennaD.Argall}.\paragraph{} This dissertation work was developed within the scope of the Humanoid Project at the University of Aveiro (\acs{PHUA}), joining since 2004 the Department of Mechanical Engineering and the Department of Electronics, Telecommunications and Informatics. The main objective has been the development of highly integrated humanoid platforms based on standard components and open software for studies in locomotion, navigation, learning and perception for autonomous humanoids.}
		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%	
	\clearpage
	\section{Motivation}
	{A topic that has not yet been much addressed in the existent \acs{LfD} approaches is how to exploit co-adaptation between the human teacher and the learner robot. Haptic tele-operation seems to be a promising approach for teaching and sensing in which the human operator provides functional guidance and corrections, while being aware of what the robot is doing. The motivation for the development of such bidirectional interface is to understand the role of haptic feedback to improve the process of transferring motion skills to humanoid robots, from teaching new skills to achieve optimization goals. In this line of thought, this dissertation presents a new approach for teaching motion skills to humanoid robots that relies on the physical interaction between human and robot through haptic feedback. In this sense, the proposed framework, referred to as Tele-kinesthetic Teaching \cite{PaperCruz}, enters in the domain of haptic tele-operation. }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	
	\section{Objectives}
	
	{The main goal of this dissertation is to develop an haptic interface for the tele-operation of a real humanoid robot using a Phantom Omni device. This task will be dedicated to the development of a set of computational tools allowing the human operator, with the help of force feedback, to guide, correct or optimize the execution of a given task, interactively and gradually. At this stage, the haptic control involves simple postural tasks, such as a crouching motion and balance on two legs subject to external perturbations on the support surface. An interface to control the humanoid robot using a haptic device with force feedback has already been tested \cite{Emilio}. This interface allowed controlling the humanoid robot in simple tasks, such as lateral and vertical movements. The force feedback was only used as output variable for analyses purposes, but without any interference in the executed task.
	
	 \paragraph{} The second objective is to gain insight on the fundamental factors that will contribute to improve the overall system's performance through the repetition of a set of experiments over time. In order to ensure an intuitive and natural interaction, it will be necessary to define the best way to map the \acs{DOF}s of the haptic device to those of the robotic system. Equally important is to assure that the commands sent to the robot reflect the human intention. Another dimension of the interface design is to adopt the best strategies for translating information about the state of the robot into force feedback (the force rendering problem). \paragraph{} Finally, some demonstration examples obtained with the assistance of a human \linebreak operator will be provided. After a training phase, where the user acquires skills in performing the demonstrations, the robot must collect and record all the sensory information (\textit{e.g.,} joint positions, ground reaction forces) and the commands guiding the execution of a specific task.}	

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%	
	
	\section{State of the Art}
	{This dissertation is based on two essential concepts: (1) the recording of demonstration examples (\textit{i.e.}, state-action pairs) obtained whilst the robot is tele-operated by a human teacher, and (2) the use of haptic feedback to provide the human teacher with state feedback on the robot's performance. This section will describe some representative research works on learning from demonstration and haptic control.}


		\subsection*{Learning by Demonstration}
	{ In learning from demonstration, training robots and obtaining the teaching examples can be made in many different ways, namely kinaesthetic teaching, tele-operation and observational learning.}
	{\paragraph{} In the kinaesthetic teaching method, also known as tactile teaching, the human operator physically guides the robot through the desired task \cite{Akg2011}. In \cite{Kormushev2011a}, an approach using kinaesthetic teaching is presented where the operator controls the humanoid robot by moving directly its arm. This experiment is repeated several times during the demonstration phase and, using the recorded data, the humanoid robot is able to perceive the desired task and reproduce it without any external help. This method has the advantage of avoiding the \linebreak constraints created by the correspondence map between the controller and the robot. Figure \ref{Kine} shows an example of kinaesthetic teaching.}
	
\begin{figure}[H]
		  \centering 
		  \includegraphics[width=0.45\textwidth]{imgs/Chapter5/Novos/Kinaesthetic1.png}
		 \caption{Learning by Kinaesthetic example \cite{Kormushev2011a}.}
		  \label{Kine}
		\end{figure}	
	
	{\paragraph{} Tele-operation is a learning method where the human operator controls the robot using an input device (\textit{e.g.,a joystick or a haptic device}. An example of this technique is found in \cite{Akg2011}. In this research, the operator uses the haptic device to control the movement of the robotic arm and the buttons to open or close the gripper of the robot. In the learning phase, the operator uses the joystick to perform the intend tasks and collect data to teach the robot in the following phase. Similarly to the kinaesthetic teaching this type of demonstration has the problem of mapping between the joystick and robot workspaces. In cases of high \acs{DOF}'s, this can be a serious and difficult problem to solve. In Figure \ref{Tele} an example o tele-operation teaching is shown.}
	
	\begin{figure}[H]
		  \centering 
		  \includegraphics[width=0.4\textwidth]{imgs/Chapter1/teleop.png}
		 \caption{Teleoperating Example\cite{Akg2011}.}
		  \label{Tele}
		\end{figure}
		
	{\paragraph{} In observational learning, also known as imitating teaching, the human exemplifies a certain task by showing the various steps required to perform it \cite{AcostaCalderon2010a}. The robot will imitate the human operator and perform the task by itself. This demonstration method allows the robot to generalize and apply the learned movement for different tasks. In Figure \ref{Imi} an example of a demonstration using the observation method is shown.}
	
	\begin{figure}[H]
		  \centering 
		  \includegraphics[width=0.5\textwidth]{imgs/Chapter1/imitating.jpg}
		 \caption{Observing Example \cite{Lab}.}
		  \label{Imi}
		\end{figure}	

	 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\subsection*{Haptic Control}
	{Although the use of haptic devices is recent, they begin to play a crucial role in many research areas, such as robot tele-operation (\textit{e.g.,} in rescue missions, handling dangerous materials, etc), medicine (\textit{e.g.,} robotic surgery, medical devices, etc) and virtual reality. }
	
	{\paragraph{}Medicine is probably the area where the use of haptic devices is further advanced. There are already several prototypes that perform surgeries using this type of devices \cite{Zeus}\cite{Vinci}, but only recently force feedback was introduced. In \cite{Adhami}, the system consists of a master-slave architecture where the movement done by the robot (slave) is controlled by an operator via a surgeon console (master). This technique allows to perform complex operations. The use of force feedback technology can help and improve the doctor's performance in a surgery. This technique brought unimaginable progress in this field, since the doctors can act according to what they feel (the force feedback is generated by the impact and proximity of the robot's end-effector to the tissue). Thus, the success of the surgery can be improved and tissue damage can be prevented. It is now possible to have the best of both worlds: the precision provided by the use of an arm/robotic operator to do the operation, and the control of the operation done by an expert doctor feeling like he was actually in contact with the patient's body. An example of haptic surgery can be seen in Figure\ref{Da}.}
	
	\begin{figure}[H]
	  \centering 
	 \includegraphics[width=0.40\textwidth]{imgs/Chapter1/Da-Vinci.jpg}
		 \caption{Haptic surgery example\cite{Vinci}.}
		  \label{Da}
		\end{figure}
		 
{\paragraph{}A different kind of haptic joystick is presented in \cite{Hand}, showing the importance of force feedback. Using a joystick to control a robot shows importance in imminent danger or for example, to do complex and difficult situation/operations. In this case, we are in the presence of a DataGlove with sensors that retrieve information to control the robot. In the robotic arm, there are a set of sensors which, when pressed, transmit information to the glove wore by the operator. This information is then converted into force and applied in the operator. Because of that it is possible for the human operator to control robotic arm and hand, "feeling" all the movement, including what the robot grabs. A better performance can be obtained and the operator does not need to be in the field to touch or grab equipment. Figure \ref{Glove} shows an example of the interface used. }
\begin{figure}[H]
		  \centering 
		  \includegraphics[width=0.4\textwidth]{imgs/Chapter1/DataGlove.png}
		 \caption{DataGlove.}
		  \label{Glove}
		\end{figure}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%	
	{\paragraph{} The objective of work in \cite{DanielGermann} is to control a four-legged robot using a joystick with force feedback. The robot \acs{ALDURO} consists of a platform with a cabin for the operator, a power plant and four legs. With the joystick, the robot can be controlled by two different ways: position control and speed control. The force feedback is used to achieve two purposes:}
	\begin{itemize}
	\item To help the operator to position the joystick
	\item To provide the workspace information, \textit{i.e}, when the robot is close to the limit one counter force is generated.
\end{itemize}	
{\paragraph{} The use of force feedback protects the robot of moving beyond its limits and help to control it \cite{DanielGermann}. The \acs{ALDURO} robot can be seen in Figure \ref{ALDURO robot}. }
	
\begin{figure}[H]
		  \centering 
		  \includegraphics[width=0.3\textwidth]{imgs/Chapter1/Ald.png}
		 \caption{ALDURO Robot \cite{DanielGermann}.}
		  \label{ALDURO robot}
		\end{figure}
		
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%	
	
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%	
	
	\section{Structure of the document}
{The dissertation is organized as follows: Chapter 2 introduces the hardware and software technologies used to implement the haptic tele-operation system. Chapter 3 presents the data processing algorithms used to transform human's commands into robot's actions and the strategies for translating information about the state of the robot into force feedback. Chapter 4 describes the software architecture of the haptic interface, namely the different ROS-based processes and how they interact with each other. Chapter 5 presents the experiments conducted to demonstrate the validity of the haptic feedback for teaching balance skills in humanoid robots. Finally,  chapter 6 discusses the conclusions reached in this dissertation and proposes suggestions for future work.}