scieee AI-readable full text Open interactive document viewer

Control of an anthropomorphic robotic hand for grasping and manipulation tasks

Pujol Closa, Marina

Abstract

This project focuses on the development of a robust software solution for controlling the Allegro anthropomorphic robotic hand in robotic grasping and manipulation tasks. The aim is to en- hance the hand’s capabilities through advanced control algorithms and integrate tactile sensors to enable force-controlled grasps. The developed software, written in C++ and integrated with the Robot Operating System (ROS) 2 3 , supports both real-world and simulated environments. In this work, the Allegro Hand’s hardware is extensively studied, including its kinematics, joint limitations, and communication protocols. The software package includes forward and inverse kinematics for precise finger control and supports multiple versions of the Allegro Hand. Addi- tionally, a ROS 2 package was developed to integrate the hand with other robotic systems, such as the Mobile Anthropomorphic Dual-Arm Robot (MADAR), and to utilize tactile feedback from Weiss sensors for advanced grasping techniques. The software has been tested across four different versions of the Allegro Hand, demonstrating its ability to accurately control the hand’s movements. The results show significant improve- ments in grasping precision and adaptability, making the software a valuable tool for both re- search and practical applications in robotic manipulation.

Full text

Treball de Fi de Màster Màster en Automàtica i Robòtica (MUAR) Control of an anthropomorphic robotic hand for grasping and manipulation tasks REPORT Autor/a: Marina Pujol Closa Director/a: Leopold Palomo Avellaneda Ponent: Joan Rosell Gratacos Convocatòria: September 2024 Escola Tècnica Superior d’Enginyeria Industrial de Barcelona Page 2 Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 3 Resum Aquest projecte se centra en el desenvolupament d’una solució de programari robusta per controlar la mà robòtica antropomòrfica Allegro en tasques de manipulació i prensió robòtics. L’objectiu és millorar les capacitats de la mà mitjançant algorismes de control avançats i integrar sensors tàctils per permetre fer prensió controlada per força. El programari desenvolupat, escrit en C++ i integrat amb el Sistema Operatiu per a Robots (ROS) 2 1, és compatible tant amb entorns reals com simulats. En aquest treball s’estudia exhaustivament la maquinaria de la mà Allegro, incloent-hi la seva cinemàtica, les limitacions de les articulacions i els protocols de comunicació. El paquet de programari inclou cinemàtica directa i inversa per a un control precís dels dits i és compatible amb diverses versions de la mà Allegro. A més, es desenvolupa un paquet en ROS 2 per integrar la mà amb altres sistemes robòtics, com el robot Mobile Anthropomorphic Dual-Arm Robot (MADAR), i utilitzar la informació dels sensors tàctils Weiss per a tècniques avançades de prensió. El programari s’ha provat en quatre versions diferents de la mà Allegro, demostrant la seva capacitat per controlar amb precisió els moviments de la mà. Els resultats mostren millores significatives en la precisió i adaptabilitat de la prensió, convertint el programari en una eina valuosa tant per a la recerca com per a aplicacions pràctiques en manipulació robòtica. 1ROS 1 és compatible fins Ubuntu 20.04. La comunitat robòtica està migrant a ROS 2. ROS 2 Humble s’ha utilitzat en aquest projecte. Page 4 Resumen Este proyecto se centra en el desarrollo de una solución de software robusta para controlar la mano robótica antropomórfica Allegro en tareas de agarre y manipulación robótica. El objetivo es mejorar las capacidades de la mano mediante algoritmos de control avanzados e integrar sensores táctiles para permitir agarres controlados por fuerza. El software desarrollado, escrito en C++ e integrado con el Sistema Operativo para Robots (ROS) 2 2, es compatible tanto con entornos reales como simulados. En este trabajo se estudia extensamente el hardware de la mano Allegro, incluyendo su cinemática, las limitaciones de sus articulaciones y los protocolos de comunicación. El paquete de software incluye cinemática directa e inversa para un control preciso de los dedos y es compatible con múltiples versiones de la mano Allegro. Además, se desarrolló un paquete ROS 2 para integrar la mano con otros sistemas robóticos, como el Mobile Anthropomorphic Dual-Arm Robot (MADAR), y aprovechar la retroalimentación táctil de los sensores Weiss para técnicas avanzadas de agarre. El software se ha probado en cuatro versiones diferentes de la mano Allegro, demostrando su capacidad para controlar con precisión los movimientos de la mano. Los resultados muestran mejoras significativas en la precisión y adaptabilidad del agarre, lo que convierte al software en una herramienta valiosa tanto para la investigación como para aplicaciones prácticas en manipulación robótica. 2ROS 1 es compatible hasta Ubuntu 20.04. La comunidad robótica está migrando a ROS 2. ROS 2 Humble se ha usado en este proyecto. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 5 Abstract This project focuses on the development of a robust software solution for controlling the Allegro anthropomorphic robotic hand in robotic grasping and manipulation tasks. The aim is to enhance the hand’s capabilities through advanced control algorithms and integrate tactile sensors to enable force-controlled grasps. The developed software, written in C++ and integrated with the Robot Operating System (ROS) 2 3, supports both real-world and simulated environments. In this work, the Allegro Hand’s hardware is extensively studied, including its kinematics, joint limitations, and communication protocols. The software package includes forward and inverse kinematics for precise finger control and supports multiple versions of the Allegro Hand. Additionally, a ROS 2 package was developed to integrate the hand with other robotic systems, such as the Mobile Anthropomorphic Dual-Arm Robot (MADAR), and to utilize tactile feedback from Weiss sensors for advanced grasping techniques. The software has been tested across four different versions of the Allegro Hand, demonstrating its ability to accurately control the hand’s movements. The results show significant improvements in grasping precision and adaptability, making the software a valuable tool for both research and practical applications in robotic manipulation. 3ROS 1 is only compatible up to Ubuntu 20.04. The robotics community is migrating to ROS 2. ROS 2 Humble has been used in this project. Page 6 Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 7 Contents Resum 3 Resumen 4 Abstract 5 Contents 7 Glossary 10 Abbreviations 11 Figure list 13 Table list 15 1 Preface 17 2 Introduction 18 2.1 Motivation ......................................... 19 2.2 Scope ............................................ 19 2.3 Prerequisites ........................................ 20 2.4 Objectives ......................................... 20 2.4.1 General Objective ................................. 20 2.4.2 Specific Objectives ................................ 20 3 Grasp theory 22 3.1 Introduction ........................................ 22 3.2 Types of Grasps ...................................... 23 3.3 Grasp Mechanics ..................................... 24 3.3.1 Forces in Grasping ................................ 24 3.3.2 Friction and Wrench Cones ........................... 24 3.3.3 Force Closure ................................... 25 4 The Allegro Robotic Hand 27 4.1 Introduction ........................................ 27 4.2 The Allegro Hand Hardware .............................. 28 4.2.1 Comparison Between the Allegro Hand and a Human Hand ........ 28 4.2.2 The Allegro Hand Specifications ........................ 30 4.3 The Allegro Hand Communication Protocols ..................... 32 4.4 The Allegro Hand Joint Limits .............................. 34 4.5 Kinematics of the Allegro Hand ............................. 36 4.5.1 Introduction .................................... 36 4.5.2 Denavit-Hartenberg Convention ........................ 37 4.5.3 Forward Kinematics of the Allegro Hand ................... 39 4.5.4 Inverse Kinematics of the IMA Fingers ..................... 40 4.5.5 Inverse Kinematics of the Thumb Finger .................... 48 4.6 The Official Allegro Hand Software ........................... 49 4.6.1 The BHand Library ................................ 49 Page 8 CONTENTS 4.6.2 The Version Specific Package .......................... 51 4.6.3 Conclusions .................................... 53 5 Weiss Sensors 55 5.1 Introduction ........................................ 55 5.2 Weiss Sensors Library .................................. 57 5.2.1 AsyncSerial Class ................................. 57 5.2.2 Weiss_sensor Class ................................ 57 5.3 Weiss ROS 2 ........................................ 59 5.3.1 Introduction .................................... 59 5.3.2 Weiss Sensor Interfaces Package ........................ 59 5.3.3 Weiss Sensor ROS Package ........................... 60 5.3.4 Conclusion .................................... 63 6 Allegro Hand Library 64 6.1 Introduction ........................................ 64 6.2 Key Functionalities .................................... 65 6.3 Code Structure ....................................... 67 6.4 Software Walkthrough .................................. 68 6.4.1 File and Directory Organization ........................ 68 6.4.2 The CAN Communications Class: CAN_AH ................. 70 6.4.3 The Controller Class: AllegroHandController ................ 74 6.4.4 The Kinematics Class: AllegroFinger ...................... 79 6.4.5 The Basic Driver Class: AllegroHandDriver .................. 83 6.4.6 The Primary Class: AllegroHand ........................ 85 6.5 Installation and Setup ..................................100 6.5.1 Requirements ...................................100 6.5.2 Build ........................................100 6.5.3 Integrating the Driver into a Project ......................101 6.6 Testing the Allegro Hand Library ............................102 6.6.1 Allegro Hand Driver Example .........................102 6.6.2 AllegroHand Example ..............................103 6.6.3 Additional Examples ...............................109 6.7 Conclusion .........................................111 7 Allegro Hand ROS 2 112 7.1 Introduction ........................................112 7.2 Allegro Hand Description Package ...........................113 7.2.1 Introduction ....................................113 7.2.2 Package Structure .................................113 7.2.3 Launch .......................................114 7.2.4 Display the Allegro Hand in RViz2 .......................114 7.3 Allegro Hand Interfaces Package ............................118 7.3.1 Introduction ....................................118 7.3.2 Package Structure .................................118 7.3.3 Message Definitions ...............................118 7.3.4 Service Definitions ................................119 7.3.5 Action Definitions ................................120 7.3.6 Usage ........................................120 Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 9 7.4 Allegro Hand ROS Package ...............................121 7.4.1 Introduction ....................................121 7.4.2 Package Structure .................................122 7.4.3 Launch .......................................123 7.4.4 Allegro ROS Node: allegro_node ........................124 7.4.5 The Allegro ROS Class: AllegroROS ......................125 7.4.6 Usage ........................................129 7.4.7 Testing the Allegro ROS Package ........................131 7.5 Allegro Hand Weiss Package ..............................135 7.5.1 Introduction ....................................135 7.5.2 Package Structure .................................135 7.5.3 Launch .......................................136 7.5.4 The Allegro Weiss Class: AllegroWeiss ....................136 7.5.5 Usage ........................................139 7.5.6 Testing the Allegro Hand Weiss Package ...................140 7.6 Installation and Setup ..................................141 7.6.1 System Requirements ..............................141 7.6.2 Creating the Workspace .............................141 7.6.3 Building the Packages ..............................142 7.7 Conclusion .........................................143 8 Results and discussion 144 9 Economic assessment 149 9.1 Introduction ........................................149 9.2 Costs Breakdown .....................................149 9.3 Costs Analysis .......................................150 10 Conclusions 151 10.1 Key Achievements .....................................151 10.2 Future Work ........................................152 10.3 Personal Learning Experience ..............................153 Acknowledgments 154 A Annexes 155 A.1 Message Structure Allegro Hand Version 1, 2 and 3 .................155 A.2 Message Structure Allegro Hand Version 4 ......................156 A.3 Joint Limit Comparison between the Official and Real Values ............157 A.4 Pseudocode of the public methods of the CAN_AH Class ..............158 A.5 Pseudocode of the key methods of the AllegroHandController Class . . . . . . . 159 A.6 Pseudocode of the AllegroHandController Derived Controllers Classes ......161 A.7 Pseudocode of the AllegroFinger Class .........................162 A.8 Pseudocode of the AllegroHandDriver Class .....................163 A.9 List of the available services in the Allegro ROS package ..............164 References 169 Page 16 TABLE LIST Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 17 1 Preface This project was developed at the Robotics division of the Institute of Industrial and Control Engineering (IOC), affiliated with the Universitat Politècnica de Catalunya (UPC). The primary focus of this project lies in the specialized field of robotic grasping and manipulation. One of the outcomes of this research is the publication of a conference paper, "Software package for efficient use of a robotic anthropomorphic hand" [1]. This paper was presented at the IEEE International Conference on Emerging Technologies and Factory Automation (ETFA), held from the 10th to the 13th of September 2024 in Padova, Italy. The development of this project was partially supported by the Project I+D+I 2020 "Generación de Conocimiento: Capacidades Intrínsecas para Robots Co-trabajadores" PID2020-114819GB-I00, funded by MICIU/AEI/10.13039/501100011033. Page 18 2 Introduction All humans are unique, yet despite their differences, they share an instinctive reflex known as the grasp reflex [2]. In fact, one of the most heartwarming moments is when a tiny baby hand wraps around its parent finger. This reflex is a survival mechanism inherited from our ancestors, who needed to cling to their mothers or branches to avoid falling. One of the characteristics that distinguishes humans from other species is the thumb finger, a trait that we share with other primates [3]. The thumb, an opposable finger, is an evolutionary feature that allow us to grasp and manipulate objects. Grasping is an essential and innate skill for humans, in fact grasping is an everyday task. From picking up a toothbrush in the morning to holding a cup during breakfast or grabbing our keys as we leave the house, we are constantly executing grasps without even thinking about it. The ability to grasp is so vital that disabled people without upper limbs learn to use their feet for grasping. A remarkable example is Sheetal Devi, the first international champion in Paralympic archery without upper limbs [4]. For grasping objects using robots, both grippers and robotic hands can be utilized, each offering distinct advantages. Grippers are known for their simplicity and effectiveness, often providing a reliable grasp with minimal complexity. However, their functionality is limited due to having only two contact points. In contrast, robotic hands, while more challenging and complex to design and control, offer significantly greater versatility. Each finger on a robotic hand provides an additional contact point, allowing for more nuanced and adaptable grasping. This versatility enables robotic hands to perform a wide range of tasks that grippers cannot, as the multiple contact points allow for superior manipulation and precision. For robots to grasp objects like humans, they require anthropomorphic robotic hands that mimic the configuration of human hands. While controlling our hands is an innate skill for individuals without physical or intellectual disabilities, a robotic hand requires a robust software to execute the desired movements of its hardware. Humans intuitively calculate the force needed in each joint to move our fingers to a desired position [5]. Whereas, the software must handle this calculations allowing the robot’s fingers to move to and maintain a desired position, even in the presence of environmental disturbances. However, effective grasping with a robotic hand also requires detailed information about the object. Humans can detect touch thanks to the skin’s numerous sensory receptors, known as tactile receptors or mechanoreceptors [6]. When we touch an object, these receptors send the information to the brain, allowing us to perceive pressure, temperature, texture, and even pain. To mimic this capability and obtain environmental data, robotic hands use tactile sensors. When a robotic finger equipped with a tactile sensor makes contact with an object, it can determine the contact surface and the applied pressure. These aspects are essential for successfully executing grasps and manipulation with a robotic hand. This information not only confirms that the object has been grasped but also allows us to improve the grasp technique and determine how firmly to hold the object. This project is centered on developing software to control an anthropomorphic robotic hand for grasping and manipulation tasks, specifically the Allegro Hand (AH) manufactured by Wonik robotics [7]. Additionally, it includes the creation of a Robot Operating System (ROS) 2 package that facilitates the seamless integration of the Allegro Hand with other robotic systems, such as Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 19 the Mobile Anthropomorphic Dual-Arm Robot (MADAR) [8]. This package allows the integration of tactile sensors to enable advanced grasping techniques by controlling the applied force based on sensor feedback. In fact the Weiss tactile sensors integration is a part of the developed software. To validate the software we developed, we conducted testing using four Allegro Hands. Specifically, we utilized two AH version 4 hands, with serial numbers R283 and R284, as well as a pair of AH version 2 hands, identified by serial numbers SAH20BR014 and SAH20AL011. This comprehensive testing ensured that our software functions correctly across different versions of the Allegro Hand. This document aims to provide a comprehensive understanding of both the hardware and software components of the Allegro Hand, fully exploring its potential in robotic applications. The discussion will cover key aspects of grasp theory for robotic manipulation, the hardware and kinematic design of the Allegro Hand, and the integration of Weiss tactile sensors. This study is essential for advancing the capabilities of robotic hands in real-world applications, offering valuable insights into their practical use in tasks that require precision and dexterity. 2.1 Motivation The motivation behind this project stems from being able to apply and test experimentally grasp theory on actual robotic hands. The theory of grasping is highly developed, with a solid foundation in robotics and mechanics. However, applying this theory in practical scenarios is complex. Successful implementation requires sophisticated software capable of precisely controlling the movements and forces exerted by robotic hands. This software must be able to interpret the complex interactions between the hand and the object, through the integration of tactile sensors. Making the transition from theory to practice a significant challenge in this field. Moreover, many applications in robotics require performing grasps using robotic arms. For this reason a robust software that allows the integration of robotic hands with other robots is needed. The main problem being tackled is the lack of a powerful software solution that can fully exploit the potential of advanced robotic hands, such as the Allegro Hand, in real-world applications. The motivation of this project it to create a robotic software that enables to perform complex grasp and manipulation tasks with greater efficiency and accuracy. Thereby, contributing to advancements in robotic research such as grasp theory. 2.2 Scope The work of this thesis is confined to the development and implementation of software solutions for the control of the Allegro robotic hand in grasping and manipulation tasks. The primary focus is on creating a robust software package that fully controls the Allegro hand while being adaptable to other robotic hands. Additionally, the project emphasizes the development of another software package in ROS 2 that facilitates the integration of the Allegro Hand with other robotic systems, such as the MADAR, and with tactile sensors. The project does not extend to the physical modification or enhancement of the Allegro hand hardware itself, nor does it involve the fabrication of new tactile sensors or other hardware components. Instead, it relies on existing hardware technologies, specifically the Allegro Hand Page 20 2.3 Prerequisites and Weiss tactile sensors. The scope of this work is technological and computational, confined to software development and its application within simulated environments and controlled experimental setups. The project does not involve deploying the Allegro Hand in real-world industrial or commercial applications. Instead, it is limited to a research and development context, where the primary objective is to improve the hand’s manipulation capabilities through enhanced software control and integration with tactile sensing. The solutions provided are intended to be scalable and adaptable for further development, but the immediate application is confined to the laboratory environment and simulation within the ROS 2 framework. The project outcomes are thus intended to contribute to the academic and research community, laying a foundation for future studies and developments in the field of grasp theory and robotic manipulation. 2.3 Prerequisites To fully engage with this project, a solid background in robotics, dynamics, kinematics, control systems, and grasp theory is essential. Since the project involves the development of software, familiarity in C++ and ROS, particularly ROS 2, are crucial. Additionally, knowledge of trigonometry and the Denavit-Hartenberg convention for kinematic modeling will be beneficial. These prerequisites will enable the reader to understand the complex interactions between the mechanical design of the Allegro hand and its software control, as well as the challenges involved in integrating tactile sensors for executing controlled force grasps. However, this document is written in a highly detailed manner, with the underlying theory thoroughly explained, so even readers with limited prior knowledge should be able to understand the content. 2.4 Objectives 2.4.1 General Objective The primary objective of this project is to develop a powerful software solution for controlling the Allegro robotic hand, enhancing its capabilities in grasping and manipulation tasks. Additionally, the project aims to facilitate the seamless integration of the Allegro Hand with other robotic systems within the ROS 2 environment. Another key objective is to perform force controlled grasps using tactile sensors. 2.4.2 Specific Objectives For fulfilling the general objective, this specific objectives need to be achieved. •Development of the Allegro Hand Library: Create a robust C++ software package to fully control the Allegro Hand. This software will be designed to fully leverage the potential of the Allegro Hand, incorporating both forward and inverse kinematics, several controllers, and predefined as well as customizable hand configurations and grasps. The library will be compatible with all versions of the Allegro Hand and easily adaptable to other robotic hands, ensuring it is easily customizable and extensible. Additionally, it will be capable of controlling both real Allegro hands and their simulations. This work builds on previous efforts initiated at the IOC, with the goal of completing the development. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 21 •Conversion of the ROS 1 Weiss Sensor Package to ROS 2: Enable the use of Weiss sensors within the ROS 2 environment. This involves converting the existing ROS 1 (Noetic) Weiss sensor package to ROS 2 (Humble). This conversion is necessary to use and maintain compatibility of the sensors within the ROS 2 environment. The original ROS 1 package [9] was developed at the IOC. •Development of a ROS 2 Package for the Allegro Hand: Create a ROS 2 (Humble) package for the Allegro Hand, that allows the integration of the Allegro Hand with other robots and sensors within the ROS 2 environment. This package will be enhanced by integrating tactile sensors, specifically the Weiss sensors, to perform force-controlled grasps. •Documentation: Provide comprehensive and complete documentation of the developed software solutions. The software packages developed in this project are intended for use by other engineers, developers, and researchers working with the Allegro Hand. Therefore, detailed documentation is essential to ensure the proper use and understanding of the software capabilities. Page 22 3 Grasp theory 3.1 Introduction A grasp is defined as any static hand posture that allows an object to be securely held with one hand, regardless of the hand’s orientation. The effectiveness of a grasp is determined by the degree to which the object is secured, allowing for manipulation without slipping or losing control [10]. In the context of robot manipulation, grasping is a fundamental action that enables a robot to interact with and control objects. Key questions in executing effective grasps include: "How many fingers are needed to grasp an object firmly?" and "Where should the fingertips be placed?". These questions are critical because, once an object is firmly grasped, it follows the hand’s movements precisely, making the control of the object as straightforward as controlling the hand movement itself. Grasp theory provides the mathematical and physical framework necessary to analyze and synthesize grasps in robotic hands. It involves understanding the contact points between the hand and the object, the forces applied, and the resulting stability of the grasp. Grasp quality measures are used to evaluate the effectiveness of a grasp, often considering factors such as stability, force distribution, and the manipulability of the object. High-quality grasps ensure that the object remains stable under various conditions, allowing the robotic hand to manipulate the object as required. The Allegro Hand, with its dexterous capabilities, is well-suited for performing a wide range of precision grasps. Understanding the fundamental principles of grasping and grasp theory is essential for effectively applying this theory in practical applications. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 23 3.2 Types of Grasps Grasps can be categorized in various ways, with the Cutkosky classification [11] being one of the most relevant approaches. This taxonomy categorizes grasps based on the type of task performed by the hand and the fingers involved. Figure 1illustrates the Cutkosky classification, with a red rectangle highlighting the grasps that will be the focus of this project. Figure 1: Cutkosky grasp taxonomy [11]. Grasps are primarily divided into power grasps and precision grasps: •Power Grasps: These involve both the palm and the fingers, creating a strong and secure hold suitable for handling larger objects. The entire hand envelops the object, maximizing contact and force application. •Precision Grasps: These rely on the fingertips, without involving the palm, to create a more accurate and delicate grip, allowing for in-hand manipulation. Precision grasps are particularly significant for robotic hands like the Allegro Hand due to its rigid palm and the ability to equip tactile sensors on the fingertips. These grasps are especially suited for tasks that require fine control of small and delicate objects. Precision grasps can be further categorized into circular and prismatic types: – Circular Grasps: These involve three fingers, offering radial symmetry. Depending on the object, circular grasps can be categorized into disk, sphere, and tripod grasps. – Prismatic Grasps: These involve two fingers, with one finger always being the thumb to provide opposition forces. Depending on the finger used are further divided into pinch with the thumb and index, middle, ring, or pinkie finger. Page 24 3.3 Grasp Mechanics 3.3 Grasp Mechanics The success of a grasp depends on various factors, including the contact points between the hand and the object, as well as the object’s material, mass, and geometry. Each finger involved in a grasp contacts the object within a specific contact region, which can be considered as a contact point for analytical purposes. The contact points are where the fingertips exert force to maintain the grasp. For a robotic hand like the Allegro Hand, the configuration of the hand, determined by the joint positions, directly influences the contact points and the forces that are exerted. The material properties of the object are also significant; softer objects, such as balloons, require more force due to their tendency to deform, while harder objects, like rocks, are more rigid and require less force to grasp securely. Slippery objects demand higher frictional forces to prevent slipping. In this report, all objects are considered as rigid bodies for simplicity. The mass of the object is another crucial factor, as the grasping forces must counteract the object’s weight. Therefore, successful grasping with a robotic hand involves careful consideration of both the hand configuration and the object’s properties. The only controllable variable in this context is the joint values, which determine the contact points and the force applied. 3.3.1 Forces in Grasping Forces transmitted through a contact point include both normal forces, Fn, and tangential forces due to friction, Ff. The normal force is exerted perpendicular to the contact surface, while the friction force acts parallel to the surface, opposing relative motion. The friction force depends on the friction coefficient µand the normal force Fn. The friction coefficient, which ranges from 0 to 1, arises due to the microscopic interactions between the fingertip and the object, thus depends on the materials in contact. There are two types of friction coefficients: static µsand kinetic µk. The static friction coefficient represents the ratio of the maximum static friction force between two surfaces to the normal force pressing them together. It quantifies the ability to resist the initiation of sliding motion. A higher static friction coefficient indicates greater resistance to slipping. The static friction force, depends on the normal force and the static friction coefficient. It represents the maximum friction force that resists the initiation of sliding motion between two surfaces in contact. The static friction force is essential in preventing an object from moving when an external force is applied. Once this force is exceeded, the object begins to slide, and the kinetic friction coefficient becomes relevant [12]. 3.3.2 Friction and Wrench Cones To ensure a stable grasp, it is crucial that the object does not slip. The set of all forces that can be transmitted through a contact point without causing slippage defines a friction cone [13]. The positive span of a friction cone contains all the forces that can be applied without causing sliding motion, Equation 1. This cone is centered around the normal force at the contact point, with its sides determined by the maximum static friction force. The cone’s amplitude depends on the static friction coefficient, meaning that slippery objects, with lower friction coefficients, have smaller friction cones than non-slippery objects. The cone shape is a result of the static friction force depending on the normal force. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 25 Friction cones are geometric representations used in grasping to visualize the range of forces that can be applied at a contact point without causing slippage. Any force vector within the cone can be applied without slipping, while forces outside the cone exceed the frictional limits, leading to potential slippage. Figure 2illustrates a friction cone. FC =nf|fz≥0,qf2 x+f2 y≤µ·fzo(1) Figure 2: Friction Cone Contact forces also create moments about coordinate frames that are not at the contact point. These moments can be represented by a wrench cone, which corresponds to the friction cone. A wrench cone is a geometric representation of all possible wrenches (combinations of forces and moments) that can be transmitted through a contact point between two bodies. It is composed using the forces within the friction cone at the contact point, where each force vector generates a corresponding moment around a reference point. The wrench cone includes all linear combinations of these wrenches, showing the range of forces and moments that can be resisted/applied through the contact. 3.3.3 Force Closure A stable grasp happens when the object remains securely held under external forces and disturbances, without slipping or losing control. Force closure is a key concept in achieving a stable grasp. A grasp achieves force closure when the set of contact points can resist any external force or torque applied to the object. Force closure is achieved if the positive span of the wrench cones covers the entire wrench space. In the absence of friction, three contact points are necessary in a plane, and four in a 3D space, to achieve force closure. However, when nonzero friction exists at the contacts, force closure can be achieved with as few as two contact points in a plane or three in the 3D space. In the real world, a 3D space, two contact points are insufficient for force closure due to the inability to resist moments about the axis between the two contacts. A grasp involves multiple contact points, it is performed by multiple fingers, each exerting force at a specific contact point. The resulting force exerted by the hand is the sum of all the forces exerted by each finger (Equation 2). Page 32 4.3 The Allegro Hand Communication Protocols 4.3 The Allegro Hand Communication Protocols The Allegro Hand is commanded by sending a message with the joint torques of each finger and reading another message with the values of the finger joint positions. Thus, acquiring/setting the configuration of the whole hand requires four messages, one per finger. Figure 7illustrates the communication process, detailing the exchange of messages between the computer system and the Allegro Hand. Figure 7: Message exchange between the computer system and the Allegro Hand. The communication is periodic and each received/sent message contains the information of the four joints of a finger. Each message has an identifier indicating the related finger. The messages are always sent in the same order: Index, Middle, Annular and Thumb. As it has been previously stated, the primary differences among the Allegro Hand versions lie on the communication protocols and on the characteristics of the servos. Up to version 3, the communication protocol is almost the same, while version 4 has notable differences [25]. The key difference is the message length. Each message contains an Identifier and the Data. Up until version 3, the message structure is as follows: •Message Identifier: 4 bytes. Divided as follows, 26 bits for the Command Identifier, 3 bits for the Source Identifier and 3 bits for the Destination Identifier. Table 26 of Annex A.1 shows a list with all the type of messages that can be sent/received, this is a list of available Command Identifiers with a brief description and its corresponding hexadecimal values. The source and destination identifiers can be the Allegro Hand, the Control PC and each one of the fingers, their hexadecimal values are presented in Table 27 of Annex A.1. •Data: 8 bytes. The messages related to reading joint states and sending the desired torques assign 16 bits per joint. Whereas, the structure of version 4 messages is: •Arbitration identifier: 11 bits. Divided in 9 bits for the Message Identifier and 2 bits for the Device Identifier. In version 4, this significantly reduces the message length. Table 28 of Annex A.2 shows a list with all the type of messages that can be sent/received, this is a list of available Message Identifiers with a brief description and its corresponding hexadecimal values. This version allows multiple Allegro Hands to be used at the same time within the same Controller Area Network (CAN) bus, to do so, the Device Identifier field is used to distinguish each device, by default is 0 and can be configured using a Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 33 Configuration message. •Data: up to 8 bytes, with the length depending on the type of messages; those related to reading joint states and sending the desired torques assign 16 bits per joint. The reduction of the message length is an improvement, but as a result, the process of creating and reading the messages is also different depending on the version. The types of messages common in all the versions are starting and stopping periodic communication, sending torque commands towards the hand, and reading the current joint state positions. The newest version 4, introduces new types of messages such as Information, Serial and Status, that provide information of the Allegro Hand. Additionally, Config messages allow to set the Device ID when multiple hands are being used within the same CAN bus and the current temperature of each finger can be read. Moreover, an IMU message to read the current position and orientation (pose) of the Allegro Hand in quaternion form is defined, although it is not available yet. The communications protocol of all versions also presents a message definition to set the desired position of the fingers, unfortunately this is still being developed by the manufacturer and it is not available yet. For each version, the manufacturer provides a different way to convert the current of the servos into joint positions in radians, allowing to retrieve the current hand configuration. In versions 1, 2 and 3 there exists an encoder offset, an encoder direction and a motor direction. These values are different for each of the 16 joints and for each manufactured hand, the relationship between the angles and the received data is shown in Equation 4. joint[rad]=(encDirection ·data −32768.0−encOffset)· ·333.3 65536.0·π 180.0(4) Whereas in version 4 there is no encoder offset and all the encoder directions and motor directions are well adjusted to 1 for all the manufactured hands, the relationship is shown in Equation 5. joint[rad] = data ·333.3 65536.0·π 180.0(5) The Allegro Hand hardware is controlled through torque commands. Each joint of the hand is moved by providing the desired torque. Each message contains the torque commands of the joints of one finger. To be sent, the torque commands are translated into intensity by multiplying the desired torque by a tau conversion constant (Equation 6). The torque conversion constant varies depending on the Allegro Hand version, being 800 for versions 1 and 2 and 1200 for versions 3 and 4. The motor direction value varies in versions 1, 2 and 3. For version 4 the motor direction is well-adjusted and the value is 1 for all the joints. I=motor_direction ·k·τ(6) Page 34 4.4 The Allegro Hand Joint Limits 4.4 The Allegro Hand Joint Limits Each finger of the Allegro Hand features four joints. However, it’s important to note that each joint has specific movement limits, which are defined by the manufacturer to ensure optimal performance and prevent mechanical stress [26]. Although, the empirically read values of the joint limits are not the same for all the versions, nor for all the hands within a version, except for version 4, in which the values are more consistent. Furthermore, the read limits are not consistent with the official limits provided by the manufacturer. The official limits provided by the manufacturer are shown in Table 2, the limits of the Unified Robot Description Format (URDF) model provided by the manufacturer consider a 0.1 rad safety margin. Table 2: Official joint limits of the Allegro Hand in radians [26]. Official limits URDF limits Finger Joint Minimum Maximum Minimum Maximum IMA 0-0,57 0,57 -0,47 0,47 1-0,296 1,71 -0,196 1,61 2-0,274 1,809 -0,174 1,709 3-0,327 1,718 -0,227 1,618 Thumb 00,363 1,496 0,263 1,396 1-0,205 1,263 -0,105 1,163 2-0,289 1,744 -0,189 1,644 3-0,262 1,819 -0,162 1,719 As it has been previously stated, the real joint limits values are not consistent within versions. Empirically the joint limit values of four different Allegro Hands have been read, specifically two AH version 4, whose serial numbers are R283 and R284, and a pair of AH version 2; SAH20BR014 and SAH20AL011. Table 3presents a sum up of the results obtained experimentally. As it can be seen, both AH version 4 have very similar values, whereas the joint limits of each AH version 2 differ more. This differences between the joint values are small but not negligible. Theoretically, since the IMA fingers are identical, the joint limit values have to be the same, thus the mean of the real joint values of the IMA finger has been computed and displayed in the previous table. For more in depth information, Annex A.3 contains a Table with all the read data, as well as a comparison with the official values. With the complete results it is apparent that version 2 values tend to differ more. Another significant difference is that the range of the joint values is not the same for all the versions nor for all the hands within a version, except for version 4. Moreover, the minimum and maximum empirically obtained joint values are not consistent with the values of the URDF model provided by the manufacturer. The problem of the discrepancies in the joint limits between the manufactured hands and the official URDF limit values has been solved by changing the URDF limits using the empirical read values from version 4, which exhibit consistency across manufactured hands and whose Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 35 Table 3: Read joint limits of the Allegro Hand in radians. Version 4 Version 2 R284 R283 SAH20BR014 SAH20AL011 Joint Min Max Min Max Min Max Min Max IMA 0-0,595 0,594 -0,599 0,583 -0,545 0,676 -0,616 0,575 1-0,280 1,794 -0,289 1,802 -0,224 1,869 -0,342 1,741 2-0,275 1,773 -0,280 1,773 -0,375 1,727 -0,287 1,798 3-0,285 1,771 -0,279 1,751 -0,259 1,831 -0,287 1,722 Thumb 00,230 1,505 0,207 1,561 0,246 1,594 0,255 1,630 1-0,389 1,220 -0,405 1,185 -0,421 1,253 2-0,255 1,770 -0,248 1,764 -0,317 1,801 -0,385 1,697 3-0,262 1,812 -0,258 1,833 -0,290 1,861 -0,338 1,856 values are more similar to the official ones. Table 4shows a comparison between the old URDF values and the new ones. Table 4: Comparison between the new and the official URDF joint limits values of the Allegro Hand in radians. URDF Official limits New URDF limits Joint Minimum Maximum Minimum Maximum IMA 0-0,47 0,47 -0,597 0,588 1-0,196 1,61 -0,284 1,798 2-0,174 1,709 -0,277 1,773 3-0,227 1,618 -0,282 1,761 Thumb 00,263 1,396 0,219 1,533 1-0,105 1,163 -0,397 1,203 2-0,189 1,644 -0,251 1,767 3-0,162 1,719 -0,260 1,823 In order to minimize the difference among the versions, the new developed software has a small program that allows to automatically read and store in a YAML file the minimum and maximum values, as well as the range, allowing the user to compare those values. Additionally, it can calculate and automatically change the encoderOffset values of the hand configuration file to center the range and ensure the same performance and compatibility across all versions and hands, using the real full available range. The new software takes into account both the URDF joint limit values as well as the experimentally read values that are stored in the YAML file if this file exists. Moreover, it allows to set a safety margin for the joint limit values, either by a general value or specific values for each joint. Page 36 4.5 Kinematics of the Allegro Hand 4.5 Kinematics of the Allegro Hand 4.5.1 Introduction Kinematics is a fundamental aspect of robotics, it is "the study of the relationship between a robot’s joint coordinates and its spatial layout" [27], through kinematics we can obtain the relation between joint positions and the position and orientation of the end-effector, in this case the fingertips. The kinematics of the Allegro Hand are important since they will allow to describe the fingertips pose in the Cartesian space and relate them with the hand configuration, this is with the joint position values. The kinematic configuration of the Allegro Hand can be divided on individual structures of each one of the fingers. The Allegro Hand has four fingers and thus four fingertips. For this reason, the relationship of each fingertip pose and the corresponding joint position values of the finger will be analyzed separately for each finger. A manipulator, in this case each finger, consists of a series of rigid bodies (links), connected through kinematic pairs, in this case revolute joints, as it has been seen previously in this chapter [28]. The whole structure forms a kinematic chain, that starts with a fixed link that connects the base of the hand towards the base of the finger, and ends at the fingertip. For simplicity, the transformation from the base of the hand towards the base of the finger will be considered separately and thus the kinematic chain of the finger will start at the base of the finger until the fingertip. The IMA fingers share the same kinematic chain since the physical structure of the IMA fingers is identical (considering from the base of the finger until the fingertip), the only difference relies on the pose of the base of each IMA finger with respect the base of the hand. The kinematics of the Thumb, also considered from the base of the Thumb finger until the fingertip, will be studied separately since the Thumb finger structure is different and as consequence the kinematic chain differs. The kinematic chain of the Allegro Hand is shown in Figure 8. The kinematics of each finger of the Allegro Hand will allow to obtain a relationship between the fingertip pose and the joint position values of the finger. In order to perform accurate grasps, it is fundamental to know the current pose of the hand fingertips and to be able move them towards a new desired pose. This information is obtained through the use of Forward Kinematics and Inverse Kinematics. •Forward Kinematics (FK): Determines the position and orientation in the Cartesian space of the fingertip, based on the current finger configuration. This process is straightforward, as it relies on the application of the Direct Kinematics equations, derived from the robotic system’s geometry using the Denavit-Hartenberg (DH) Convention. •Inverse Kinematics (IK): Determines the joint values of the finger to achieve a desired position and orientation of the fingertip. IK are more complex than FK, due to the nonlinear nature of the equations involved. Moreover, given a fingertip pose there may exist multiple solutions or none. The complexity of inverse kinematics increases with the DOF of the robotic system. Depending on the complexity, the solutions for IK can be found analytically, geometrically or through an optimization process. At the end of this section, the reader will have a deep understanding of the kinematics of the Allegro Hand. This section is structured as follows: First, the Denavit-Hartenberg Convention theory is presented to understand this method for building kinematic chains. Then, the Forward Kinematics of the Allegro Hand is analyzed, starting by the IMA FK and then studying the Thumb FK, obtaining the kinematic chains and as a result the relationship between the current Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 37 hand configuration and the fingertip poses in terms of the DH parameters. Subsequently, the Inverse Kinematics of the Allegro Hand is discussed. Figure 8: Kinematic Chain of the Allegro Hand. Image from RViz. 4.5.2 Denavit-Hartenberg Convention The Denavit-Hartenberg convention is a standardized method to represent the kinematic chain by defining each joint’s position and orientation using four parameters, simplifying the computation of FK and IK [28]. The kinematic chain of each finger is an open chain since there is only one sequence connecting the initial and final points of the chain. An open chain generally is constituted by n joints and n+1 links. As it has been previously discussed, all joints are revolute and each one provides 1 DOF, corresponding to the joint variable, this is the amount of rotation of the joint. A coordinate frame is attached to each link since each joint is connected to two consecutive links. The direct kinematics equation of an open chain can then be derived through a transformation matrix T0 n(q), which describes the position and orientation of Frame nwith respect to Frame 0, as shown in Equation 7. T0 n(q) = A0 1(q1)·A1 2(q2)·. . . ·An−1 n(qn)(7) Ai−1 i(qi)represents the homogeneous transformation matrix of joint i, which depends on the joint variable qi. This allows for the calculation of the overall position and orientation of the end-effector relative to the base frame. For obtaining the directs kinematics equation, the coordinate transformations between link frames needs to be computed. The link frames must be attached to the link they referred to. Page 38 4.5 Kinematics of the Allegro Hand The link frames can be arbitrarily chosen as long as this condition is met. The DH Convention is a set of rules to unify this procedure of defining the frames of an open chain. Figure 9: Denavit-Hartenberg kinematic parameters [28]. To obtain the direct kinematics equation, the first step consist on assigning a coordinate frame to each link, for instance to define link Frame i of Figure 9: •Axis zicoincides with the axis of Joint i+1. •Origin Oilocated at the intersection of axis ziwith the common normal of axis zi−1and zi. •Origin Oi0located at the intersection of the common normal with axis zi−1. •Axis xialong the common normal to axis zi−1and ziwith direction to Joint i + 1. •Axis yidirection has to be chosen so that the frame is right handed. Once the definition of the coordinate frames is completed, there exists four DH parameters that are the minimal set necessary to describe the position and orientation of one link frame relative to the adjacent link frame. The DH parameters are: •ai: Distance between Oiand Oi0. It is the link length, the length of the common normal between axis zi−1and zialong the axis xi. •di: Coordinate of Oi0along zi−1. This is the offset along the z-axis of the previous frame.. •αi: The twist angle between axis zi−1and zimeasured about axis xi, to be taken positive when rotation is counter-clockwise. •θi: The twist angle between axis xi−1and ximeasured about axis zi−1, to be taken positive when rotation is counter-clockwise. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 39 For revolute joints, only one parameter is variable, θi, the remaining three parameters are constant since they depend on the geometry connecting the joints with link i. The coordinate transformation between Frame iand Frame i−1using the DH parameters is given by Equation 8. Ai−1 i=    cos θi−sin θi·cos αisin θi·sin αiai·cos θi sin θicos θi·cos αi−cos θi·sin αiai·sin θi 0 sin αicos αidi 0 0 0 1     (8) The final step consists on constructing all the transformation matrices, Ai−1 i(qi), and then multiplying them sequentially (Equation 7), to obtain the overall transformation from the base of the manipulator to the end-effector, in this case from the base of the finger to the fingertip. The Forward Kinematics can be obtained through the use of the final transformation matrix, by substituting the variable parameters with the current manipulator configuration. 4.5.3 Forward Kinematics of the Allegro Hand As it has been previously mentioned, the FK will be studied from the base of the finger. This implies that the full transformation matrix from the base of the hand towards the TCP, in this case the contact point of the fingertip, will be obtained by multiplying sequentially the corresponding coordinate transformation matrices (Equation 9). Tbasehand T CP =Tbasehand basefinger ·Tbasefinger fingertip ·Tfingertip T CP (9) The only matrix that depends on variable parameters is Tbasefinger fingertip , the remaining two transformation matrices are fixed. The coordinate transformation between the base of the hand and the base of the finger, Tbasehand basefinger, is fixed and known. The Allegro Hand’s interchangeable fingertips enable the integration of tactile sensors. These sensors detect a contact region rather than a single point when the finger touches an object. In practice, contact always occurs over a region, not just at a single point. The weighted average of this region is considered the contact point, or TCP. By sensing the forces across the contact area, the sensors compute the contact point. Consequently, the coordinate transformation between the fingertip center and the TCP, Tfingertip T CP , changes based on the location of the contact point. Although this transformation is dynamic and changes over time, at any given moment it can be considered fixed, as the tactile sensors provide the current transformation matrix. The transformation matrix between the base of the finger and the fingertip depends on the current joint values. Forward Kinematics of the IMA fingers In this section, the Forward Kinematics of the IMA fingers will be described. The direct kinematics equation between the base of the finger and the fingertip center will be obtained using the DH convention. The corresponding DH parameters considering the Weiss tactile sensor are shown in Table 5. The last DH parameters, corresponds to the fixed transformation related to the fingertip sensor center. In case another fingertip is being used, then the DH parameters of the link frame 4 will change. Forward Kinematics of the Thumb finger Page 40 4.5 Kinematics of the Allegro Hand Table 5: Denavit-Hartenberg parameters from base of the IMA finger to the fingertip. Link ai[m] αi[rad] di[m] θi[rad] 00 -π/20.0164 θ0 10.054 0 0 θ1−π/2 20.0384 0 0 θ2 30.0408 0 0 θ3 40.01335 π/20π/2 In this section, the Forward Kinematics of the Thumb will be described. Analogously, to the previous section, the direct kinematics equation between the base of the thumb and the fingertip center will be obtained using the DH convention. The corresponding DH parameters considering the Weiss tactile sensor are shown in Table 6. The last DH parameters, corresponds to the fixed transformation related to the fingertip center. In case another fingertip is being used, then the DH parameters of the link frame 4 will change. Table 6: Denavit-Hartenberg parameters from base of the Thumb finger to the fingertip. Link ai[m] αi[rad] di[m] θi[rad] 00.005 -π/20θ0 10π/2-(0.0394 + 0.077) θ1−π/2 20.0514 0 0 θ2−π/2 30.0564 0 0 θ3 40.01375 π/20π/2 4.5.4 Inverse Kinematics of the IMA Fingers This section addresses the Inverse Kinematics of the IMA fingers, given a desired fingertip position and normal vector. In previous works, the IK has been solved considering the position (X, Y, Z in Cartesian space) and the orientation (ZYZ Euler angles) of the fingertips and obtaining the joint values through a process of optimization, although the desired orientation was not guaranteed. In this project the IK approach considers the fingertip position (XYZ) and the normal vector of the fingertip where the force is exerted. The reason for solving the IK given a fingertip point and normal vector instead of a frame lies on the fact that for executing precise grasps the fingertip position and its normal have to be taken into account. It is true that the frame also considers the normal as an axis, although due to the physical characteristics of the Allegro Hand, in case there exists a solution of the IK given a fingertip position and normal, there is only one possible solution. Moreover, this approach is not an optimization problem since only one possible solution exists, in fact, it has been solved using geometric methods. The input variables for this problem are the fingertip position, represented by its X, Y, Z coordinates in Cartesian space, and the fingertip normal vector, all relative to the base of the hand. Given the identical structural configuration of the IMA fingers, with the only variation being the pose of each finger’s base, the initial step involves transforming the input data into the reference Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 41 frame of the corresponding IMA finger, as expressed in Equation 10. posfinger =Tfinger hand ·poshand := (px, py, pz) ~ normalfinger =Tfinger hand ·~ normalhand := (nx, ny, nz)(10) where: Tfinger hand :Transformation matrix from base of the hand to base of the finger. posfinger :goal fingertip position (X, Y, Z) with respect the base of the finger frame. poshand :goal fingertip position (X, Y, Z) with respect the base of the hand frame. ~ normalfinger :goal fingertip normal vector with respect the base of the finger frame. ~ normalhand :goal fingertip normal vector with respect the base of the hand frame. From now on, all computations will be relative to the base of the finger frame, so the fingertip position and fingertip normal mentioned are with respect to this frame. Consequently, the same approach can be applied to solve the IK problem for any IMA finger. Due to the physical structure of the IMA fingers, the plane that contains the fingertip normal vector and both the fingertip position and the origin (the finger’s base) will always include joints 1, 2, and 3. This plane is denoted as the Ωplane. The origin of the base of the finger frame is where joint 0 is located. The Ωplane contains these joints because it also contains the Z-axis, the axis about which joint 0 rotates. The rotation axis of joints 1, 2 and 3 are parallel to the Y-axis of the base of the finger frame. Therefore, the value of joint 0 can be determined by calculating the rotation angle of the Ωplane with respect to the XZ plane, which corresponds to y= 0 (Figure 10). In order to find joint 0, first the plane that contains the Z axis (of the base of the finger frame), the goal fingertip normal vector (with respect to the base of the finger frame) and the origin point (the base of the finger frame) will be computed. To compute the angle for joint 0, first, the plane that includes the Z-axis of the finger’s base frame, the fingertip normal vector, and the origin (finger base) must be identified. The vector normal to this plane is obtained by the cross product of the fingertip normal vector (nx, ny, nz) and the unit vector along the Z-axis (0,0,1), yielding a vector orthogonal to both (Equation 11). (nx, ny, nz)×(0,0,1) =  ˆ iˆ jˆ k nxnynz 0 0 1  = (ny,−nx,0) (11) The equation of this plane, which contains the origin (0,0,0), is straightforward to derive (Equation 12). ny·(x−0) −nx·(y−0) + 0 ·(z−0) = 0 ny·x−nx·y= 0 (12) Next, it is necessary to verify whether the plane containing the Z-axis vector, the fingertip nor- Page 48 4.5 Kinematics of the Allegro Hand Figure 13: Extra angle of the IMA fingers. To conclude, the resulting joint angles mustlie within the operational limits of the Allegro Hand. If any joint angle exceeds these limits, no valid solution exists for the Inverse Kinematics given the desired fingertip position and normal vector. 4.5.5 Inverse Kinematics of the Thumb Finger The kinematic structure of the thumb differs significantly from that of the IMA fingers, reflecting its specialized function of opposability, which is essential for grasping and manipulating objects. The IK of the thumb, due to its more complex structure, has been solved iteratively. The solution was provided by a previous project developed at the IOC by Alex Mauricio Calle Clavel. The input considers the fingertip positions (X, Y, Z Cartesian coordinates) and orientations (ZYZ Euler angles). Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 49 4.6 The Official Allegro Hand Software The official Allegro Hand software distributed and developed by Wonik Robotics [7] consists of several packages: a shared library called BHand [29] and one version-specific package for GNU/Linux [30] [31] and for Windows [32] [33]. Additionally, a ROS 1 (Catkin) package for GNU/Linux is provided [34] [35] (Table 7). Table 7: Official Wonik Robotics available packages. Windows GNU/Linux BHand library (distributed only in binary format) Windows AH version specific package GNU/Linux AH version specific package ROS 1AH version specific package The BHand is a software library distributed in binary format only, tailored to control the Allegro Hand. It is shared among all the Allegro Hand versions. The library includes two controllers algorithms: the Gravity Compensator and the Proportional-Derivative (PD), and it also has partial Forward Kinematics (without orientation). Also it embeds four types of grasps: using 3 fingers, using 4 fingers, pinch with index and thumb and pinch with middle and thumb. The version specific package manages communications to interact with the hand’s hardware, processes data, and allows for manual control through keyboard inputs. To do so, the BHand library is used. The ROS 1 package is version-specific and uses the previous packages allowing to control the hand within ROS 1 environment. This section presents the official software provided by the manufacturer, both the BHand Library and the version-specific package for GNU/Linux, detailing its key features. 4.6.1 The BHand Library The BHand [29] is a software library shared among all the Allegro Hand versions and it is specifically tailored to control the Allegro Hands. This library is distributed exclusively in binary format, meaning that it is provided as a precompiled executable rather than in source code form, thus only the necessary header files are provided but not the full source code. Binary format refers to software that has been converted from human-readable source code into machinereadable instructions. Users interact with the library through a set of predefined functions and classes. The primary limitation of distributing a library solely in binary format is the inherent restriction on modification and extensibility. The original source code is not accessible by the users, this limits any ability to alter the library’s functionality, optimize it or fix potential bugs. Furthermore, extending the library’s capabilities, by adding new features (such as new controllers, new grasp types, computing full FK and IK, among others) becomes significantly more challenging or even impossible without access to the source code. Since the library can not be modified, any extension must be applied using the provided functions, without any alteration of the BHand code. This constraint limits the library’s flexibility and adaptability. As a result the integration of this library into other projects that require customization or enhancement beyond the provided binary version can be more challenging. The library includes an enumeration of motion types, such as home positioning, grasping with Page 50 4.6 The Official Allegro Hand Software three or four fingers, and pinching, as well as utilities for partial forward kinematics and control gain adjustments. It offers two controllers: the Gravity Compensator (without considering the hand orientation) and the PD, and it also has partial Forward Kinematics (without orientation). The architecture of the BHand library is designed to provide an interface for controlling the Allegro Hand. The primary class, BHand, encapsulates all the functionalities: •GetType(). Retrieves the type of the hand, whether is left or right. •SetTimeInterval(). Defines the time interval of the control loop. Although the control loop is not contained within the BHand library the controllers require this information. •GetTimeInterval(). Returns the time interval of the control loop. •SetMotionType(). Selects the type of motion. The library has defined several motion types, the most relevant ones are: –eMotionType_NONE: Power off mode. –eMotionType_HOME: Moves the hand to its home position. –eMotionType_READY: Prepares the hand in a pregrasp position. –eMotionType_GRAVITY_COMP: Gravity compensation controller is activated. –eMotionType_JOINT_PD: Joint PD controller is activated. –eMotionType_GRASP_3: Torque controlled grasp using 3 fingers. –eMotionType_GRASP_4: Torque controlled grasp using 4 fingers. –eMotionType_PINCH_IT: Torque controlled grasp pinch using index and thumb. –eMotionType_PINCH_MT: Torque controlled grasp pinch using middle and thumb. –eMotionType_ENVELOP: Torque controlled envelope grasp. •SetJointPosition(). Sets the current joint position of each joint [rad]. •SetJointDesiredPosition(). Stores the desired joint positions [rad]. •UpdateControl(). Executes the control algorithm and the desired joint torques are computed. •GetJointTorque(). Retrieves the desired torques calculated by the controller with the UpdateControl() function. •GetFKResult(). Obtains the partial Forward Kinematics of the fingertips. Although, only the position (X, Y, Z coordinates) and not the orientation (Euler angles). •SetGainsEx(). Sets the gains of the PD controller. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 51 •SetGraspingForce(). Sets the desired grasping force for each finger. •GetGraspingForce(). Returns desired grasping force for each finger(individual fx, fy, and fz components per finger). •SetEnvelopTorqueScalar(). Sets scalar for the preset envelop grasp torque. •SetOrientation(). Sets the hand orientation, the orientation will be used when computing the necessary torque to neglect the gravity effects. The workflow for using this library involves the following steps: 1. Initialization: Create an instance of the BHand class by providing the type of hand (left or right). 2. Configuration: The user sets various parameters, such as the control time interval (Set- TimeInterval()), motion type (SetMotionType()), the PD controller gains (SetGainsEx()), the desired grasping force (SetGraspingForce()) or the scalar for the preset envelop grasp torque (SetEnvelopTorqueScalar()). 3. Control Loop: Each control loop is executed at the desired time interval. The UpdateControl() method is called to compute the desired joint torques based on the current state and the set motion type, finally the computed torques are retrieved. The resulting control loop structure (Algorithm 1) is: •SetJointPosition(). Provides the current joint position. •UpdateControl(). Executes the controller. •GetJointTorque(). Retrieves the computed torques. In the event that the hand orientation varies continuously, the orientation of the hand should be updated at every time step through the method SetOrientation(). The hand orientation variation is a result of the hand movement, often due to the integration of the hand with other robots, such as the MADAR robot. The Initialization step is only done only once, while the Control Loop is executed continuously at the desired time step. The user can change the configuration parameters at any time, as well as retrieve the parameters that has previously selected, such as the type of hand (GetType()), the chosen time interval (GetTimeInterval()) or the desired grasping force (GetGraspingForce()). Moreover, the user can obtain other interesting information, the position (XYZ) in the Cartesian coordinates of the fingertips, through the use of the partial kinematics using GetFKResult(). 4.6.2 The Version Specific Package The manufacturer provides a version-specific package for Windows for GNU/Linux [30] [31] and for Windows [32] [33] that allows controlling a real hand. The package uses CAN communication to interact with the hand’s hardware, processes data, includes some predefined configurations and allows for users to control the hand through keyboard inputs. The BHand library is central to the program as it provides the necessary functions to control the Allegro Hand. Page 52 4.6 The Official Allegro Hand Software Algorithm 1 BHand Control Loop Workflow 1: repeat 2: SetJointPosition(): Provides the current joint position. 3: UpdateControl(): Executes the control algorithm (PD or Gravity Compensator). 4: GetJointTorque(): Retrieves the computed torques. 5: if orientation changes then 6: SetOrientation(): Updates hand orientation if necessary. 7: end if 8: until END This package manages the CAN communications, that allow to send and receive data to/from the Allegro Hand. The main difference between Allegro Hand versions lie on the communications protocol, specifically version 4 is the one that differs the most. For this reason the package to be downloaded depends on the Allegro Hand version being used. For GNU/Linux and for Windows there exist one package for version 4 [31] [33] and another package for version 1, 2 and 3 [30] [32]. The package up until version 3, requires the user to manually change the main.cpp file and add the communication parameters that correspond to the specific Allegro Hand. These parameters are the encoder offset, encoder direction and the motor direction, and these parameters are different for every manufactured hand. The code structure is shared among all version-specific GNU/Linux packages. First, the program creates an instance of the BHand class and sets the time interval of the control loop. Then, it initializes periodic communications with the Allegro Hand. A dedicated thread, ioThreadProc(), continuously reads the messages received from the Allegro Hand. Upon receiving a message with the current joint positions, the desired torque is calculated using the BHand library; first it updates the current and desired joint positions of the BHand object and, then, executes the control algorithm to obtain the desired torques, finally, the computed torques are sent towards the hand. The user interacts with the program through keyboard commands, which are interpreted by the MainLoop() function. In the MainLoop() the program waits for the user input to control the hand. The available commands allow users to: •Move the hand to its home position using the PD control (option <H>). •Move the hand to the pregrasp position using the PD control (option <R>). •Execute a torque controlled grasp using 3 fingers (option <G>). •Execute a torque controlled grasp using 4 fingers (option <K>). •Execute a torque controlled grasp pinch using index and thumb (option <P>). •Execute a torque controlled grasp pinch using middle and thumb (option <M>). •Execute a torque controlled envelope grasp (option <E>). •Set the Gravity Compensation controller (option <A>). Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 53 •Set the servos power off (option <F>). •Quit the program (option <Q>). The program also provides feedback to the user via the console, such as the status of the hand, its joint positions, and any errors encountered during operation. To sum up, the official code allows the user to control the Allegro robotic hand. It manages communications, has a Gravity Compensator and a PD controller and four predefined grasps. 4.6.3 Conclusions The provided official software is a useful tool for controlling the Allegro Hand by managing CAN communications. The Allegro Hand Hardware is designed to receive the desired torque commands, which limits its functionalities and applications. For further implementations such as grasping an object, ensuring stabilityand accuracy, a control mechanism is needed. As it has been previously stated, the official software provides two control mechanisms: •Gravity Compensator Controller. Calculates and provides the necessary torque to counteract the effects of gravity on the hand. It is important to counteract the Gravity effects since the fingers are not weightless. The BHand library allows to update the overall hand orientation (SetOrientation()), so the gravity effects can be neglected regardless of the hand orientation, as long as the hand orientation is known. •Joint Position PD Controller. Employs a PD control algorithm to regulate joint positions. APD controller considers the current error (the difference between the desired and actual joint positions) and the rate of change of this error, providing proportional and derivative actions. This controller allows to calculate and set the desired joint positions. The BHand library allows to change the gains of the PD controller, kpand kd(SetGainsEx()). The choice of the control algorithm significantly impacts the hand performance. While the official BHand library utilizes a PD controller, other controllers like Proportional-Integral-Derivative (PID) offer several advantages, such as correcting steady-state errors more effectively, and are better suited for grasping objects and holding a position [36]. Additionally, four types of grasps are available: grasp using 3 fingers, grasp using 4 fingers, pinch with index and thumb and pinch with middle and thumb. Although, there is no mechanism for storing new hand configurations or grasps. Regarding the kinematics, the BHand library allows to compute the partial forward kinematics. Although the manufacturer allows to read the current fingertips positions, it does not provide the fingertips orientations. Furthermore, partial FK can only computed considering the default fingertip. The full FK is crucial to work with the hand in grasping applications, since the normal force of the contact points is important for grasp quality measures. Moreover, there is no builtin support for IK, which is a useful tool to control the hand by sending fingertip positions (X, Y, Z coordinates) and orientations (Euler angles), instead of joint torques. Inverse Kinematics are essential for moving the fingertips to the desired contact points of a grasp, thus for achieving stable grasps. Page 54 4.6 The Official Allegro Hand Software The manufacturer offers a package for controlling the Allegro Hand within the ROS 1 environment, enabling seamless integration with other robotic systems. However, they currently do not provide a ROS 2 package. This is increasingly important because ROS 1 is only compatible up to Ubuntu 20.04, which limits future compatibility and support as the robotics community shifts towards ROS 2. ROS 2 introduces significant improvements in performance, security, and real-time capabilities. The absence of a ROS 2 package may restrict long-term flexibility and integration potential with modern robotics platforms. The provided software is useful but it lacks many important features, such as the full Forward Kinematics, the Inverse Kinematics, a PID controller, customizable hand configurations and grasps, among others. Additionally the proprietary nature of the BHand library, limits the ability to fully understand, customize and enhance the system. This gap is addressed in the developed software, Allegro Hand Library. By incorporating full FK,IK and customizable hand configurations and grasps, the new software significantly improves the hand’s functionality. Moreover, it allows for more precise and intuitive control through the use of a PID controller. The newly developed open-source software is a robust tool, which will be introduced in Chapter 6. Furthermore, a ROS 2 package has also been created for controlling the hand within the ROS 2 environment, and this package is detailed in Chapter 7. This enhancement not only expands the potential applications of the Allegro Hand but also provides a more powerful platform for research and development in robotic manipulation and grasping theory. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 55 5 Weiss Sensors 5.1 Introduction The Allegro Hand is designed with interchangeable fingertips, enhancing its functionality by allowing the integration of various tactile sensors. Tactile sensors are essential components in robotic hands, as they detect physical interactions with the environment, providing critical information such as contact forces and points of contact [37]. This capability is particularly valuable for grasping and manipulation tasks. Integrating tactile sensors into the Allegro Hand enables the system to gather data about the environment. The sensor data, influenced by the fingertip’s pose and the nature of the objects encountered, is crucial for executing precise grasps. In this project the Allegro Hand adjusts its fingertip pose based on joint position values, and the feedback of the force sensed by each fingertip is vital for assessing the success of a grasp. The Allegro Hand fingertips are switchable, allowing the use of tactile. This section focuses on the Weiss sensors, which have been utilized in this project, although OptoForce sensors have also been considered during development of the software. The Weiss WTS-FT tactile sensor, shown in Figure 14, developed by Weiss Robotics [38] is equipped with a highly sensitive sensor matrix capable of detecting contact forces applied at each contact point. Figure 14: Weiss WTS-FT tactile sensor and sensor matrix illustration. One challenge with these sensors is their susceptibility to temperature variations, which can affect the accuracy of their readings as the system warms up. Furthermore, all fingertip sensors share the same ID, making it impossible to differentiate between them by analyzing their messages. Table 8provides a detailed overview of the key specifications of the Weiss sensors. In this project, the Weiss Sensors Library [39], developed at the IOC, is used to facilitate communication with the sensors. This library is used to obtain a matrix representing the forces detected by the sensor at each contact point of the available contact region. It calculates the weighted mean of the detected forces and retrieves a single contact point, the contact area and Page 56 5.1 Introduction Table 8: Specifications of Weiss Sensors WTS-FT. Specification Details Sensor cells 4 x 8 (32) Spatial resolution 3.8 mm Minimum trigger level (typ.) 5 kPa Full scale level (typ.) 85 kPa Analog resolution 12 Bit Readout rate 400 frames/s Power supply 5V / 50 mA Interface USB 2.0 (CDC Profile) Temperature range 0 to 40°C Electrical connection 4 pin FFC, 0.5 mm pitch Dimensions (L x B x H) 37.5 x 23.3 x 18.9 mm Weight 15 g the detected force. Instead of focusing on the entire contact area, the package focuses on one contact point, a design choice due to the fact that the Allegro Hand fingertips can be positioned in only one specific pose. This single contact point is used in applying grasp theories. Additionally, a ROS 1 package for Weiss sensors was also developed at IOC. This package publishes the contact point, contact area and the detected force. As part of this project, the package was ported from ROS 1 (Noetic) [9]toROS 2 (Humble) [40] to ensure compatibility with the Allegro Hand’s ROS 2 framework. The Allegro Hand Library and the Allegro ROS package include URDF files that define the Weiss sensors as the fingertips, with additional URDF files available for OptoForce sensors and the default fingertips. This chapter will briefly explain the Weiss Library [39] and the Weiss ROS 2 package [40], as these tools are used in this project. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 57 5.2 Weiss Sensors Library The Weiss Sensors Library [39], developed at the IOC, is a software package designed to interface with Weiss WTS-FT tactile sensors. This library manages the communication with the sensor hardware, processes the data received from the sensor matrix, and provides essential functionalities to interpret the tactile information. Central to its functionality are two classes: Weiss_sensor and AsyncSerial. The AsyncSerial class establishes the foundation for asynchronous serial communication, enabling non-blocking operations and data handling. Moreover, the Weiss_sensor class manages direct communication with the tactile sensors, facilitating sensor initialization, data acquisition, and processing of the sensed data. This allows to obtain the sensed force, the contact area and the contact point, defined by the center of gravity of the forces. 5.2.1 AsyncSerial Class The AsyncSerial class provides the underlying asynchronous serial communication framework necessary for the Weiss_sensor class to communicate with the sensor. This class is designed to handle non-blocking read and write operations, ensuring that the sensor data is processed in real-time without delays. The key features of this class are listed below: •Communications Thread: The class manages a dedicated communications thread for handling serial communication. •Asynchronous Communication: AsyncSerial utilizes the Boost.Asio library to manage asynchronous I/O operations. It supports reading and writing data over serial connections without blocking the main execution thread. The class includes error handling mechanisms. The setErrorStatus() method ensures that any communication errors are captured and managed, preventing system crashes or data corruption. •Callback Mechanism: AsyncSerial allows setting callback functions through the setRead- Callback() method. These callbacks are triggered whenever data is read from the serial port. •CallbackAsyncSerial Class The CallbackAsyncSerial class, derived from AsyncSerial class, further simplifies the use of callback functions. It provides methods to set and clear callbacks, making it easier to manage asynchronous data handling. 5.2.2 Weiss_sensor Class The Weiss_sensor class is the core component of the library, responsible for managing the direct interaction with the Weiss tactile sensor hardware. It encapsulates various functionalities required to initialize the sensor, manage data acquisition, and interpret the tactile data. The key features of this class are listed below: •Initialization and Configuration: The Weiss_sensor class provides constructors that initialize the sensor with a specified serial port. During initialization, the init() method is invoked, setting up serial communication by creating an instance of the CallbackAsyncSerial class. It also defines calibration parameters (for pressure and voltage), and the sensor matrix’s resolution and cell dimensions. Page 64 6 Allegro Hand Library 6.1 Introduction The official software for controlling the Allegro Hand [41], while functional, lacks several critical features and its nature limit its ability to be customized and enhanced. To address these limitations, a new open-source and more comprehensive package has been developed and is presented in this chapter. This work builds on previous efforts initiated at the IOC, with the goal of improving and completing the development, previously the control modes and kinematics where developed. The proposed Allegro Hand Library, implemented in C++, has been designed to simplify the usage of the hand while enhancing its functionality. This software handles communications, complete FK and IK, and supports multiple control modes, such as a PID controller. Additionally, it offers both predefined and customizable hand configurations and grasp modes. It supports operating a real Allegro Hand and also can perform a simulation environment. The architecture decouples the drivers (communications and control) from the framework, thereby facilitating integration with other frameworks such as ROS 1, ROS 2, Orocos, and Matlab. The developed software has been designed to work with all Allegro Hand versions and it has been tested with several Allegro Hands including different versions such as version 2, version 3 and version 4. The developed software is intended for researchers, developers, and engineers who require a powerful and flexible solution for controlling robotic hands. Whether the goal is to conduct research in robotic manipulation, develop new control algorithms, or integrate the Allegro Hand into larger robotic systems, this software provides the necessary tools to achieve those objectives efficiently. This chapter provides a detailed guide of the software, including key functionalities, code structure, technical specifications, installation instructions and usage examples. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 65 6.2 Key Functionalities The Allegro Hand Library is a powerful and versatile software package that provides a wide range of features and functionalities to facilitate the control and operation of the Allegro robotic hand. •Suitable for Real-Time Control: The software is developed to be able to work on realtime. Although currently it does not work on real-time yet because the operating system used is not real-time, thus due to the kernel it can not guarantee the sample time in between operations. Nevertheless, it allows users to obtain the current joint positions, as well as moving the hand to a desired configuration or along a trajectory. Before initializing the hand movement, it checks whether the Gravity Compensator or the Torque controller are being used, if so, it switches to a PID controller. •Simulation and Real-World Operation: The library supports operating a real Allegro Hand and also can perform a simulation environment. Users can test and validate in simulation before using the physical Allegro Hand, this reduces development time and ensures safety operations. •Control Algorithms: Users can select the controller algorithm, depending on the task being performed. The available controllers are: – Torque Controller: The Torque controller directly controls the torque applied to each joint. It is a very simple controller that maintains the torques. – Gravity Compensator Controller: The Gravity Compensator is a specialized controller that counteracts the effects of gravity on the hand’s joints. By applying the necessary torques to neglect gravitational forces, enables the hand to maintain its position, making it easier to manually manipulate the hand or hold a pose. – Joint Position PD Controller: Operates by calculating the error between the desired and current joint positions and applying a corrective torque based on the proportional (P) and derivative (D) terms. The proportional term addresses the magnitude of the error, while the derivative term counteracts the rate of change of the error, thus improving system stability and reducing overshoot. Moreover, it also considers the gravitty effects. – Joint Position PID Controller: The PID controller extends the PD controller by adding an integral (I) term, which accounts for the cumulative error over time, thus it handles the steady-state error. Experimentally, the PID controller is the most precise one, as it can compensate for both immediate and long-term discrepancies between the desired and current joint positions. Moreover, it also considers the gravitty effects. – Fake Controller: The fake controller is a controller for the simulation case. •Forward and Inverse Kinematics: Contains functions for computing the full Forward Kinematics and Inverse Kinematics. Enables users to calculate the current positions and orientations of the fingertips (FK) and to move the fingertips to the desired positions and orientations (IK). An essential feature for grasp and manipulation applications. Page 66 6.2 Key Functionalities •Predefined and Customizable Hand Configurations: Users can define and store, temporarily or permanently, custom hand configurations. The analogous physical configuration between the right and the left hand, do not correspond to the same joint values due to differences in joints 0 of the Index, Middle and Annular (IMA) fingers. These discrepancies are accounted for, and, upon saving a hand configuration, the corresponding appropriated hand configuration for the opposite hand is calculated and stored. This feature is particularly valuable for applications that require repetitive tasks or specific hand postures. Additionally, a set of predefined hand configurations is provided. •Predefined and Customizable Grasping Modes: A selection of grasps that allow in-hand manipulation, specifically all types of prismatic precision grasp [11], have been already implemented. Additionally, users can store grasps and hand trajectories. By either providing the final configuration and the desired speed or by recording the current hand state during a period of time while the hand is being manually manipulated. •Open Source and Modular Design: It is an open source library designed to be compatible with various operating systems, including Linux-based platforms. The library is built with a modular architecture, it decouples the drivers (communications and control) from the framework, thereby facilitating integration with other frameworks such as ROS 1, ROS 2, Orocos, and Matlab. The design eases software customization, enabling the development of specialized applications, such as adding new controllers. •Version Agnostic: All the current Allegro Hand versions can be controlled with this software. Additionally, it is designed to facilitate its use for other robotic hands with similar structure, such as the Leaphand [42], requiring only minimal modifications in the communications part, dependent on the communications protocol. •Detailed Logging and Diagnostics: The software provides extensive logging and diagnostic tools, allowing users to monitor the state of the hand, including joint positions, velocities, accelerations, and torques. This feature is essential for debugging and performance analysis. •Extensive Documentation and Examples: Comprehensive documentation and a variety of example programs are provided, making it easier for users and developers to get started. The examples demonstrate all the functionalities of the software. The library’s design and capabilities are tailored to support advanced robotic grasps and manipulation tasks, enabling users to achieve precise and reliable control of the Allegro Hand. These features make the Allegro Hand Library a robust and adaptable tool for researchers, developers, and engineers working with robotic hands. The following sections will delve into the detailed implementation of this software, providing insights into the underlying code structure, the classes and key methods. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 67 6.3 Code Structure The developed software package is structured into five interconnected classes, each playing a specific role in the functionality of the Allegro Hand (Figure 15). The primary class is the AllegroHand class, which orchestrates the overall operations by embedding instances of the other classes. This class derives from the AllegroHandDriver, responsible for communications and basic control of the hand, it integrates the CAN_AH class for managing CAN bus communication with the physical hardware. The control algorithms for the hand are encapsulated in the AllegroHandController class, which offers various control modes, including torque control and gravity compensation. The kinematic modeling of the fingers is handled by the AllegroFinger class, which provides both Forward and Inverse Kinematics functionalities. Together, these classes form a cohesive system that supports both real and simulated operation of the Allegro Hand, ensuring efficient control, communication, and kinematic computations. Figure 15: Structure of the classes of the developed software package. Page 68 6.4 Software Walkthrough 6.4 Software Walkthrough This section provides a detailed walkthrough of the developed software. First, the organization of the code’s files and directories will be presented. Then, the functionality of each class will be thoroughly explained, covering the purpose of the class, its constructors, and key methods. The goal of this section is to provide a comprehensive understanding of all the classes in the software and how they interact with one another. 6.4.1 File and Directory Organization The developed software for controlling the Allegro robotic hand is organized into a comprehensive set of directories and files. Each directory serves a specific purpose within the overall framework of the software, ensuring modularity and ease of maintenance. •cmake-modules directory: This directory contains essential CMake files, such as Find- Filesystem,FindPCAN, and FindPCANBasic. These files are necessary for configuring the build environment and locating necessary dependencies. •conf directory: This directory holds configuration files related to the Allegro Hand and is subdivided into several sub directories: – configuration_files directory: Contains YAML files detailing the initialization parameters required for the Allegro Hand. Each manufactured hand has unique parameters. The hand configuration file name includes the hand’s serial number. The YAML files are organized into three primary parameter groups: ∗Basic Information: Includes the serial number, version, and DOF of the hand, as well as the control period and the URDF file name. ∗Communication Parameters: Specifies the encoder offset and direction and the motor direction of each joint. ∗Filter Coefficients: Contains coefficients for filtering joint position and velocity data. Additional metadata, such as the manufacturer or origin, can be included but is not required for software operation. The naming convention for the hand configuration files follows the format: hand_name.yaml. Currently, the hand_name convention used is the serial number of the hand, but as long as this structure is fulfilled, other developers can choose any desired hand_name. – controllers directory: This sub directory contains YAML files defining the controller parameters for specific hands. Parameters for the JointPositionPD and JointPosition- PID controllers are specified here, including proportional (k_p), derivative (k_d), and integral (k_i) gains for each joint. The files are named using the format: hand_name + ’_’ + controller_name.yaml. – configurations directory: Stores predefined hand configurations within YAML files. The directory is further divided into sub directories for right and left hands. Each file in these sub directories includes multiple hand configurations, each defined by a Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 69 unique name and 16 joint position values in radians. The file names are arbitrary. – trajectories directory: This directory is partitioned into sub directories for left and right hands, each containing YAML files that define trajectories through sequences of hand configurations. These configurations consist of 16 joint position values in radians. Additionally, the finger_poses sub directory stores trajectories specified by fingertip positions and orientations, represented by 4 sets of XYZ coordinates and 4 sets of ZYZ Euler angles, respectively. The naming convention for these files is: trajectory_name.yaml. – urdf directory: Contains URDF files necessary for the hand’s simulation and operation. The meshes sub directory includes STL files required for 3D modeling. Different URDF files exist for right and left hands and for different fingertips. The Allegro Hand allows to switch the default tip to add tactile sensors (e.g., Weiss, Optoforce). The naming convention for these files is: ’allegroHand_’ + hand_type + ’_’ + tip_name.urdf. – joint_limits directory: Holds YAML files with the real joint limits for a specific hand. These files are automatically generated using the calculate_joint_limits program, which records the minimum and maximum joint values. The naming convention for these files is: hand_name.yaml. •examples directory: This directory provides example programs for controlling the Allegro Hand. These programs enable users to interact with the hand via keyboard input, with available functions and corresponding key mappings displayed in the console. Later on, these programs will be presented. •include directory: Contains header files (.h) that define the classes and methods used in the software. •src directory: Contains the source code (.cpp files) implementing the functionality of the classes. The AllegroHand class alone spans nearly 3000 lines of code, with methods distributed across multiple files to enhance readability and maintainability. These files include: –AllegroHand.cpp: Core implementation of the AllegroHand class. –AllegroHandConfigurations.cpp: Manages hand configurations and trajectories. –AllegroHandControl.cpp: Implements control algorithms. –AllegroHandJointLimits.cpp: Related with hand joint limits. –AllegroHandKinematics.cpp: Manages kinematic calculations and properties. Additionally, the software package includes: •README.md file: Provides a general overview of the software, including system requirements, necessary packages, and libraries. It also offers a brief description of the software’s structure, key classes, and functions, along with instructions for running the provided programs. This documentation is crucial for users to successfully deploy the software to Page 70 6.4 Software Walkthrough control the Allegro Hand. •package.xml file: Specifies the package information, including dependencies, build type, and versioning, to facilitate integration with ROS. •CMakeLists.txt file: Defines the build process for the software, specifying the source files, include directories, and any necessary compilation flags. This file ensures that the software is correctly compiled and linked on the target system. 6.4.2 The CAN Communications Class: CAN_AH The CAN_AH class is a software module designed to manage communication between the computer system and the robotic hand through a CAN interface. It enables communication with the Allegro Hand, since it allows to start and stop communications, generates messages to send torques and parses the received messages to retrieve the current hand configuration. This class supports all AH versions. Due to differences between versions in the Allegro Hand communication protocol, there exist two analogous sub classes, one for versions 1, 2 and 3 and another subclass for the latest version, version 4. There are two libraries available for using with CAN Bus communications, the PCAN and the CAN library. The CAN library can be used with the Linux kernel as a network driver, although the implementation is more complex. This implementation has used the PCAN library, specifically the PCANBasic library, because this powerful library eases the process of handling CAN Bus communications. Constructor The constructor of the communication class initializes the CAN communications with the hand and it sets a 3 ms periodic communication. The AllegroHand sends one message per finger, and it is always sent in the same order. Thus, for ensuring that the finger messages belong to the same time, the constructor also performs an initial read in order to identify the ID of the finger of the first message. The constructor of the CAN_AH class initializes the CAN communication channel and configures it based on the version of the robotic hand specified. It has two input parameters: •channel: A string containing the appropriate CAN channel for communication. The channel depends on the port of the computer system where the Allegro Hand is connected to. •params: A Parameters struct that contains information of the Allegro Hand. The Parameters struct can contain the serial number of the hand, the hand version and the motor direction, the encoder offset and the encoder direction. The initialization process starts by handling the version, depending on the hand version, a specific handler (CAN_AH_V3 or CAN_AH_V4) is created. These handlers encapsulate versionspecific operations. Up next, the class retrieves and sets the appropriate CAN channel for communication. To do so, it uses the channelToBus() private method to map a logical channel number to a physical CAN bus handle. The next step consists on initializing the CAN channel with the initCAN() private method, by setting the appropriate baud rate (1Mbps) and resetting the CAN controller. This is essential for establishing a reliable communication link. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 71 The constructor then, starts the CAN communication with the Allegro Hand using the specific handler for the hand’s version. The CAN communication is started in the startCAN() private method. This function starts requesting the hand information and displaying it on to the console. Up to version 3, the Allegro Hand information provided by the hand through the CAN bus communications is the hardware and firmware version. Whereas, version 4 does not only provide the hardware and firmware version, it also specifies the hand serial number, the hardware type, which is the type of hand (0 for right and 1 for left), the temperature of the hand, the hand and servo status and whether the hand has a fault due to high temperature or internal communications. It proceeds by setting the communication period to 3 ms, this is executed through the private function command_set_period(). This is the minimum time period allowed by the Allegro Hand according to the communications protocol provided by the manufacturer. As it has been previously stated, the Allegro Hand sends one message per finger. Each message has an identifier that indicates which finger the message belongs to. The Allegro Hand messages are orderly fashioned, the order is Index, Middle, Annular and Thumb. Since the communications are set to periodic, the AH continuously sends messages containing the current joint position values of the fingers. The whole hand information is sent using 4 messages, each message batch is sent every 3 ms. To guarantee the correct functionality of the hand, and that each time that a batch of messages is read, these messages correspond to the same timestamp, a batch of messages is read and the ID of the Index finger is retrieved and stored using getIDFirstFinger(). To ensure that no old or irrelevant messages interfere with the hand operation, the CAN buffer is cleared at startup. The pseudocode of the CAN_AH Constructor of the Allegro Hand Library is shown in Algorithm 3. Destructor The Destructor of the CAN_AH class safely shuts down the CAN communication by stopping the hand and closing the CAN channel using the provate methods command_can_stop() and command_can_close(), respectively. Key Methods Below, all the class public methods are discussed. The overall structure of these methods is identical for CAN_AH_V3 and CAN_AH_V4. These methods can be divided into the ones related to reading the current joint positions and the ones related to sending the desired torque commands towards the Allegro Hand. Annex A.4 contains the pseudocode of the key methods. •Reading methods. The methods related to retrieving the current hand configuration are listed below. 1. readDataTimeStamp(): Reads CAN messages, that contain the whole hand information, this is the current 16 joint position values, and updates the timestamp information. The CAN_Read() function is used to read the received messages. This method ensures that each one of the four messages belong to each one of the fingers. It also verifies that the four messages belong to the same periodic reading by checking the ID of the first message. Additionally, it checks the validity of the messages, in case any message fails an error is logged into the console. Otherwise, the read messages and the corresponding timestamp are stored in a TPCANMsg and a TPCANTimestamp private variables, called lmsgs and timeStamp, respectively. Page 72 6.4 Software Walkthrough Algorithm 3 CAN_AH Constructor Pseudocode 1: Input: channel (CAN channel), params (Allegro Hand parameters) 2: Set run_commLoop to true 3: Get hand_version from params 4: if hand_version ≤3.0 then 5: Create Version3Handler instance 6: Call initV3(params) 7: else 8: Create Version4Handler instance 9: end if 10: Map the channel to CAN bus using channelToBus(channel, bus) 11: Initialize the CAN channel using initCAN(bus) 12: if initialization fails then 13: Throw error and exit 14: end if 15: Start CAN communications with the AH using startCAN(CAN_Ch) 16: Clear the CAN buffer by reading 3000 messages 17: Retrieve ID of the first finger message using getIDFirstFinger() 18: Store the finger ID in versionHandler->ID_MSG_FIRST_FINGER 19: End of Constructor 20: 21: function startCAN(CAN_Ch) 22: *Using the specific VersionHandler for communication* 23: if hand_version == (3.0 || 4.0) then 24: Set tau_cov_const to 1200.0 25: else 26: Set tau_cov_const to 800.0 27: end if 28: if hand_version == 4.0 then 29: Query and display AH hardware and firmware version, serial number, temperature, hardware type and fault status. 30: else 31: Query and display AH hardware and firmware version. 32: end if 33: Set communication period to 3ms using command_set_period() 34: if setting period fails then 35: Throw error and close CAN communication 36: end if 37: Start periodic CAN communication using command_can_start() 38: if starting communication fails then 39: Throw error and close CAN communication 40: end if 41: end function Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 73 2. readDevices(): Parses the read messages to extract the information and store the joint position values of the hand. This method parses the messages stored in the lmsgs TPCANMsg variable using the parseCANMessage() function. The parseCAN- Message() function, starts by extracting the data and the ID of each message. Then it ensures that the message ID corresponds to a message containing the joint position values of a finger. If so the data is processed, which involves separating the raw data of each one of the four joints of the finger. And then converting the raw data of each joint from encoder units to joint position values in radians. The conversion equation used depends on the Allegro Hand version as it has been shown in the Communications Protocol section, up until version 3 the conversion is given by Equation 4, Equation 5provides the conversion for AH version 4. The joint position values obtained with the parseCANMessage() method are stored in a private variable called position. In case any message fails an error is logged into the console. For optimal results, readDataTimeStamp() method should have been called first. 3. getPosition(): Retrieves the current joint position values of the hand, copying it from the private variable position. For optimal results, readDevices() method should have been called first. 4. getTimeStamp(): This method retrieves the timestamp of the read messages copying it from the private variable timeStamp. Specifically the timestamp obtained corresponds to the timestamp of the first of the four messages read. For optimal results, readDataTimeStamp() method should have been called first. The workflow for obtaining the current hand configuration, the method readDataTimeS- tamp() has to be called first, in order to read and store the messages containing the hand information. Then, the method readDevices() has to be called to parse those messages and update the private variable position. Finally, the getPosition() method will retrieve the hand joint position values. •Writing methods. The methods related to retrieving the current hand configuration are listed below. 1. setTorque(): Sets the torque values of all the joints of the hand by copying them into the private variable torque. These torque desired values are the ones that are going to be sent towards the hand. 2. writeDevices(): Moves the Allegro hand by sending torque commands towards the robotic hand. It creates and sends four messages, one per finger, to the Allegro Hand with the desired torque values. To send a batch of messages with the desired torques, first the values of each joint need to be converted using the tau conversion constant (Equation 6). Then, the messages are sent using the method command_set_torque(), this method generates the message containing the desired joint data and sends it towards the hand using the canSendMsg() function. For optimal results, setTorque() method should have been called first. 3. getTorqueConversion(): Retrieves the tau conversion constant of the Allegro Hand. This value depends on the Allegro Hand version being used. Page 80 6.4 Software Walkthrough mation from one joint to the next in terms of rotation and translation. Concurrently, the method multiplies these HT matrices in sequence to compute the cumulative transformation from the base of the finger to the fingertip (Equation 7). This final matrix represents the position and orientation of the fingertip relative to the base of the finger. Finally, the matrix is returned as the result of the forward kinematics computation of the fingertip position of the finger. 2. eul2Tmat(): Converts a given a position (X, Y, Z coordinates) and orientation, specified by the ZYZ Euler angles configuration, into a homogeneous transformation (HT) matrix, a 4x4 matrix combining both rotation and translation. This method is crucial, for instance to obtain the transformation matrix from the base of the hand to the base of the finger, T_world_base. 3. getJointAngles(): Retrieves the last computed joint angles of the finger. Returns the value of the class variable joint_angles, that represent the angular positions in radians of the finger’s joints. 4. getTransformationMatrix(): By passing an index, it retrieves the corresponding HT matrix, which represents the transformation between consecutive joints. 5. getTotalTransformationMatrix(): Returns the complete HT matrix that represents the transformation from the base of the finger to its fingertip. This matrix encapsulates the cumulative transformations through all joints and links, providing the pose of the fingertip with respect to the base of the finger. 6. getTF_w2b(): Returns the static HT matrix that relates the world coordinate frame, this is the base of the hand, to the base of the finger. 7. getTF_tcp2tip(): Retrieves the static homogeneous transformation matrix that represents the transformation from the TCP to its fingertip. Related classes As it has been previously stated, the IMA fingers kinematic chain is shared among these fingers, whereas the Thumb kinematic chain is different. This results in having two child classes that inherit from the AllegroFinger class, one for the IMA fingers, IMAFinger, and another for the Thumb, ThumbFinger. Both classes use the AllegroFinger constructor by passing the class input parameters. The Inverse Kinematics procedure is different for each class, thus the specific methods of the class are related to computing the IK. Depending on the input provided there are two types of IK procedures to compute the joint position values: •Providing the fingertip desired frame, defined by the desired fingertip position (X, Y, Z coordinates) and orientation (Euler angles), defined with respect to the base hand frame. •Providing the fingertip desired fingertip position (X, Y, Z coordinates) and the desired fingertip normal vector, defined with respect to the base hand frame. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 81 The reason for the existence of this two IK procedures lies on the fact that the former one, considering a desired frame, was previously developed by another student, Alex Mauricio Calle Clavel. Then while working on applying grasping theoretical methods, it was required to move the fingertips into a desired position and normal. Which lead to reconsidering the IK procedure, since due to the physical structure of the hand only one finger configuration could achieve the desired fingertip position and normal. Moreover, the two methods are different since the first one focuses on optimization procedures, computing the IK in different stages, while the new IK method uses geometrical procedures. To differentiate both methods the former one is called Ikine(), while the new method is called IkineNormal(). •IMAFinger 1. Ikine(): The method starts by converting the desired fingertip pose, into a HT matrix, using the eul2Tmat() function. The obtained matrix is defined with respect to the base hand frame. This matrix is converted into the finger’s base frame. Then, the method extracts the translation part and the rotation part of the transformation matrix, which is used to obtain the Euler angles. These angles represent the desired orientation of the fingertip in the finger’s base frame. Before proceeding with IK computation, the method checks if the desired fingertip position is within the finger’s reachable workspace, using the checkPointInsideWs() function. The reachable workspace was computed in Matlab and hardcoded into the class. If the position is outside the workspace, the method terminates early displaying the error into the console. The IK calculation process is divided in 3 stages. –Stage 1. First it attempts to find a direct IK solution with the initial desired orientation with respect to the finger base frame. To do so, first calculates the possible solutions for the first joint, theta_0, using trigonometry, ensuring that the solution is within the feasible range. Next, the method computes the translation vector from the first joint to the goal frame. Which is used to compute the remaining joint angles, through the Siciliano method for solving the 3 link planar arm IK problem. As a result, two potential solutions for each joint angle are obtained due to the nature of trigonometric functions used. The computed joint angles are checked for feasibility, to ensure that the values are within the mechanical limits of the joints. The Siciliano method stated that in case the subtraction variable is negative there does not exists a feasible solution. This method iteratively changes the desired fingertip orientation, using a small reorientation increment and recomputes the joint angles (theta_1, theta_2 and theta_3) until a feasible solution is found or all possibilities are exhausted. If the solutions are not feasible, the method proceeds with Stage 2. –Stage 2. In case no feasible solution has been found, the desired frame orientation is switched. This stage computes the IK so that the Z axis of the given desired fingertip frame matches the Z axis of the new desired fingertip frame. It proceeds similarly to stage 1, it introduces small orientation adjustments and re- Page 82 6.4 Software Walkthrough computes IK to obtain the remaining joint angles (theta_1, theta_2 and theta_3), until a feasible solution is found or all possibilities are exhausted. The computed joint angles are checked for feasibility, to ensure that the values are within the mechanical limits of the joints. If the solutions are not feasible, the method proceeds with Stage 3. –Stage 3. Analogously to stage 2, the desired orientation frame is rotated. The joint angles are found by continuously adjusting the orientation and recomputing the IK when computing theta_1, theta_2 and theta_3 until a feasible solution is found or all possibilities are exhausted. The computed joint angles are checked for feasibility, to ensure that the values are within the mechanical limits of the joints. The method finally returns the computed joint angles in case a feasible solution has been found, otherwise an error is displayed into the console. The final orientation of the fingertip frame may not be the same as the desired orientation proposed. 2. IkineNormal(): The function is responsible for computing the joint angles required to achieve a specified fingertip position and normal vector, relative to the base of the hand. First, sets the input with respect to the base of the finger, then determines the plane that includes the Z-axis of the finger’s base, the desired contact point, and the fingertip’s normal vector. The angle between this plane and the XZ plane provides the value for joint 0, the only joint that rotates along the Z-axis. If this angle falls within the joint’s physical constraints, the remaining joints are treated as a planar 3- link arm, allowing the function to compute the necessary joint angles to achieve the desired fingertip position and normal. The IK problem for the IMA fingers given the fingertip position and normal was thoroughly detailed previously, where the mathematical foundation and implementation approach were described. The function ensures that the computed joint angles respect the physical limits of the Allegro Hand, returning a boolean value indicating the success or failure of the IK computation. •ThumbFinger 1. Ikine(): The method starts by converting the desired fingertip pose, into a HT matrix, using the eul2Tmat() function. The obtained matrix is defined with respect to the base hand frame. This matrix is converted into the finger’s base frame. Then, the method extracts the translation part and the rotation part of the transformation matrix, which is used to obtain the Euler angles. These angles represent the desired orientation of the fingertip in the finger’s base frame. Before proceeding with IK computation, the method checks if the desired fingertip position is within the finger’s reachable workspace, using the checkPointInsideWs() function. The reachable workspace was computed in Matlab and hardcoded into the class. If the position is outside the workspace, the method terminates early displaying the error into the console. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 83 The position components are extracted and used to find the IK solution of the thumb, through the method systemEquationsSolver(). This solution was implemented by Alex Mauricio Calle Clavel. 6.4.5 The Basic Driver Class: AllegroHandDriver The AllegroHandDriver class is a basic driver to communicate and control the Allegro robotic hand, without implementing any advanced control algorithms. It can only run real Allegro Hands, although a simulated constructor is also included. It reads the hand configuration file, handles communication with the hand since it allows reading the current joint positions and setting specific torques. It contains an instance of the CAN_AH class. Constructors There are three constructors available, one for the real hand, one for the simulated hand and an empty constructor. Annex A.8 contains the pseudocode of the constructors. •Constructor for a Real Hand: The input parameters include: –_conf_file: Hand configuration filename or file path. An string variable that can be the path of the configuration file or the filename, with or without the .yaml extension. –_pcan_port: Communications port. –_channel: CAN communications channel. –_driver_loop: A boolean to decide wether to create a control thread inside the driver to continuously read and write hand states. Starts by initializing four member variables: torque is set to a zero vector, device is initialized to nullptr, the driver_loop is set to the input variable _driver_loop, and the additional flag variable of the driver loop is set to true status_driver_loop. The device variable is the one that will contain the CAN_AH object. The constructor first obtains the conf folder directory using the private method getConfDirectory(). This method stores in the class variables hand_name and directory_conf_folder, the filename of the hand configuration file and the absolute path of the conf folder. It has as an input parameter _conf_file, that can be a filename or a relative or absolute file path. The conf/configuration_files folder contains the configuration files of several hands. Each manufactured hand has its own file, due to the varying parameters between manufactured hands. The configuration files are named using the serial number of the hand, in case the user wants to add a new configuration file it is a good practice to use the serial number of the hand. The constructor proceeds by reading the YAML hand configuration file through the method readConfigurationFile(). Which stores the hand serial number and version, the URDF filename and the communications parameters, such as the encoder offset, the encoder direction and the motor direction and the filter coefficients for the controllers. This method searches in the URDF filename ’left’ and ’right’ to store the hand type. Moreover, the URDF is stored as a string. Page 84 6.4 Software Walkthrough The constructor instantiates a CAN_AH class to initialize communications with the hand. In case _driver_loop input is set to true, it starts a thread to continuously read and write hand states, through the driverLoop() method. The constructor initializes the maximum torque values variable, torque_max. •Constructor for a Simulated Hand: Similar to the real hand constructor but tailored for a simulated environment. It only contains one input parameter, the hand configuration filename or file path, _conf_file. Starts by initializing three member variables: torque is set to a zero vector, device is initialized to nullptr, the driver_loop is set to false. As before, the constructor first obtains the conf folder directory using the private method getConfDirectory(). This method stores in the class variables hand_name and directory_conf_folder, the filename of the hand configuration file and the absolute path of the conf folder. The constructor proceeds by reading the YAML hand configuration file through the method readConfigurationFile(), that has been described in the previous constructor. It also initializes the maximum torque values variable, torque_max. •Empty Constructor: The empty constructor has no input parameters. It initializes three member variables: torque is set to a zero vector, device is initialized to nullptr, and driver_loop is set to false. The constructor body is empty, meaning no additional operations are performed during initialization. The body parts of the constructor for the real hand and for the simulated hand are grouped in the setUpAHD() method. When the method has one input parameter, the configuration hand file conf_file, it corresponds to the body of the constructor for the simulated hand. Otherwise, if the method has three parameters, conf_file,pcan_port and channel it corresponds to the body of the constructor for the real hand. Destructor Ensures that resources are released properly, such as stopping the hand and freeing up memory by deleting the communication device Key Methods The key methods of the AllegroHandDriver are listed below. These methods can be grouped in related to reading hand’s joint positions are getCurrenStateComm() and getCurrenStateLoop(), related to sending torques towards the hand are setTorque() and sendTorque(), safety methods (stopHand()) and the driver loop method, driverLoop(). 1. getCurrenStateComm(): This method can only be used when working with a real hand. Retrieves the current joint values in radians from the real hand. The CAN_AH instance is being used in this method. For obtaining the current hand configuration, the method readDataTimeStamp() of the CAN_AH object is called first, in order to read the messages containing the joint position values of the hand. Then, the method readDevices() of the CAN_AH object is called to parse those messages. Finally, the getPosition() method of the CAN_AH object returns the current hand joint position values. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 85 2. getCurrentStateLoop(): This method can only be used when working with a real hand, and the control loop is in the AllegroHandDriver class. 3. setTorque(): Stores the desired torque in the class variable torque, ensuring the torque values remain within predefined limits. Can set the torques of the entire hand or only the torques of one finger, in that case, the other fingers torque will remain constant. 4. sendTorque(): Directly sends the desired torque to the hand after checking that the values are within acceptable limits. The CAN_AH instance is being used in this method. It has as an input the desired torques. First, the setTorque() method is called and then the methods setTorque() and writeDevices() of the CAN_AH object are called to send the torques to the hand. 5. stopHand(): Stops all communication and control threads, ensuring the hand is safely powered down by sending zero torque values. 6. driverLoop(): The developed software is designed to be controlled by only one loop. This method contains a basic control loop of the Allegro Hand. It runs in a separate thread if the driver_loop option is enabled. The driver loop continuously reads the current state of the hand, by calling the method getCurrentStateLoop() and sends the desired torque towards the real Allegro hand. 7. getTorqueConversion(): Retrieves the tau conversion constant of the Allegro Hand using the method getTorqueConversion() of the CAN_AH object. 6.4.6 The Primary Class: AllegroHand The AllegroHand class is the most crucial, since it is a derived class from the AllegroHandDriver and embeds instances of the other classes. When initialized it reads a configuration file, the URDF and predefined joint configurations and grasp modes. It can run both a real Allegro Hand or a simulated one. It instantiates a AllegroController class (Torque or Fake for real or simulated, respectively) and four instances of the kinematic classes (one per finger, thus three IMAFinger and one ThumbFinger). In both cases it contains a thread executing the main -and onlyloop, controlLoop or controlLoopFake (Figure 16). When working with a physical hand, it initializes an instance of the CAN_AH class for communication and finds the available controllers. The controlLoop reads current joint configurations, executes the current controller and sends the desired torques to the Allegro Hand. The control- LoopFake executes the fake controller, ensuring the desired torques are within the limits of the simulated hand. The AllegroHand key features of the AllegroHand class are listed below. •Control algorithms: It allows users to obtain a list of the available controllers, set the desired controller, get the current controller and obtain joint position errors. It can also get and set the hand gravity vector, used to calculate the necessary torque to compensate the gravity effect, considering the hand orientation. This feature is important when the hand is installed on a robot arm whose movement affects the hand gravity vector. When switching the controller, the previous controller instance is deleted, ensuring efficient memory management. Page 86 6.4 Software Walkthrough Figure 16: Main control loop for the real and the simulation case. •Hand configuration: It allows to obtain the current joint positions and set the desired ones. It can read YAML files with predefined configurations, list all saved configurations, temporarily add and delete configurations from the list, permanently store a configuration into the desired YAML file and move the hand to a new or a predefined configuration, among other functionalities. •Grasps modes: It allows to move the hand to a predefined grasp configuration along a given trajectory. Additionally, it can read and store trajectories to perform different grasp types from YAML files. •Forward and Inverse Kinematics: These functions compute the FK and the IK of the hand. Moreover, there is a function to obtain the Jacobian, which uses the kinematic chain built from the URDF model using the KDL library. Constructor The AllegroHand class provides an interface for controlling and simulating the Allegro robotic hand. The class extends from the AllegroHandDriver class, which encapsulates the basic driver functions necessary for communicating with the robotic hand. There are three constructors available, one for the real hand, one for the simulated hand and an empty constructor. The differences between initializing a real and a simulated hand are noticeable in the constructor method. For this reason each constructor is explained separately, first stating the input parameters and then the constructor method will be explained. The procedure has been grouped into five different sections in order to highlight the differences between the constructor for the real and the simulated hand. These differences between the constructors are Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 87 shown in Figure 17, which contains an scheme of the AllegroHand class initialization. Figure 17: Schematic of the AllegroHand class initialization. •Constructor for a Real Hand: Initializes a real Allegro Hand. To do so, stores the hand information and sets up the CAN communications, instantiating a CAN_AH class. Additionally, it computes the kinematic chain of the hand and instantiates four AllegroFinger classes to handle the kinematics. Moreover, it stores all the available controllers names and sets the torque control as the initial controller with commanded torque initialized to zero. The constructor starts the control loop thread to control the real Allegro Hand. The input parameters are: –_conf_file: Hand configuration filename or file path. An string variable that can be the path of the hand configuration file or the filename, with or without the .yaml extension. –_pcan_port: Communications port. –_channel: CAN communications channel. Now, the constructor method for a real hand will be explained in detail, the process is enumerated since the constructor of the simulated hand share many steps. Page 88 6.4 Software Walkthrough 1. Start hand communications and store basic information. The constructor initializes several member variables to default parameters: –moving is set to false. –link_prefix and joint_prefix are initialized as empty strings. –q_desired is initialized to a zero vector. –status is set to true. –listening_to_trajectory_to_store is initialized to false. –safety_margin_joint_limits_values is initialized to a vector of 16 elements, all set to 0.0. The constructor initializes the AllegroHandDriver constructor for the real hand with the _driver_loop parameter set to false, and passing the input parameters _conf_file, _pcan_port and _channel. Once this is done, the information extracted from the hand configuration file and the corresponding URDF will be stored. This information involves the hand name, serial number, type (right or left) and version, the communications parameters (encoder offset, encoder direction and motor direction), the filter coefficients for the controllers, the maximum torque values and the URDF information as an string. Also, the conf folder directory will be stored in the class variable directory_conf_folder. Additionally, an instance of the CAN_AH class is added to initialize communications with the real hand. The torque conversion constant is stored using the getTorqueConversion() method. 2. Read the URDF and instantiate the kinematics classes. Concurrently, the constructor extracts the information of the URDF string, through the method readConfURDF(). This method reads the URDF extracts important information about the hand’s joints and kinematics. This includes joint limits (position, velocity, and torque), the coordinate position of joints (origin), and the lengths of the finger links. Additionally, it constructs the Kinematic Description Language (KDL) tree and the finger kinematic chains, which are crucial for performing kinematic calculations on the hand. For each two kinematic chains have been stored, finger_chain and chain, the arrays contain the kinematic chain of all the fingers of the hand. The former, finger_chain, represents the kinematic chain of the finger without considering the very last link, the tip link, this one will be used when virtual segments are added to the kinematic chain. While the latter, chain, is the actual physical chain, including all joints and the final tip link. The constructor also initializes four AllegroFinger classes corresponding to each Allegro finger; three IMAFinger classes and one ThumbFinger class. To do so, the values extracted from the URDF are passed as input values of these classes. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 89 3. Store the available controllers and set the initial Torque controller. The constructor adds to the list of available controllers controller_names the torque and gravity compensator controllers, "Torque" and "GravityCompensator", respectively. Some controllers, such as PD and PID, have parameters that can be tunned and that change depending on the manufactured hand and application. For this reason, a YAML file containing these parameters is stored in the conf/controllers folder. The filename contains the hand name and the controller name. The list of the available controllers gets completed using the searchControllers() method. To do so, this method iterates through all the files of the conf/controllers folder and stores the controllers whose filenames contain the current hand name. Then it initializes the torque controller through the method setController(), that creates an instance of the corresponding AllegroHandController class. 4. Initialize the control thread. Up next, the control thread, responsible for running the control loop, controlThread, is initialized. The controlLoop() function is started in the control thread. By launching the control loop in a separate thread, the loop continues running without being blocked by the main program operations. The controlLoop() method implements the main and only control loop of the AllegroHand. It continuously reads the current state of the hand, q_current, by calling the method getCurrentStateLoop(). Then, if the controller is available, the executeController() method of the corresponding AllegroController class is called to compute the desired torques. Finally, the calculated torques are sent towards the real Allegro hand using the method sendTorque(). This loop uses mutexes to update the previous hand configuration and the status flag, q_prev and status. In case the status flag is false, then the control loop stops. 5. Read predefined configurations and trajectories. Finally, the AllegroHand constructor reads the predefined configurations and trajectories. First, it stores the filepath of the files that will contain the hand configurations permanently stored by the AllegroHand class. There exist one file for storing the left hand configurations and one file for the right hand configurations. Additionally, all the files of the conf/configurations/left or conf/configurations/right folder are read and all the configurations within each file are stored in the class variable configurations_list. This variable maps the names and the corresponding joint position values. Then, the method readTrajectories() is called. This method stores the available trajectory names, by storing the names of all the files within the conf/trajectories/left or conf/trajectories/right folder. Each trajectory file contains only one trajectory, the name of the file corresponds to the trajectory name. Moreover, the list of filenames of the conf/trajectories/finger_poses folder is also stored. This list contains the list of trajectory names corresponding to the trajectories defined using the fingertips positions and not the joint position values. The constructor prints a list of the available configurations and trajectory names. Page 96 6.4 Software Walkthrough speed, considering the sample period. Then it computes the differential values for each joint, creating a list of interpolated configurations between the initial and final configurations. All fingers reach the final position simultaneously. –Given the final hand configuration and a desired velocity percentage. The procedure is identical to the previous one, although the initial hand configuration value is defined with the current joint position values. –Given a trajectory and a maximum velocity value in rad/s. Slows down the trajectory. It considers the sample time and the maximum velocity to calculate the maximum allowed difference between two consecutive joint position values of the trajectory, this will be the threshold. Then for each hand configuration of the trajectory, it checks that the maximum joint difference between the current and the previous hand configuration of the trajectory is smaller than the threshold. If not it computes and adds to the trajectory the necessary hand configurations to adapt the velocity. 10. ConvertTrajectoryFromConfigurationToPoses(): Converts a trajectory defined by a list of hand configurations into a trajectory defined by a list of fingertip poses, through the use of the computeFK() method. 11. moveAlongTrajectory(): Moves the hand along a trajectory defined by a list of hand configurations. The method first checks the current controller being used. In case that the current controller is either the Torque or the Gravity Compensation controller, the method sets the PID as the current controller, through the setPIDController function. This method is only executed in case the class flag moving is set to false. If so, the method sets moving to true and starts a loop, that is going to be executed as long as moving is true. Once the loop finishes, moving is set to false. The loop updates the hand desired joint position values, q_desired using the setDesiredConfiguration() method. At each iteration, the joint positions of a hand configuration of the trajectory is sent, until the final hand configuration is achieved. Then, the loop is paused, the time that is paused is equal to the control time period. There exist several ways of executing this method depending on the information provided: –Given the trajectory. –Given the trajectory name. The trajectory is obtained through the readTrajectory() method. –Given the trajectory and a maximum velocity value in rad/s. The new slowed down trajectory is computed using the computeTrajectory() method. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 97 –Given the trajectory name and a maximum velocity value in rad/s. The trajectory is obtained through the readTrajectory() method and then slowed down using the computeTrajectory() method. –Given the initial and final joint positions and a velocity percentage value. It uses the moveToConf() method. 12. moveAlongPosesTrajectory(): Moves the hand along a trajectory defined by a list of fingertip poses. Similar to the moveAlongTrajectory() method, although it uses the executeIK() method instead of the setDesiredConfiguration() method. 13. moveGraspPrismatic3(): Executes a grasp using 3 fingers, the Index, the Middle and the Thumb. The initial and final values of the grasp are hardcoded in the method. The moveAlongTrajectory() method is executed. 14. moveGraspPrismatic4(): Executes a grasp using all fingers. The initial and final values of the grasp are hardcoded in the method. The moveAlongTrajectory() method is executed. 15. moveGraspPinchIndexThumb(): Executes a grasp using 2 fingers, the Index and the Thumb. The initial and final values of the grasp are hardcoded in the method. The moveAlongTrajectory() method is executed. 16. moveGraspPinchMiddleThumb(): Executes a grasp using 2 fingers, the Middle and the Thumb. The initial and final values of the grasp are hardcoded in the method. The moveAlongTrajectory() method is executed. 17. coupledClosing(): Performs a copuled closing, the joint position values are incremented so the hand closes. There are several ways of executing this method depending on the information provided: –Given 16 coupling values [º], one per each joint. Performs a coupled closing of all the joints at the desired couple values. The couple value is converted first into radians. –Given a coupling value [º]. Couples joints 1, 2 and 3 of the IMA fingers and joints 2 and 3 of the Thumb finger. These joints are coupled by adding the same couple value which is first converted into radians. –Given 4 coupling values [º], one per each finger. Couples joints 1, 2 and 3 of the IMA fingers and joints 2 and 3 of the Thumb finger. The couple values of each finger is different. The couple value is converted first into radians. –Default. When no input parameters are provided, the method couples 5ºjoints 1, 2 and 3 of the IMA fingers and joints 2 and 3 of the Thumb finger. 18. isMoving(): Retrieves the value of the class variable flag moving. It contains the information of whether the hand is currently moving along a trajectory. Page 98 6.4 Software Walkthrough •Kinematics: The key functions related to kinematics involve computing the FK, which return the current position and orientation of the fingertips and executing the IK in order to move the fingertips to the desired poses or to the desired fingertip position with the desired fingertip normal vector. Moreover, there are functions related to obtaining the Jacobian matrix. 1. computeFKFinger(): Retrieves the fingertip position and orientation of the desired finger. To do so, it computes the Forward kinematics of the current joint position values of the finger. To do so, it uses the AllegroFinger Fkine() function. The resulting fingertip pose is defined in the finger base frame. Then it is defined with respect to the base of the hand frame. 2. computeFK(): Retrieves all the fingertips positions and orientations. To do so, the computeFKFinger() method has been used. 3. computeIKFinger(): Retrieves the joint values of the desired finger to allocate the fingertip at the desired position and orientation. To do so, it computes the Inverse kinematics using the Ikine() function. 4. computeIKHand(): Retrieves the joint values of the hand to allocate the fingertips at the desired positions and orientations. To do so, the computeIKFinger() method has been used. 5. executeIK(): Moves the hand in order to allocate the fingertips at the desired positions and orientations. To compute corresponding joint values, the computeIKHand() method has been used. Then, the hand is moved using the moveToConf() method. 6. ComputeJacobian(): Computes the Jacobian matrix using the AllegroHandController ComputeJacobian() method. 7. getRealJacobianKDL(): Retrieves the computed Jacobian matrices either for all fingers or a specific finger, it uses the AllegroHandController getRealJacobianKDL() method. 8. getFingerFrames():Retrieves the positions and orientations of all the frames of the kinematic chain obtained using the AllegroHandController getFingerFrames() method. •Joint limits: 1. updateJointLimitsURDF(): Computes the joint limits of the URDF considering the real joint limit values of the manufactured hand stored in a YAML file. These are called the unsaturated URDF joint limits, and are stored in the q_min_urdf_unsaturated and q_max_urdf_unsaturated class variables. The method starts by considering the URDF joint limit values. In case there exists a file containing the real joint limits of the manufactured hand in the /conf/joint_limits folder, these values are compared. For each joint, in case the URDF joint limit values are outside the range of the real joint limit values of the hand, then the corresponding values are changed to match the real joint limit values. 2. updateJointLimits(): Updates the joint limit values, stored in the q_min and q_max Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 99 variables. It considers the safety margin and the unsaturated URDF joint limit values. 3. getJointLimits(): Retrieves the minimum and maximum allowed joint position values stored in the class variable q_min and q_max, respectively. 4. getJointLimitsSafetyMargin(): Retrieves the safety margin of the joint limit values. 5. setJointLimitsSafetyMargin(): Sets the margin of the joint limit values. 6. useSafetyMargin(): Chooses to use or not the safety margin for the joint limit values. The method then uses the updateJointLimits() function to update the joint limits accordingly. Page 100 6.5 Installation and Setup 6.5 Installation and Setup 6.5.1 Requirements To build the Allegro Hand library, the following dependencies are required: •CMake [44]. •Eigen [45]. •yaml-cpp [46]. •libpcan [47]. •pcanbasic [48]. •Boost [49]. •URDF [50]. •Orocos KDL [43]. On a Debian/Ubuntu system, these dependencies can be installed using: $ sudo apt install cmake libeigen3-dev libyaml-cpp-dev libboost-filesystem-dev libboost-system-dev liburdf-dev liborocos-kdl-dev For libpcan, use the packages available for Debian or Ubuntu. •For Debian, add the Debian Robotic Project (DRP) repository by replacing XXXX with bookworm or bullseye: $ sudo sh -c ’echo "deb [arch=amd64] http://debrob.upc.edu/debian-robotics XXXX-robotics main" > /etc/apt/sources.list.d/debian-robotics.list’ $ sudo apt update $ sudo apt install libpcan-dev •For Ubuntu Focal (20.04), add the relevant PPA: $ sudo add-apt-repository ppa:deb-rob/focal-robotics $ sudo apt update $ sudo apt install libpcan-dev The driver uses a modified version of kdl_parser by Wim Meeussen, adapted by Pouya Mohammadi, which is not integrated with ROS. 6.5.2 Build To compile the driver, create a build directory and run: $ mkdir build $ cd build $ cmake ../ Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 101 Then, execute: $ make Upon successful compilation, the library output includes: •The shared library liballegro_hand.so. •Several example programs to test the library. 6.5.3 Integrating the Driver into a Project The driver is designed to be built within a catkin workspace. To incorporate it into your own project, include the following lines in your CMakeLists.txt file: $ find_package(allegro_hand_driver REQUIRED) $ get_target_property(allegro_hand_INCLUDE_DIRS ${allegro_hand_LIBRARIES} INTERFACE_INCLUDE_DIRECTORIES) $ include_directories(${allegro_hand_INCLUDE_DIRS}) # Ensure to link ${allegro_hand_LIBRARIES} appropriately in your target. Page 102 6.6 Testing the Allegro Hand Library 6.6 Testing the Allegro Hand Library This section will present practical examples of how to use the Allegro Hand Library. 6.6.1 Allegro Hand Driver Example The provided example, test_allegro_hand_driver, demonstrates a basic driver application for the Allegro Hand. This example is designed to establish communication with the robotic hand and allows for basic operations without the need for advanced control algorithms. The core functionality is implemented using the AllegroHandDriver class, providing an interface to interact directly with the Allegro Hand hardware. Functionality The example program allows the user to perform the following operations: 1. Set Direct Torque: The user can directly set torque values for the 16 joints of the hand (4 joints per finger) in Newton-meters (option <1>). 2. Set Finger Torque: Selecting option <2> allows the user to specify torque values for individual fingers. Each finger has four joints, and the user can provide torque values for each joint. Additionally, the specific finger to which the torque is applied can be selected. 3. Read Hand State (Joint Positions): The program reads and displays the current state of the hand, specifically joint positions in degrees (option <3>). 4. Get Torque Conversion Constant: Retrieves the torque conversion constant used to translate motor currents into torque values (option <4>). This constant is determined by the hand version and is essential for understanding the relationship between the control inputs and the mechanical output of the hand. 5. Get Torque Limits: Retrieves the maximum allowable torque for each joint (option <5>). 6. Read Current Torque Values: Option <6> displays the torque values currently being applied to the hand’s joints. 7. Exit the Program: To safely exit the program, the user selects option <0>. The hand is properly stopped before exiting. Running the Example To run the test_allegro_hand_driver example, the user must provide the YAML configuration file for the specific Allegro Hand model in use. The configuration file contains necessary initialization parameters, such as joint limits, encoder offsets, and control settings. The file can be specified either by its filename (with or without the .yaml extension) or by providing the full path to the file. For instance, assuming the hand model V4R283, the example can be executed with the following terminal commands: $ examples/test_allegro_hand_driver V4R283 real $ examples/test_allegro_hand_driver V4R283.yaml real Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 103 $ examples/test_allegro_hand_driver ../conf/configuration_files/V4R284.yaml real The real argument specifies that the hand is not in simulation mode. 6.6.2 AllegroHand Example This example program is the most complete one. It demonstrates the usage of the AllegroHand class, which is the main class of the AllegroHand library. The program allows interaction with the Allegro robotic hand, enabling various functionalities such as controlling the hand, reading its state, and performing kinematic calculations. Functionality The example provides several options to interact with the Allegro Hand (Figure 18): Figure 18: AllegroHand Example Options. •Select a Controller: The user can select from available controllers such as Gravity Compensator, PD,PID, or Torque controllers by entering the corresponding number (option <1>) (Figure 19). Figure 19: AllegroHand Example Option 1: Selecting a Controller. •Forward Kinematics (FK): The program computes and prints the Forward Kinematics of the fingertips (option <2>). This calculation provides the positions (Cartesian coordinates: X, Y, Z) and orientations (ZYZ Euler angles) of each fingertip (Figure 20). Page 104 6.6 Testing the Allegro Hand Library Figure 20: AllegroHand Example Option 2: Forward Kinematics. •Inverse Kinematics (IK): The user can move the fingertips to a desired position and orientation using Inverse Kinematics (option <3>). This requires specifying 12 position values and 12 orientation values of the fingertips (Figure 21). Figure 21: AllegroHand Example Option 3: Inverse Kinematics. •Move to a Defined Configuration: The user can move the hand to a predefined configuration by specifying its name (option <4>) (Figure 22). Figure 22: AllegroHand Example Option 4: Move to a Defined Configuration. •Read Hand State: The program reads and displays the current state of the hand, including joint positions in degrees and radians, velocities in degrees per second, accelerations in degrees per second squared, and torques in Newton-meters (option <5>) (Figure 23). •Store a Configuration: The program allows the user to manually move the hand (with the Gravity Compensator automatically activated) and save the current configuration to a YAML file under a specified name (option <6>) (Figure 24). Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 105 Figure 23: AllegroHand Example Option 5: Read Hand State. Figure 24: AllegroHand Example Option 6: Store a Configuration. •Store the Current Configuration: The current configuration can be saved to a YAML file with a user-specified name (option <7>). •Perform a Coupled Closing: The program enables a coupled closing of the hand (option <8>) (Figure 25). Figure 25: AllegroHand Example Option 8: Perform a Coupled Closing. •Set Direct Torque: The user can directly set torque values for the 16 joints of the hand (4 joints per finger) in Newton-meters (option <9>). •Move to a Desired Configuration: The user can specify joint angles in either degrees (<C>) or radians (<c>) to move the hand to a desired configuration. •Retrieve Configuration List: The program lists all available configurations stored in the YAML files (option <G> or <g>) (Figure 26). Figure 26: AllegroHand Example Option G: Retrieve Configuration List. •Move to a Predefined Configuration at a Desired Velocity: The user can specify a configuration name and a velocity percentage (up to 100%) to move the hand at the desired speed (option <X> or <x>) (Figure 27). •Store and Execute a Trajectory: The user can define a velocity and a final configuration Page 112 7 Allegro Hand ROS 2 7.1 Introduction The developed software Allegro Hand ROS 2 allows controlling the Allegro robotic hand using the ROS 2 Humble framework. The software is designed to seamlessly integrate with other robots, such as MADAR. The Allegro Hand Library, a specialized library developed to facilitate the operation and control of the Allegro Hand, that has been described in the previous chapter, is being used in this software. Moreover, this software allows to use the Allegro Hand with the tactile sensors Weiss and uses the sensory data to perform more accurate grasps. The software architecture is organized into four key packages, each serving a distinct purpose: •Allegro Hand Description: This package is responsible for the visualization of the Allegro Hand in RViz, a 3D visualization tool commonly used in ROS environments. It provides the necessary URDF files and associated resources to accurately display the Allegro Hand model, enabling users to monitor the hand state in a virtual environment. •Allegro Hand Interfaces: This package defines essential communication information within the ROS environment, including custom messages, services and actions. •Allegro Hand ROS: It is the most significant package in this software, Allegro Hand ROS contains the ROS 2 layer of the Allegro Hand Library. It leverages the Allegro Hand Interfaces package to implement the core functionality needed for controlling the hand, processing sensor inputs, and executing commands. This package serves as the foundation for all higher-level operations involving the Allegro Hand. •Allegro Hand Weiss: This package extends the capabilities of the Allegro Hand by integrating it with the Weiss tactile sensors. Building upon the Allegro Hand ROS package and the Weiss sensor package. The primary objective of this package is to enable the Allegro Hand to perform force controlled adaptive grasps, informed by sensory data from the Weiss sensors. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 113 7.2 Allegro Hand Description Package 7.2.1 Introduction The allegro_hand_description package is essential for visualizing the Allegro Hand in RViz, a 3D visualization tool widely used in ROS environments. This package includes all necessary components, such as XML Macros (Xacro) files and 3D mesh models, to represent the Allegro Hand in a virtual space, enabling users to monitor and interact with the hand’s state during simulations. 7.2.2 Package Structure The package is organized into several key directories, each serving a specific role in the visualization and simulation of the Allegro Hand: •urdf directory: This directory contains files that describe the kinematic and dynamic properties of the Allegro Hand. The files utilize the XML-based Xacro language, which is commonly used within the ROS environment to simplify URDF files through parameterization and conditional inclusion of components. There are three primary files within this directory: –allegro_hand_description.xacro: This file defines the hand configuration. It begins by defining arguments, including the hand type (left or right) and also link prefix, joint prefix, and tip, which are passed as parameters to other components of the robot model. The file conditionally includes and instantiates either the left or right hand URDF descriptions based on the hand type argument. This approach allows for flexibility in the robot model’s instantiation, enabling the same file to be reused for both the left and right versions of the Allegro Hand by adjusting the input arguments. –leftAllegroHand.urdf.xacro and rightAllegroHand.urdf.xacro: These files describe the left and right hands, respectively. They construct the URDF using the provided link and joint prefix arguments, defining the prefix name of the hand’s links and joints, respectively. The tip argument specifies the type of tip used, which could be a Weiss or OptoForce sensor, or the default tip. These files collectively define the robot’s structure, including joint configurations, link dimensions, and the relationships between different components. •meshes directory: This directory houses 3D models of the Allegro Hand’s components. The mesh files are referenced by the URDF files to provide a realistic visual representation of the hand in simulation environments. Each link of the Allegro Hand has a corresponding mesh, as well as each type of tip, these are Weiss, OptoForce and the manufacturer original fingertips. The base link and the first thumb link (link 12) differ between the left and right hand. •rviz directory: This directory contains configuration files for RViz, which facilitate the visualization of the Allegro Hand within a simulated environment. There are two RViz configuration files: display_allegro.rviz, which is the default, and display_allegro_weiss.rviz, which is tailored for use with Weiss sensors, including the display of force vectors sensed by these sensors. Page 114 7.2 Allegro Hand Description Package •launch directory: This directory includes launch files that streamline the process of starting the visualization of the Allegro Hand. There are two launch files: –display_allegro_joint_state_publisher.launch.py: This file launches the visualization with the joint state publisher, allowing for interactive joint manipulation. –display_allegro.launch.py: This file launches the visualization without the joint state publisher, offering additional parameterization options. Additionally, the package includes the following files: •README.md: This file provides an overview of the package, including instructions for installation, configuration, and usage. •package.xml: The package is named allegro_hand_description and uses the build system ament_cmake. The package dependencies are defined in this file, including URDF,Xacro, rviz2,robot_state_publisher,joint_state_publisher_gui, and ros2launch. •CMakeLists.txt: Provides the necessary instructions for building the package using CMake. It specifies the package dependencies and the installation directories (launch,URDF,meshes, and RViz). 7.2.3 Launch The package provides two launch files that initiate the visualization of the Allegro Hand. These files define several launch arguments that allow users to customize the visualization, set up, and start ROS2 nodes essential for simulation and visualization within the ROS2 environment. •display_allegro.launch.py: This launch file starts the RViz2and robot_state_publisher nodes. Depending on the tip argument, it selects either the display_allegro.rviz or display_allegro_weiss.rviz configuration file in RViz. Table 14 provides a summary of the launch arguments, including their names, descriptions, and default values. •display_allegro_joint_state_publisher.launch.py: This launch file starts the RViz2, robot_state_publisher, and joint_state_publisher_gui nodes. Table 15 provides a summary of the launch arguments, including their names, descriptions, and default values. These arguments provide users with flexibility in configuring the launch process, allowing customization of the robot’s description, adaptation to multi-robot setups, and fine-tuning of RViz visualization parameters. 7.2.4 Display the Allegro Hand in RViz2 The steps to display the Allegro Hand in RViz2 are shown below •Step 1. Build the package and source the environment. In the workspace folder, execute the following commands: In the section Installation and Setup (Chapter 7.6) the necessary steps to configure the workspace are detailed. $ colcon build --packages-select allegro_hand_description $ source install/setup.bash Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 115 Table 14: Launch arguments of the display_allegro.launch.py file. Argument Name Description Default Value description_file The URDF/Xacro description file containing the robot model. allegro_hand_description.xacro joint_prefix Prefix of the joint names, useful for multi-robot setups where unique identifiers are required. ” link_prefix Prefix of the link names, useful for multi-robot setups where unique identifiers are required. ” tip Specifies the type of tip of the hand. ” hand Specifies whether the configuration is for the left or right hand. right namespace_jointstates Namespace of the joint states for remapping purposes. ” rviz_fixed_frame The fixed frame name used in RViz visualization. base_link Table 15: Launch arguments of the display_allegro_joint_state_publisher.launch.py file. Argument Name Description Default Value description_file The URDF/Xacro description file containing the robot model. allegro_hand_description.xacro joint_prefix Prefix of the joint names, useful for multi-robot setups where unique identifiers are required. ” link_prefix Prefix of the link names, useful for multi-robot setups where unique identifiers are required. ” tip Specifies the type of tip of the hand. ” hand Specifies whether the configuration is for the left or right hand. left rviz_config_file_name The name of the RViz configuration file used for visualizing the robot. display_allegro.rviz •Step 2. Run the Launch file: $ ros2 launch allegro_hand_description display_allegro.launch.py $ ros2 launch allegro_hand_description display_allegro_joint_state_publi- sher.launch.py Depending on the launch parameters, left or right hand will be visualized with the desired fingertips. The following visualizations illustrate two configurations of the Allegro Hand in RViz, demonstrating its setup and sensor integration (Figure 32). The RQT Tree created using the kinematic chain obtained from the Xacro and URDF files is shown in the Figure 33. Page 116 7.2 Allegro Hand Description Package Figure 32: Allegro Hand visualized in RViz. Left: left-hand model with default fingertips. Right: right-hand model equipped with Weiss sensors. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 117 Figure 33: Allegro Hand RQT Tree. Page 118 7.3 Allegro Hand Interfaces Package 7.3 Allegro Hand Interfaces Package 7.3.1 Introduction The allegro_hand_interfaces package is an essential component for communication between the Allegro Hand and other systems within the ROS2 environment. This package defines custom messages, services, and actions that facilitate the control and monitoring of the Allegro Hand, enabling seamless integration with other ROS2 nodes and systems. 7.3.2 Package Structure The package is organized into several key directories, each serving a specific role in defining the interfaces necessary for the Allegro Hand’s operation: •msg directory: This directory contains message definitions that are used for communication between nodes. Each message defines a specific data structure necessary for the exchange of information related to the Allegro Hand’s operation. These messages are critical for sending commands and receiving feedback from the hand during operation. •srv directory: This directory houses service definitions that allow nodes to perform synchronous requests and responses. These services facilitate specific operations such as querying the state of the hand or triggering specific behaviors. •action directory: This directory contains action definitions, which are used for long-running tasks that require feedback and the ability to cancel the operation. Actions are particularly useful for complex hand movements or sequences that need to be monitored and controlled over time. Additionally, the package includes the following files: •README.md: The README file provides an overview of the package. •package.xml: Defines the package metadata, including the build system (ament_cmake) and essential package dependencies such as geometry_msgs,action_msgs,sensor_msgs, and trajectory_msgs. It also includes dependencies for generating ROSIDL interfaces with rosidl_default_generators and ensures runtime support with rosidl_default_runtime. The file indicates that the package is part of the rosidl_interface_packages group. The package is named allegro_hand_interfaces. •CMakeLists.txt: This file provides the necessary instructions for building the package. It specifies the dependencies, message generation, and installation directives for the package components. Provides the necessary instructions for building the package using CMake. It specifies the package dependencies. The core of the file uses the rosidl_generate_interfaces command to automatically generate ROSIDL interfaces for all the messages (.msg files) and services (.srv files) defined in the package. 7.3.3 Message Definitions The msg directory contains the following message definitions: The messages defined in the package are listed in Table 16: Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 119 Table 16: List of messages of the allegro_hand_interfaces package. Message Name Fields Trajectory.msg float64[] hand_configuration CurrentState.msg float64[] pos float64[] vel float64[] acc float64[] torque ContactPointArray.msg geometry_msgs/Point[] cp ContactPoints.msg geometry_msgs/Point cp1 geometry_msgs/Point cp2 geometry_msgs/Point cp3 geometry_msgs/Point cp4 7.3.4 Service Definitions The services defined in the package are listed in Table 17: Table 17: List of services of the allegro_hand_interfaces package. Service Name Input Output SetGravityVector.srv float64[] gravity_vector bool success GetTorque.srv bool success float64[] torque SetPoseIK.srv float64[] desired_position bool success float64[] desired_orientation GetGravityVector.srv bool success float64[] gravity_vector SetController.srv string tipo bool success StopHand.srv bool success SetDesPos.srv float64[] pos bool success StopFinger.srv uint8 finger_id bool success ContinueFinger.srv uint8 finger_id bool success GetController.srv bool success SetDesPosReflexxes.srv float64[] pos bool success float64 min_duration SetDesTorque.srv float64[] torque bool success GetFingersMovementStatus.srv bool[] fingers_status SetDesPosVel.srv float64[] pos bool success float64[] vel CoupledClosing.srv float64 coupled_value bool success PauseFinger.srv uint8 finger_id bool success GetHandConfiguration.srv bool success float64[] current_configuration GetPoseFK.srv bool success float64[] euler_angles float64[] translation JointLimits.srv float64[] min float64[] max Page 120 7.3 Allegro Hand Interfaces Package 7.3.5 Action Definitions The actions defined in the package are listed in Table 18: Table 18: List of actions of the allegro_hand_interfaces package. Action Name Input Feedback Output MoveFingertipPoses geometry_msgs/Point[] coordinates bool status sensor_msgs/JointState current_configuration float64[] euler_angles float64 percentage_velocity MoveTrajectory_traj_msgs trajectory_msgs/JointTrajectory trajectory bool result trajectory_msgs/JointTrajectoryPoint current_configurations MoveTrajectory allegro_hand_interfaces/Trajectory[] trajectory bool status sensor_msgs/JointState current_configuration sensor_msgs/JointState desired_current_configuration MoveConfigFinger float64[] final_configuration bool status sensor_msgs/JointState current_configuration float64 percentage_velocity uint8 finger_id MoveConfig float64[] final_configuration bool status sensor_msgs/JointState current_configuration float64 percentage_velocity MoveConfig copy float64[] final_configuration bool status float64[] current_configuration float64 percentage_velocity MoveFingertipPose geometry_msgs/Point coordinates bool status sensor_msgs/JointState current_configuration float64[] euler_angles float64 percentage_velocity uint8 finger_id MoveTrajectoryVel allegro_hand_interfaces/Trajectory[] trajectory bool status sensor_msgs/JointState current_configuration float64 max_velocity sensor_msgs/JointState desired_current_configuration 7.3.6 Usage Step 1. Build the package and source the environment. In the workspace folder, execute the following commands: In the section Installation and Setup (Chapter 7.6) the necessary steps to configure the workspace are detailed. $ colcon build --packages-select allegro_hand_interfaces $ source install/setup.bash Once the package is built and sourced, you can use the provided messages, services, and actions in your ROS2 nodes to interact with the Allegro Hand. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 121 7.4 Allegro Hand ROS Package 7.4.1 Introduction The allegro_hand_ros package is the main package for communicating, controlling and simulating the Allegro Hand within a ROS environment. This package uses the Allegro Hand Library software explained in the previous chapter. The main class, AllegroROS is a derived class from the AllegroHand class. Allows the communication and control of the Allegro Hand in a ROS layer, containing essential services and actions to control the Allegro robotic hand. It can run both, a real Allegro Hand or a simulated one. The available services are shown in Table 19, including the service name and a brief description. Table 19: Services defined in the AllegroROS class. Service Name Description getController Retrieves the current controller. setController Sets the desired controller. getTorque Retrieves the current torques applied to the hand’s joints. setTorque Sets the desired torque values for the hand’s joints. getHandConfiguration Retrieves the current hand configuration. setDesiredConfiguration Moves the hand to a specific hand configuration. getLimits Retrieves the joint limits of the hand. getPoseFK Retrieves the fingertips poses of the hand (FK). setPoseIK Sets the fingertips poses (IK). coupledClosing Closes the hand’s fingers in a coupled manner. getFingersMovementStatus Retrieves the movement status of the hand’s fingers. pauseFinger Pauses the movement of a specified finger. continueFinger Continues the movement of a paused finger. stopFinger Stops the movement of a specified finger. stopHand Stops all hand movements immediately. getGravityVector Retrieves the gravity vector affecting the hand. setGravityVector Sets a the gravity vector affecting the hand. The available actions are shown in Table 20, including the action name and a brief description. Page 128 7.4 Allegro Hand ROS Package 2. Compute wrenches and contact points: It computes the contact point frames and also the wrenches (force and torque) at the fingertips. To do so, first the Jacobian matrix is computed (ComputeJacobian()), and the finger frames are obtained (getFingerFrames()). The contact points with respect to the base of the finger, correspond to the last frame of each finger, and are extracted from the finger frames. Then, the wrenches are computed using the Jacobian matrix obtained with the KDL library (getRealJacobianKDL()) and the current torques. These wrenches are obtained with respect to the base of the finger and are transformed into the contact point’s frame of reference. Finally, the transform between the fingertip origin and the actual contact point is computed. 3. Publish wrenches:. The wrenches are published using the ROS topic, enabling monitoring and analysis. 4. Update contact point frame:. The transform between the fingertip frame and the actual contact point frame is broadcasted. 5. Publish Joint States: Updates the joint states with the position, velocity, and torque data of each joint of the Allegro Hand, and publishes it to the joint_states topic. 6. ROS Spin: The loop spins the ROS node, processing incoming callbacks and maintaining the node’s responsiveness to external events and commands. 7. Wait: The loop operates at a defined frequency because it pauses between iterations, the time between iterations is defined by the class variable rate. To conclude, by continuously processing and publishing joint states, wrenches and contact points transforms, it enables sophisticated control and interaction with the Allegro Hand. Services The AllegroROS class provides several ROS services that allow controlling the Allegro Hand such as setting the controller, setting the torque or pausing a finger movement. A list of the available services is shown in Table 19, these services use the messages defined in the Allegro Interfaces Package, shown in Table 17. Annex A.9 shows a detailed description of the services, including the messages and the methods used to execute them. Actions While ROS services are designed for short tasks where a client sends a request and receives a response, ROS actions are better suited for long-running tasks that provide continuous feedback to the client. The available actions, as described in Table 20, focus on moving the hand to a specific configuration. These actions can be grouped into two categories: those that provide the hand final configuration, such as move_config and move_config_finger, and those that provide a trajectory defined by a series of hand configurations, follow_joint_trajectory,move_trajectory and move_trajectory_finger or fingertip poses, move_fingertip_pose and move_fingertip_poses. There are actions that only provide the information of one finger, in that case, the rest of the joints will remain constant. Since these actions are quite similar, the methods they use will be described collectively. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 129 There are two key methods associated with these actions: •setFingersInitialMovementStatus(): Compares the provided initial and final hand configurations by checking the joint position values for each finger. If the difference exceeds a threshold, the variable finger_moving is set to true. •getFingerMovementStatus(): Returns the status of finger movement, this is the value of finger_moving. Actions consist of three components: a goal, feedback, and a result. When an action is initiated, it begins with a goal callback method that checks that the length of the joint positions is correct. If everything is correct, the execution callback is triggered. Clients can cancel the action at any time, and the cancel callback method notifies the client of successful cancellation, and sets the action result as failure. Once a goal is accepted, a goal-handling callback function is invoked. The method checks whether the Torque or Gravity Compensator controller is in use, and if so, sets the PID controller accordingly. Then, since execution is a long-running task, a thread is spawned to perform the actual work via the execute method. The execute method is crucial, as it moves the hand along the configurations in the desired trajectory. For actions that provide a final goal configuration, the desired trajectory is calculated based on the velocity provided using the calculateTrajectory() method. Actions that only specify the movement of one finger expand this information to include all joint positions of the hand. Then, the desired trajectory is stored in the AllegroROS class variable current_trajectory, while the number of hand configurations is stored in num_points. This is significant because services that pause, continue, or stop finger movement retrieve trajectory data from these variables. After storing the trajectory, setFingersInitialMovementStatus() is called, and the class variable moving is set to true. The iteration process continues until the num_points value is reached, though this value may change due to the continueFinger service, which extends the trajectory to allow all fingers to reach the final configuration. During each iteration, the system checks for cancellation requests. If a request is detected, both moving and finger_moving are set to false. Otherwise, the hand moves to the next configuration in the trajectory using setDesiredConfiguration(). And feedback is updated and published through the getCurrentState() function. Once the hand reaches the final configuration or when all the fingers have been paused or stopped (because the pauseFinger and stopFinger services set future configurations to current joint positions), moving and finger_moving are set to false. Finally, a comparison is made between the current and the desired final joint positions, with the differences logged. If the total additive difference is below a threshold and all joint differences are within another threshold, the action result is successful. 7.4.6 Usage This package depends on the several packages, including allegro_hand_description,allegro_hand_interfaces and allegro_hand. For this reason, to build the package successfully all the packages need to be build, once these packages are built we can build this package. In the section Installation and Setup (Chapter 7.6) the necessary steps to configure the workspace are detailed. Page 130 7.4 Allegro Hand ROS Package •Step 1. Build the package and source the environment (Figure 34). In the workspace folder, execute the following commands: $ colcon build $ source install/setup.bash Figure 34: Allegro Hand ROS building and sourcing the environment. •Step 2. Run the Allegro ROS node and the RViz visualization by running the launch file: $ ros2 launch allegro_hand_ros hand.launch.py This will initialize the Allegro Hand in the ROS 2 environment. An RViz window will open and display the virtual visualization, as long as the rviz parameter is set to true. Some test files are available, to execute them: •Step 3 - Optional. In another terminal, source the environment and run the test node by replacing test_node with the file name of the executable (for instance service_client), some arguments can be added depending on the executable: $ source install/setup.bash $ ros2 run allegro_hand_ros [test_node] [args] Alternatively, the Allegro Hand ROS node can be runned form the terminal instead of using the launch package (Step 2). Figure 36 shows an example for using this package. $ source install/setup.bash $ ros2 run allegro_hand_ros allegro_node Figure 35: Allegro Hand ROS running the node from the terminal. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 131 7.4.7 Testing the Allegro ROS Package This package includes several test files, that contain programs that demonstrate how to interact with the Allegro Hand using ROS services and action clients. These files enable users to interact with the hand via keyboard input in the ROS layer. The available test files are: •service_client.cpp: Server client example containing all the available services, such as setting the controller, pausing fingers movements, setting the desired torque, among others. •follow_joint_trajectory_client.cpp: Action client example for moving the hand along a trajectory defined using FollowJointTrajectory messages. •move_trajectory_client.cpp: Action client example for moving the hand along a trajectory defined by a set of hand configurations. •move_trajectory_vel_client.cpp: Action client example for moving the hand along a trajectory defined by a set of hand configurations, the maximum velocity is restricted to the provided one. •move_config_client.cpp: Action client example for moving the hand to the desired hand configuration, providing 16 joint position values and the desired velocity (in percentage). •move_config_finger_client.cpp: Action client example for moving one finger of the hand, providing the desired finger, 4 joint position values and the desired velocity (in percentage). •move_poses_client.cpp: Action client example for moving the hand to allocate the fingertips at the desired positions and orientations at the desired velocity (in percentage). •move_pose_client.cpp: Action client example for moving on finger of the hand to allocate the fingertip at the desired position and orientation at the desired velocity (in percentage). Another option, since this node implements services and actions, is controlling the hand through another terminal using services and actions. Figure 36 shows an example of setting the Gravity Compensator and executing a Coupled Closing of the hand through another terminal. In this section the textitservice_client.cpp and move_trajectory_client.cpp examples will be explained. Service Client Example The provided example, service_client, allow users to test and control the Allegro Hand directly from the command line using ROS 2 services. This example contains the ServiceClient class and the main function. The ServiceClient class is a ROS 2 node that inherits from rclcpp::Node and is designed to interface with various services provided by the AllegroROS class. The constructor has two input arguments; a string called prefix and rclcpp::NodeOptions(). It initializes the node with a specific name, which is composed by the prefix concatenated with service_client. The class has 16 methods, each one defines a service client that can call specific AllegroROS services, using the prefix to correctly address the services within their respective namespaces. The main function initializes the service_client node and provides a command-line interface to Page 132 7.4 Allegro Hand ROS Package Figure 36: Allegro Hand ROS running the node from the terminal and using services to control the hand. interact with the Allegro Hand through services. The main begins by initializing the ROS 2 environment and setting a prefix for the node, if provided as an argument. Then, it creates an instance of the ServiceClient class, which is responsible for interfacing with the Allegro Hand’s services. The program enters a loop where the user is presented with a menu of options and based on the user’s input, the appropriate service client method is called. The example program allows the user to perform the following operations, all of them use ROS services (Figure 37): Figure 37: Allegro Hand ROS Service Client Example: Options. 1. Get Controller: Retrieves the current controller type being used by the Allegro Hand (option <1>). 2. Get Gravity Vector: Requests the current gravity vector applied to the hand, which is Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 133 critical for compensating gravitational effects (option <2>). 3. Get Fingertip Positions and Orientations (FK): Computes and retrieves the Forward Kinematics of the fingertips, providing their positions and orientations (option <3>). 4. Get Current Torque: Retrieves the current torques applied to each joint of the hand (option <4>). 5. Get Current Configuration: Returns the current joint positions of the Allegro Hand (option <5>). 6. Get Joint Limits: Retrieves the minimum and maximum limits for each joint (option <6>). 7. Set Controller: Allows the user to change the controller by specifying the desired controller type, such as JointPositionPID,JointPositionPD,GravityCompensator, or Torque (option <7>). 8. Move to a Desired Configuration: Moves the hand to a specific joint configuration (option <8>). 9. Set Desired Torque: Sets the torque values for the hand’s joints (option <9>). 10. Set Gravity Vector: Updates the gravity vector (option <g> or <G>). 11. Coupled Closing: Performs a coupled closing motion, where the fingers close in a coordinated manner (option <c> or <C>). 12. Move Fingertips to a pose (IK): Computes Inverse Kinematics to move the fingertips to a specified position and orientation (option <i> or <I>). 13. Pause Finger Movement: Pauses the motion of a specified finger that is moving along a trajectory (option <w> or <W>). 14. Continue Finger Movement: Resumes the motion of a paused finger (option <e> or <E>). 15. Stop Finger Movement: Stops the motion of a specified finger that is moving along a trajectory (option <q> or <Q>). 16. Stop Hand: Stops the hand motion (option <s> o<S>). 17. Exit the Program: To exit the program, the user selects option <0>. Figure 38 shows an example of the hand being controlled using this software: Move Trajectory Action Client Example The provided example, move_trajectory_client, demonstrates how to use a ROS 2 action client to control the Allegro Hand by executing a predefined movement trajectory. This example consists of the MoveTrajectoryActionClient class and the main function. The MoveTrajectoryActionClient class is a ROS 2 node that inherits from rclcpp::Node and interfaces with the move_trajectory action server provided by AllegroROS. The class constructor takes two Page 134 7.4 Allegro Hand ROS Package Figure 38: Allegro Hand ROS Service Client Example. arguments: rclcpp::NodeOptions() and a vector of trajectories (trajectory). The class is designed to send a series of joint configurations to the action server, which then executes the trajectory on the Allegro Hand. The main function begins by initializing the ROS 2 environment and creating a vector to store the trajectory values. It then initializes an instance of the AllegroHand class with the constructor to only read the conf files and reads the trajectory from a file. The trajectory file can be specified as a command-line argument; if not provided, a default trajectory (prismatic_3) is used. After reading the trajectory, the main function creates an instance of the MoveTrajectoryAction- Client class, passing the trajectory data to it. The node then spins, allowing it to send the trajectory to the action server and receive feedback and results. The action client displays into the console the feedback and the result. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 135 7.5 Allegro Hand Weiss Package 7.5.1 Introduction This package extends the capabilities of the Allegro Hand by integrating the Allegro Hand with the Weiss tactile sensors. To do so, it uses both the Allegro Hand ROS package and the Weiss sensor package. The primary objective of this package is to enable the Allegro Hand to perform force controlled adaptive grasps, informed by sensory data from the Weiss sensors. 7.5.2 Package Structure The package is organized into several key directories and files: •include/allegro_hand_weiss directory: This directory houses the header file, allegro_hand_weiss.hpp, that defines the main and only class used across the package, the AllegroWeiss class. •src directory: This directory contains the source code of the AllegroWeiss class, allegro_hand_weiss.cpp. Additionally, it contains the file friction_cones_intersection.cpp where methods have been implemented to compute the friction cones given a set of contact points and their normal, as well as the polytope, defined by the intersection of these friction cones. Nevertheless, this file will not be explained further since due to the physical limitations of the Allegro Hand it is not possible to exert forces along all the directions, later on this problem will be discussed. •launch directory: This directory contains the hand.launch.py launch file, necessary to start all the ROS nodes: the node to communicate and control the Allegro Hand, the Weiss sensors node and the node to execute force-controlled grasps and also the RViz visualization. Additionally, the package includes the following files: •README.md: This file offers an overview of the package, including instructions for installation and usage. •package.xml: The package is named allegro_hand_weiss and uses ament_cmake as its build tool, which is standard for ROS 2 packages. Requires and depends on several libraries and packages, including: –ament_index_cpp,rclcpp,rclcpp_action,rclcpp_components: Core ROS 2 libraries for node management, action handling, and component-based architecture. –std_msgs,sensor_msgs,geometry_msgs,trajectory_msgs,visualization_msgs: Standard message types for data communication within ROS. –tf2,tf2_ros,tf2_geometry_msgs: Libraries for managing transformations. –allegro_hand_interfaces,allegro_hand_ros,allegro_hand: Specific dependencies for interfacing and controlling the Allegro Hand within the ROS 2 environment. –weiss_sensor_interfaces,weiss_sensor_ros,weiss_sensor: Specific dependencies for retrieving the Weiss sensor data within the ROS 2 environment. Page 136 7.5 Allegro Hand Weiss Package –ros2launch: For launching ROS 2 nodes using launch files. •CMakeLists.txt: This file provides the build instructions for the package, specifying dependencies, source files, and the required compilation steps using CMake. The find_package commands are used to locate the required dependencies, listed previously. One executable for the main node, hand_sensor, is defined using add_executable. The install command is used to place the include and the launch directories and to install the executable. 7.5.3 Launch The package provides a launch file, hand.launch.py, that initiates the ROS nodes required for managing, controlling and visualizing the Allegro Hand, as well as for retrieving the sensed information from the Weiss tactile sensors. This launch file calls two launch files, the launch file of the Allegro ROS package and the one of the Weiss ROS package. Users can customize the launch process by modifying the launch arguments listed in Table 22. The arguments are the same as the ones for the Allegro Hand ROS launch file except the tip argument which has been removed because Weiss sensors are being used. As previously stated, this launch file includes another launch file, hand.launch.py from the Allegro Hand ROS package and the launch file of the Weiss Sensor ROS package. This allows to execute the nodes necessary for controlling the hand, as well as retrieving the sensor data. 7.5.4 The Allegro Weiss Class: AllegroWeiss This class is responsible for interacting with the hand, using services and actions as well as reading the sensor data, in order to control the grasps. Constructor First, the class is created as a derived instance of rclcpp::Node, which integrates it into the ROS 2 framework. Then, the constructor creates client services to pause, continue and stop the finger movements. It also creates action clients to move the hand. These services and actions belong to the Allegro ROS node and through the clients this node will be able to call them. Up next, the class ensures the mapping between the fingers and the Weiss sensors. In case the class variable initialization_phase is set to true the constructor calls the method initializeSensors- Fingers(), otherwise it assumes that the mapping between the sensors and the fingers is correct, this implies that the sensors information published is ordered as Index, Middle, Annular and Thumb. The initializeSensorsFingers() method moves the hand to four key positions and uses the hand fingers to automatically detect the sensors. These configurations are hard coded for both left and right hands, there is a pre-detection hand configuration, and one for detecting each of the IMA sensors (Table 23). In these hand configurations, the thumb exerts force within the Weiss sensor, the sensed force is represented in RViz through a blue arrow. This method, moves to the predetection configuration in between to ensure clean readings. The method creates a subscriber of the sensor_contactInfo topic, this topic contains the force, contact area and contact point sensed by the Weiss sensors. The callback function of this subscriber, as long as the initialization_phase variable is set to true reads the contact area of each sensor, and updates the sensor_id variable with the id of the sensor whose sensed area is bigger. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 137 Table 22: Launch arguments of the Allegro Weiss launch file. Argument Name Description Default Value yaml_file The Allegro hand configuration YAML file. Can be the directory or the YAML file name (with or without the extension .yaml). V4R283.yaml path_pcan The path to the PCAN device used for communication. /dev/pcan channel Specifies the communication channel. 0 joint_prefix Prefix for the joint names, useful in multirobot setups. ” link_prefix Prefix for the link names, useful in multirobot setups. right_hand hand Determines whether the configuration is for the left or right hand. left fake_hand Boolean flag indicating whether to use real or a simulation hand. false rviz Boolean flag to decide whether to launch RViz for visualization. true rvizconfig Specifies the path to the RViz configuration file. Path to allegro_hand_description/ rviz/display_allegro.rviz slave Boolean flag indicating whether the node operates in slave mode. false node_namespace The namespace for the nodes. Allegro_namespace initial_controller Chooses the initial controller for the Allegro Hand. Options include GravityCompensator,Fake, Torque,JointPositionPID, and JointPositionPD. GravityCompensator As previously stated, this method sets the hand to move to the predetection configuration, and then to the hand configuration to detect one of the IMA fingertip sensors. To move the hand, the action client of the move_config action is used. When a configuration is reached, the callback of the action client result is executed. Within this callback, as long as the initialization phase is ongoing, the the method relateToFinger() is called. This method the sensor stores the sensor ID of the sensor that sensed the biggest contact area, using this is sensor_id variable and moves the hand to the next configuration by using the client action. Once, the sensors of the IMA fingers have been detected, it checks that all sensors IDs are different and computes the sensor id of the Thumb finger and kills the subscriber of the Weiss sensors. Finally, the constructor creates a subscriber of the sensor_contactInfo topic, the callback of this subscriber is the method sensor_callback() which will be explained later. Page 144 8 Results and discussion The Allegro Hand Library and the Allegro ROS 2 software have been tested with various Allegro Hands, including models R283 and R284 from version 4, as well as SAH020AL011 and SAH020BR014 from version 2. The main part of the project was developing a robust package to control the anthropomorphic robotic Allegro Hand. Chapter 6.6.2 provides a description of an example of this library along with several images of the execution and the results. The results obtained are very satisfactory, the software functions correctly and all the functionalities applied work well regardless of the Allegro Hand version. The comparison between the official software and the developed Allegro Hand Library is shown in Table 24. The developed software is open source and allows for controlling all Allegro Hand versions using both a real hand or a simulated one. Moreover, it incorporates PID controller, and full FK and IK. Additionally, it contains both predefined and customizable hand configurations and grasps. While the manufacturer only provides a ROS 1 package, the developed software includes both a ROS 1 and ROS 2 packages. Official Software Developed Software Open-Source Simulation Controllers Gravity Compensator PD PID Kinematics Forward Kinematics Inverse Kinematics Hand Configurations Predefined Customizable Grasps Predefined Customizable Version Agnostic Designed to be easily enhanceable ROS Package ROS 1 ROS 2 Table 24: Comparison between the official software and the Allegro Hand Library. To allow integration with other robots within the ROS 2 environment, the Allegro ROS 2 Package has been developed. This software is divided in several packages, along the Chapter 7some examples of the execution are shown. The results obtained up to Allegro ROS 2 package are fine, allowing to control the hand within the ROS 2 environment while visualizing it in RViz. In this section grasps being executed using the AllegroWeiss Package (and as a result all of the packages) are going to be discussed. This package allows for controlling the hand using the sensed data. The kinematic chain of the Allegro Hand including the contact points sensed by the Weiss sensors can be seen in Figure 39. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 145 view_frames Result link_3_0_tip contact_frame_Index Broadcaster: default_authority Average rate: 949.482 Buffer length: 5.001 Most recent transform: 1720467045.313687 Oldest transform: 1720467040.313066 link_3_0 Broadcaster: default_authority Average rate: 10000.0 Buffer length: 0.0 Most recent transform: 0.0 Oldest transform: 0.0 world base_link Broadcaster: default_authority Average rate: 10000.0 Buffer length: 0.0 Most recent transform: 0.0 Oldest transform: 0.0 link_0_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_8_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_12_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_4_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_11_0 link_11_0_tip Broadcaster: default_authority Average rate: 10000.0 Buffer length: 0.0 Most recent transform: 0.0 Oldest transform: 0.0 contact_frame_Ring Broadcaster: default_authority Average rate: 180.949 Buffer length: 4.996 Most recent transform: 1720467045.312705 Oldest transform: 1720467040.316826 link_10_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_15_0 link_15_0_tip Broadcaster: default_authority Average rate: 10000.0 Buffer length: 0.0 Most recent transform: 0.0 Oldest transform: 0.0 contact_frame_Thumb Broadcaster: default_authority Average rate: 161.747 Buffer length: 4.995 Most recent transform: 1720467045.310274 Oldest transform: 1720467040.314821 link_14_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_2_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_7_0 link_7_0_tip Broadcaster: default_authority Average rate: 10000.0 Buffer length: 0.0 Most recent transform: 0.0 Oldest transform: 0.0 contact_frame_Middle Broadcaster: default_authority Average rate: 376.625 Buffer length: 5.002 Most recent transform: 1720467045.317878 Oldest transform: 1720467040.315553 link_6_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_1_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_9_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_13_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 link_5_0 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 Broadcaster: default_authority Average rate: 2.368 Buffer length: 4.224 Most recent transform: 1720467044.971228 Oldest transform: 1720467040.747577 Recorded at time: 1720467045.4146574 Figure 39: Allegro Hand RQT Tree including contact point. Page 146 Figure 40 shows the RViz visualization of the hand while applying pressure on the Thumb, the force sensed by the Thumb Weiss sensor is represented with a blue arrow. Figure 40: Allegro Hand with Weiss sensors RViz visualization. The package successfully pauses, retrieves and stops the fingers motions based on the sensed information. Figure 41 shows an example of the hand successfully grasping a bottle using the Allegro Hand Weiss package. While the software works well, some considerations have to be taken into account. This package allows for executing grasps controlling the force applied by the fingers. Although, two assumptions are made, the first is that the provided contact points are well selected, resulting in a stable grasp. It also assumes that once the hand has performed the grasp there is no need to update the forces applied because no perturbations will occur. The fingers are paused once they reach a threshold force, and they can retrieve the motion if the sensed force and area fall below another threshold. Although in case the contact points are not good enough or despite touching the object with the fingertip the sensor does not detect a contact, because the object surface is not rigid enough or due to the contact is outside the sensor detectable area, for instance the object is in contact with a link of the finger instead. In that case the finger will complete its motion until it reaches the final configuration, and while a grasp can happen, there is no guarantee that the finger is exerting the desired force. A clear example is shown in Figure 42, where despite the hand is grasping the rugby ball, the index finger does not sense any force despite being in contact with the hand. The assumption that at the desired final hand configuration, the hand will be grasping the object is a problematic assumption for two reasons. The first being that it assumes that the final fingertip poses provided are correct. Also, the hand can move the object when trying to grasp it, in case one finger makes contact first and moves the object. Since the hand is not relying on perception through a camera, the object will not be in the same initial position, resulting in the contact points not being the same as the desired ones. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 147 Figure 41: Allegro Hand with Weiss sensors grasping a bottle. Up: Real AH, Down: RViz visualization. To solve this problem a future work that is currently being developed, consist on dynamically adapting the contact points based on the sensed data. To do so, the hand first will move to a pregrasp position, for achieving this position, the fingers will be stopped once they detect a minimal contact area while almost applying no force. Then, once all the fingers are in the pregrasp position, the software will compute the best next joint configuration based on the new contact points that ensure force closure. To do so, and since the hand physical structure does not allow to execute all the forces along the friction cone, only the forces that can be executed by the hand at the pregrasp contact points are considered for computing the polytope that ensures a stable grasp. Once this polytope has been computed, next step is to select a point within the polytope to compute the desired forces to be executed by each finger. Finally, using the IK given a point and a normal the aim is to move the fingers there, ensuring that the forces applied are the computed ones, and thus a stable grasp. Page 148 Figure 42: Allegro Hand with Weiss sensors grasping a rugby ball. Left: Real AH, Right: RViz visualization. Videos illustrating the use of Allegro Hand Library and the Allegro ROS Package are available at the Allegro Hand web page that is currently being developed by IOC [54]. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 149 9 Economic assessment 9.1 Introduction For this project four Allegro robotic Hands have been used (a pair of version 2 and a pair of version 4), along with a workstation PC to develop the software and test it. The economic assessment of this project includes a breakdown of labor costs, equipment depreciation, electricity consumption, and supervision costs, as well as a critique of the total expenses. 9.2 Costs Breakdown The following is a detailed breakdown of the costs incurred during the project: •Labor Costs: The duration of this project is compressed between February and July, 26 weeks, with 20 hours per week, totaling 520 working hours. Considering an hourly rate of 8 €. The total labor cost for the project was 4,160 €. •Supervisor Costs: The supervisor was involved in 20% of the total project hours, which accounts for 104 hours. Considering an hourly rate of 30 €, the total supervisor cost was 3,120 €. •Equipment Depreciation: Depreciation costs were calculated for the Allegro Hands and the workstation PC based on their purchase prices, expected lifespan, and percentage of usage during the project. The Allegro Hands version 2 were bought years prior to this project, whereas the Allegro Hands version 4 were bought in December 2024. The price of the robotic hands is different, the considered prices include the purchase of the product as well as the shipment costs. – Allegro Hands (Version 2): The two Allegro Hands version 2, cost 15,000 €each. They were used for 15% of the total project hours, totaling 78 hours. The expected lifespan of each unit is 10 years, equivalent to 9,600 hours. The total depreciation cost was 234.72 €. – Allegro Hands (Version 4): The two Allegro Hands version 4, cost 20,000 €each. They were used for 35% of the total project hours, totaling 182 hours. The expected lifespan of each unit is 10 years, equivalent to 9,600 hours. The total depreciation cost was 758.08 €. – Workstation PC: The workstation PC, which cost 2,000 €, was used throughout the entire project, accounting for 520 hours of use. The expected lifespan of the PC is 5 years, equivalent to 4,800 hours. The total depreciation cost was 218.40 €. •Electricity Consumption: Electricity costs were incurred from operating both the Allegro Hands and the workstation PC. The electricity consumption rate considered is 0.25 €/kWh. – Allegro Hands (4 units): Each Allegro Hand consumes 0.12 kWh per hour. The total electricity cost for all four units, given their combined usage, was 62.40 €. – Workstation PC: The workstation PC consumed 0.20 kWh per hour. The total electricity cost was 26.00 €. Page 150 9.3 Costs Analysis Table 25 shows a summary of the costs of the project. Table 25: Summary of Project Costs Concept Description Hours Variable Cost Total Cost Allegro Hands (v2) Depreciation for 2 units 78 1.56 €/hour 234.72 € Allegro Hands (v4) Depreciation for 2 units 182 2.08 €/hour 758.08 € Workstation PC Depreciation 520 0.42 €/hour 218.40 € Electricity Allegro Hands (4 units) 260 0.12 €/kWh 62.40 € Electricity Workstation PC 520 0.20 €/kWh 26.00 € Labor Student Work 520 8 €/hour 4,160.00 € Supervision Supervisor Work 104 30 €/hour 3,120.00 € Total Cost (Before VAT) 8,579.60 € 9.3 Costs Analysis The total cost of 8,579.60 €is reasonable considering the advanced technology and performance of the Allegro Hands. However, it is important to note that similar robotic hands, such as the Shadow Hand [55], cost approximately 100,000 €, which is five times more expensive than the Allegro Hand. While these alternatives offer higher performance and more advanced capabilities, they also significantly limit accessibility to researchers and small organizations due to their high cost. In contrast, the Allegro Hand strikes a balance between affordability and performance. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 151 10 Conclusions This project has successfully accomplished its primary objective of developing a robust software solution for controlling the Allegro robotic hand. In addition to addressing the original objectives, the project overcame various challenges, including managing differences in communication protocols across multiple versions of the Allegro Hand and resolving discrepancies with official joint limit parameters for each motor. The result is a versatile and adaptable software package that enables advanced grasping and manipulation tasks using the Allegro Hand. Designed for easy integration into larger robotic systems, the package is also prepared for future expansion, laying a strong foundation for continued research in robotic manipulation. 10.1 Key Achievements •Development of Allegro Hand Library: The creation of a C++ library for controlling the Allegro Hand has fulfilled its objective by offering compatibility across different versions of the hand and supporting both real and simulated environments. The library implements forward and inverse kinematics, several controllers, and both predefined and customizable hand configurations. A notable challenge, variations in joint limit values across different versions and with the official values, was mitigated by introducing a solution that dynamically reads and adjusts these limits. Furthermore, the library is designed for extensibility, allowing new functionalities to be easily added, such as new controllers. It can also be easily adapted to other robotic hands, like the Leaphand [42]. Detailed documentation has been provided to ensure clarity for users, including instructions usage and for adding new hands and controllers. •Integration with ROS 2: The ROS 2 package for the Allegro Hand enables smooth integration with other robotic systems and sensors. Allowing to control the Allegro Hand in the ROS 2 environment, offering a broad range of services and actions. This package also ensures compatibility across different versions of the hand and supports both real and simulated environments. The seamless integration enhances the system’s utility in research and development contexts. •Weiss Sensor Integration: The successful integration of Weiss tactile sensors allows the Allegro Hand to perform force-controlled grasps, enhancing its manipulation capabilities. As it has been stated in Chapter 8, while the integration process works well and the fingers pause, retrieve or stop their motion depending on the sensed data, this does not guarantee an stable grasp, in the future work section this will be discussed. The integration involved converting the ROS 1 Weiss sensor package to ROS 2, maintaining compatibility with modern robotic systems. Also, developing the Allegro Hand Weiss ROS 2 package, which manages data from both the sensor and the hand, allowing the user to execute force-controlled grasps. Furthermore, this enables both predefined and customizable grasps, adapting to various objects based on the provided contact points. •Testing and Validation: Extensive testing with Allegro Hands version 2 and version 4 confirmed the software’s reliability across versions. The dynamic adjustment of joint limits addressed inconsistencies in hardware, and forward/inverse kinematics were successfully validated. The ability to execute force-controlled grasps was also successfully tested. Page 152 10.2 Future Work The developed software has proven highly versatile, supporting multiple versions of the Allegro Hand while offering flexibility for adaptation to other robotic systems. This robustness stems from the inclusion of forward and inverse kinematics, flexible controllers, and predefined and customizable hand configurations and grasps. The software’s compatibility with the ROS 2 environment allows for seamless integration with larger robotic systems such as MADAR, further expanding its potential applications. The integration of Weiss tactile sensors has further enhanced the Allegro Hand’s capabilities by enabling force-controlled grasps, particularly in advanced manipulation tasks. This project establishes a solid foundation for future research in robotic manipulation and grasp theory. The modular software design allows for future improvements, such as the integration of more advanced controllers and functionalities. Moreover, the comprehensive documentation ensures accessibility for other researchers and engineers, promoting future advancements in robotic hand control. 10.2 Future Work The recommendations for future work encompass several important areas of improvement and exploration. While the Allegro Hand Library is currently complete, there are opportunities for enhancing its functionality through the development of new control algorithms aimed at improving grasp stability. In addition, extending the testing of the library to other robotic hands with similar configurations would be a valuable next step. To achieve this, a new CAN_AH child class has to be created to handle communication protocols specific to other robotic hands, making it possible to adapt the current framework with minimal modifications. This would allow for broader applicability and versatility in different robotic systems. In the ROS 2 package, the integration of Weiss tactile sensors opens new possibilities for advanced research in force-controlled grasping. Current efforts are aimed at dynamically adjusting the direction and magnitude of applied forces to achieve force closure. During this project, we developed a software solution that calculates the optimal forces based on the existing contact points, by determining the polytope formed by the intersection of all friction cones which would be used to extract a set of force vectors for each finger that ensure force closure. A significant challenge encountered is the mechanical limitation of the Allegro Hand, which restricts its ability to apply forces in every direction at a given contact point. As a result, not all forces within the friction cone can be executed. Ongoing work is focused on refining the force calculations by limiting them to the feasible directions that the hand can actually apply within the friction cone, thus minimizing slippage. Once this challenge is overcome, the next step would be to develop an optimization strategy that selects forces allowing for uniform distribution across all fingers, or minimizing the overall force exerted by the hand while maintaining a stable grasp. Though these studies are currently focused on single-hand grasping, future research will explore dual-hand grasping, requiring further coordination between two hands to achieve complex manipulation tasks. For dual-hand manipulation, the integration of the Allegro Hand into a dual-arm robot, such as the MADAR system, is essential. The ROS 2 package has been designed with flexibility in mind, ensuring that it can be easily adapted for use within the MADAR ROS 2 software, facilitating future studies on dual-hand manipulation and coordinated control. Control of an anthropomorphic robotic hand for grasping and manipulation tasks Page 153 Another promising area for future work is the integration of additional sensors beyond the Weiss tactile sensors. Weiss sensors, while useful, exhibit sensitivity to temperature changes, which affects their accuracy and performance. The incorporation of more advanced or complementary sensors, could provide more reliable data and improve grasp quality. Exploring machine learning techniques for grasp optimization presents another exciting avenue for improvement. Reinforcement learning or other adaptive AI methods could be employed to enable the Allegro Hand to learn from experience, optimizing its grasping and manipulation strategies. This approach would allow the hand to adapt to new objects and conditions dynamically, further enhancing its versatility in complex tasks. Additionally, the current implementation assumes that the initial contact points on the object to be grasped are provided. Other researchers at IOC are developing machine learning models to determine the optimal contact points for different tasks. For example, the ideal contact points for passing a bottle will differ from those required for opening it. Integrating such models with the current framework would enable the Allegro Hand to not only execute grasps but also select the most effective points of contact based on the intended manipulation task. Lastly, manipulation tasks extend beyond grasping alone. Future work should focus on improving the hand’s ability to manipulate objects once grasped, such as reorienting, rotating, or applying fine adjustments to achieve complex manipulative tasks. This will involve further development of precise control mechanisms, allowing the Allegro Hand to execute sophisticated manipulation strategies that mimic human dexterity. Researchers at IOC are also investigating this area, applying machine learning techniques to improve object manipulation capabilities. In conclusion, there are numerous opportunities to build upon the current achievements of this project. Advancing control algorithms, integrating more precise sensors, exploring machine learning, and expanding the capabilities for both single and dual-hand manipulation will significantly enhance the Allegro Hand’s potential in real-world applications. 10.3 Personal Learning Experience Throughout this project, I have deepened my understanding of grasp theory, robotic manipulation, software development and system integration. The knowledge gained during my master, particularly in Introduction to ROS and Robotics, Kinematics, Dynamics and Control, was invaluable in overcoming the challenges of developing the Allegro Hand control software. Additionally, subjects like Embedded and Real Time Systems played a key role in crafting an efficient solution for real-time control and sensor integration. This project allowed me to consolidate the knowledge gained during the master with practical, hands-on experience, enhancing my ability to apply advanced engineering techniques in solving complex robotic challenges. Working in the Robotics Laboratory of the IOC allowed me to have the opportunity to learn from experienced professors and researchers, enhancing my technical skills and gaining insight into the research field.