# Classification of hierarchical text using geometric deep learning:
the case of clinical trials corpus

Sohrab Ferdowsi  Correspondence<EMAIL_ADDRESS>and
<EMAIL_ADDRESS>University of Geneva, Switzerland  Nikolay Borissov
Risklick AG, Bern, Switzerland  Clinical Trials Unit, Bern, Switzerland
Julien Knafou  HES-SO, Geneva, Switzerland  Poorya Amini  Risklick AG, Bern,
Switzerland  Clinical Trials Unit, Bern, Switzerland  Douglas Teodoro
University of Geneva, Switzerland  HES-SO, Geneva, Switzerland

###### Abstract

We consider the hierarchical representation of documents as graphs and use
geometric deep learning to classify them into different categories. While
graph neural networks can efficiently handle the variable structure of
hierarchical documents using the permutation invariant message passing
operations, we show that we can gain extra performance improvements using our
proposed selective graph pooling operation that arises from the fact that some
parts of the hierarchy are invariable across different documents. We applied
our model to classify clinical trial (CT) protocols into completed and
terminated categories. We use bag-of-words based, as well as pre-trained
transformer-based embeddings to featurize the graph nodes, achieving f1-scores
$\simeq 0.85$ on a publicly available large scale CT registry of around 360K
protocols. We further demonstrate how the selective pooling can add insights
into the CT termination status prediction. We make the source code and dataset
splits accessible.

##  1 Introduction

The safety and efficacy evaluation of medications and clinical interventions
is performed using clinical trials (CT’s) Plenge (2016). Prior to their
implementation, CT protocols are carefully designed, detailing important
aspects of the study, including the number of enrolled patients, their
inclusion and exclusion criteria, and the expected outcome, as required by
healthcare authorities Turner (2020). Regrettably, a large fraction of CT’s
terminate before reaching a study conclusion Fogel (2018). This is linked
directly to delays in providing treatment for the world diseases and to
significant excess financial costs DiMasi et al. (2016).

CT protocols are often modelled and represented using tree-like or more
generally graph-like structures, such as XML, JSON and DOM Benson and Grieve
(2021). These models use a set of nodes $\mathcal{V}$ representing sections
connected by a set of relations $\mathcal{E}$ of type part of to encode nested
information. The information encoded by a given section of a CT is then the
recursive combination of the information encoded by its subsections. As an
example, Fig. 1 depicts a simplified CT protocol. Without explicit encoding, a
flat-structured text feature extractor would ignore these inter-dependencies.
To best consider the inter-connected nature of different elements of a CT
protocol, it is thus necessary to take its hierarchical structure into
account.

Figure 1: Schematic view on the simplified tree structure of a typical
clinical trial protocol from ClinicalTrials.gov. Leaf nodes contain free text.
Top parent nodes are fixed across trees, but children nodes can contain
variable structure.

The systematic way to consider the structural information of data is the
promising paradigm of graph neural networks (GNN’s) and more generally
geometric deep learning Bronstein et al. (2017). Geometric deep learning aims
to provide a joint representation of different component features, along with
their topology. A key element in most GNN models is the message passing
algorithm between nodes Gilmer et al. (2017), which aggregates the features of
nodes based on their neighborhood connectivity. Focusing on the structure of a
CT protocol, which is essentially a tree with free-text on its leaf nodes, the
parent nodes initialized with zero vectors will aggregate feature vectors of
the children nodes during message passing iterations, as depicted in Fig. 2.

The power of GNN’s lies on their ability to aggregate topology and features
when node labeling is arbitrary, i.e., when there is no canonical way of
labeling the nodes. Famous examples of this use case are in molecular graphs,
e.g., Gilmer et al. (2017), when graph nodes consist of atoms, for which no
natural ordering is meaningful. The message passing between nodes, followed by
a set pooling operation (typically averaging) after node-level representation
learning will then provide a global representation for the whole graph, making
them suitable for downstream tasks like regression Wang et al. (2019). As for
the hierarchical text data like CT protocols, however, this is not exactly the
case. While the leaf nodes may have arbitrary structure and hence can benefit
from general recipes of GNN’s, the parent nodes are typically fixed across all
graphs and do not have to undergo global pooling. Therefore, as we will show
next, a selective pooling that keeps this structure intact is preferred to the
permutation invariant pooling.

This paper has the following contributions:

  * •

This is the first effort to use GNN’s on hierarchical text data with free
text. While the works of Shang et al. (2019b); Choi et al. (2017) use GNN’s on
one-hot-encoded nodes of medical codes, our node features consist of
embeddings of free text, as we discuss in sec. 3. Beyond the example of CT
data considered in this paper, this approach can be useful for other
hierarchical text data, e.g., like in scientific publications or trademark and
patent-related texts.

  * •

For the hierarchical text data with a combination of fixed and variable node
structures, we propose “selective pooling” that benefits from the GNN’s node-
embedding power, as well as the a priori knowledge of the fixed part of the
structure.

  * •

We present the first deep learning-based approach to CT termination status
prediction. The recent work of Elkin and Zhu (2021) uses hand-crafted features
and reports AUC $\simeq 0.73$. On a similar experimental setting our results
reach AUC $\simeq 0.93$ without feature engineering.

We furthermore provide practical insights and recipes as how to make a bag-of-
words (BOW) vectorizer around 50 times faster than a pre-trained BERT model
Devlin et al. (2018) in evaluation run time with a loss of F1-score of
classification only around $2\%$.

The rest of the paper is organized as follows. In section 2, we describe the
related works for the different elements to our paper, i.e., the general
problem of text classification, graph-based deep learning, the use of graphs
in text, as well as the use of machine learning in the study of CT’s. Section
3 discusses our proposed solutions in terms of how we featurize the texts and
the way we represent hierarchical texts as graphs suitable for graph-based
deep learning. Section 4 details how we prepare the CT corpus for
classification, the baseline and the proposed methods used and a discussion of
the classification results of each of these methods, as well as an effort for
explainability of the graph-based representation. The paper is finally
concluded in section 5.

##  2 Related work

###  2.1 Text classification

An extensively studied problem at the core of many NLP applications is the
text classification problem, which assigns categorical labels to textual data.
Apart from the classification algorithm, feature representation for text is a
crucial step of text classification. Classical approaches represent text using
the BOW representation of tokens, which disregard the sequential nature of
text and essentially provide histogram-like information of tokens within the
corpus. A next generation of methods use word embedding techniques, like the
word2vec Mikolov et al. (2013a, b) and GloVe Pennington et al. (2014), which
furthermore consider the neighborhood relation of words and can benefit from
external corpora for training the representations. Another line of work
focuses on the sequential structure of tokens within text and uses deep
learning architectures like the CNN’s, as in Kim (2014), or RNN’s, as e.g., in
Tai et al. (2015) to capture semantic information.

The state-of-the-art paradigm for a wide range of language understanding
tasks, including text classification, is language modeling using transformers
Vaswani et al. (2017). Most notably BERT Devlin et al. (2018) and its
subsequent works, like RoBERTa Liu et al. (2019) and XLNet Yang et al. (2019),
provide state-of-the-art results using different pre-training strategies based
on the transformer architecture. These structures benefit from the self-
attention mechanism that both provides better sequence modeling capabilities
with longer range focus, as well as parallel processing capabilities to fully
exploit GPU and TPU processing capacities. The very high expressive power of
these networks makes them capable of benefiting from very large corpora
trained on different areas and languages providing valuable domain knowledge
to the downstream tasks. However, an important shortcoming of the original
transformer structures is their inability to process long texts, due to their
quadratic complexity w.r.t. the sequence length. Moreover, they require
substantial hardware requirements also at the inference time making them not
applicable to certain scenarios.

The issue with quadratic complexity of transformers, however, is being
actively studied and a multitude of solutions exist to date, such as the
Linear transformer of Katharopoulos et al. (2020), the Efficient attention
Shen et al. (2021), the Linformer Wang et al. (2020), the Longformer Beltagy
et al. (2020), or the Reformer Kitaev et al. (2019), among others. While they
provide the promise of linear complexity with satisfactory performance, as
tested by benchmarks like in Tay et al. (2020), on the pragmatic side, there
still does not exist many pre-trained models available, especially for
particular domains like biomedical.

###  2.2 Graph neural networks

While most deep learning architectures operate on Euclidean grids with fixed
structure, GNN’s attempt at the generalization of deep learning concepts to
graph structured data using symmetry and invariance.

Consider a graph $\mathcal{G}=(\mathcal{V},\mathcal{E};\mathcal{X})$ with node
sets $\mathcal{V}=\\{v_{1},\cdots,v_{|\mathcal{V}|}\\}$, a set of edges
$\mathcal{E}$ consisting of pairs of nodes $(u_{i},v_{i})$, which denote the
existence of an edge between the two nodes $u_{i},v_{i}\in\mathcal{V}$, as
well as a set of features
$\mathcal{X}=\\{\mathbf{x}_{1},\cdots,\mathbf{x}_{|\mathcal{V}|}\\}$
associated to each of the nodes.

While many applications consider finding useful representations within a
graph, the graph classification/regression problems consider finding a global
representation $\mathbf{z}_{j}$ for every given
$\mathcal{G}_{j}\in\\{\mathcal{G}_{1},\cdots,\mathcal{G}_{N}\\}$. This should
incorporate topology information from $\mathcal{E}_{j}$, as well as feature
information $\mathcal{X}_{j}$. Note that in general, there does not exist a
canonical ordering of nodes within a graph, i.e., within the same graph, nodes
can be re-labeled without any semantic implications and no one-to-one
correspondence necessarily exists between nodes across different graphs.

The standard approach to tackle this permutation ambiguity is the message
passing between nodes, as e.g., in Gilmer et al. (2017), where nodes
$v\in\mathcal{N}(u)=\\{v\in\mathcal{V}|(v,u)\in\mathcal{E}\\}$ in the
immediate neighborhood of $u$ send a “message” using an “aggregation”
operation on their features, which is then used to “update” the features of
$\mathbf{u}$, as:

$\mathbf{x}_{u}^{[l+1]}=\mathbb{U}\left[\mathbf{x}_{u}^{[l]};\mathbb{A}\left\\{\mathbf{x}_{v}^{[l]},\forall
v\in\mathcal{N}(u)\right\\}\right],$ (1)

where super-scripts $1,\cdots,l,\cdots,L$ refer to the fact that this
operation is carried out $L$ times. Starting from
$\mathbf{x}^{[1]}=\mathbf{x}\in\mathcal{X}$, $\mathbb{A}\\{\cdots\\}$ and
$\mathbb{U}[\cdot,\cdot]$ are generic differentiable aggregate and update
operations, respectively. Famous examples of these operations are the Graph
Convolutional Networks (GCN) from Kipf and Welling (2016), or the Graph
Attention Network (GAT) from Veličković et al. (2017), among many others.

At the end of $L$ iterations of message passing, each
$\mathbf{x}_{v}^{[L]},v\in\mathcal{V}$ has aggregated features from its
$L$-hop neighbors, so that both topology and feature information have been
taken into account. These aggregated features should then follow a global
“pooling” stage $\mathbb{P}_{G}\\{\cdots\\}$, where a final representation
$\mathbf{z}_{\mathcal{G}_{j}}$ is derived for the whole graph, as:

$\mathbf{z}_{\mathcal{G}_{j}}=\mathbb{P}_{G}\big{\\{}\mathbf{x}_{v}^{[L]},v\in\mathcal{V}\big{\\}},$
(2)

which is usually taken to be simply an averaging operation. This final
representation is then treated as an input feature to a generic classifier,
usually a differentiable MLP. The learnable parameters of the GNN, i.e., those
from the aggregation and update for each layer, as well as the final MLP are
then jointly updated with back-propagation using usual techniques of deep
learning on mini-batches of training examples
$\\{(\mathcal{G}_{1},y_{1}),\cdots,(\mathcal{G}_{|\mathcal{V}|},y_{|\mathcal{V}|})\\}$,
with $y_{j}$ being the label associated to $\mathcal{G}_{j}$ for the exemplar
case of graph classification.

####  2.2.1 GNN’s for text

A new line of work, e.g., Yao et al. (2019); Zhang and Zhang (2020); Ding et
al. (2020), tries to represent textual data as graphs, where the graphical
structure is built from co-occurrence of words, either in a corpus level and
hence constructing a very big graph for the whole corpus, or in a document
level where a separate graph is constructed for each document. Text
classification will then be carried out using GNN’s as node classification and
graph classification problems, for the first and second cases, respectively.
This is fundamentally different from our case, where the graph structure is
not constructed from text, but the text itself is structured hierarchically,
as in a CT protocol.

Another line of work, as in Shang et al. (2019b); Choi et al. (2017); Shang et
al. (2019a) considers the Electronic Health Records (EHR) data as graphs and
uses GNN’s to integrate them within healthcare data for solving different
tasks. For their case, however, the node features consist of one-hot encoding
fixed ontologies, and do not contain free text like in our case.

###  2.3 Machine learning efforts on CT understanding

There has been few works in the literature reporting data-driven methods to
assess the termination status of CT’s. The work of Follett et al. (2019) uses
a simple text mining approach to identify keywords associated to CT
termination of the ClinicalTrials.gov (CTGov) data and uses random forests to
classify the risk of termination. The work of Geletta et al. (2019) uses
Latent Dirichlet Allocation to find risk-relevant topics and uses the topic
probabilities for risk classification using random forests.

The recent work of Elkin and Zhu (2021) poses the problem as a classification
of CT’s into “completed” and “terminated” categories. They use feature
engineering to feed a set of hand-crafted features into different off-the-
shelf classical classifiers. However, even their ensemble methods do not
provide satisfactory results. They furthermore perform traditional feature
selection and ranking strategies to identify top keywords associated to CT
termination.

##  3 Proposed method

###  3.1 Text featurization

As a baseline approach to get vectorized representations for free text, we use
a BOW-based representation followed by TF-IDF re-weighting, as well as random
projections. We also use state-of-the-art pre-trained transformers to improve
performance. We next describe these approaches.

####  3.1.1 Bag-of-words

After standard pre-processing of text (lower-casing, removal of special
characters and punctuations, ..), we construct a BOW-based vectorized
representation for each protocol, disregarding the hierarchical structures.
This is then followed by TF-IDF to re-weight tokens based on their relative
importance.

Concretely, for a set of tokens
$\mathcal{W}=\\{w_{1},\cdots,w_{i},\cdots,w_{|\mathcal{W}|}\\}$, a CT protocol
$1\leq j\leq N$ is represented by
$\mathbf{x}_{j}=[x_{j1},\cdots,x_{ji},\cdots,x_{j|\mathcal{W}|}]^{T}$, where
$x_{ji}$ counts the number of occurrences of $w_{i}$ in the $j^{\text{th}}$
protocol. TF-IDF re-weights the $i^{\text{th}}$ element of these vectors as

$\tilde{x}_{ji}=\left(\mathbf{x}_{j}^{T}\mathbf{1}_{|\mathcal{W}|}\right)\log{\left(\frac{N}{||\mathbf{x}(i)||_{0}}\right)}x_{ji},$
(3)

where $\mathbf{1}_{|\mathcal{W}|}$ is an all-ones vector of size
$|\mathcal{W}|$, the $\ell_{0}$ norm $||\cdot||_{0}$ counts the number of non-
zero elements of a vector and $\mathbf{x}(i)$ is the $i^{\text{th}}$ row of
the matrix
$\mathrm{X}=[\mathbf{x}_{1},\cdots,\mathbf{x}_{j},\cdots,\mathbf{x}_{N}]$.

An important difficulty with BOW-based representations is the dimensionality
$|\mathcal{W}|$, which can be as high as even $10^{6}$. Feeding this to a
model with learnable parameters has a very high chance of over-fitting, as
well as a very high computational complexity for matrix-vector operations.

BOW-based representations, however, benefit from very high degrees of
sparsity. A classical result from the domain of compressive sensing Candes and
Tao (2005) suggests that a high dimensional sparse vector $\tilde{\mathbf{x}}$
can be projected to lower dimensions using a random matrix
$\mathrm{A}\in\Re^{d\times|\mathcal{W}|}$ as
$\hat{\mathbf{x}}=\mathrm{A}\tilde{\mathbf{x}}$, virtually without any loss of
information. Provided that the sparsity is high enough, one can aim for
$d\ll|\mathcal{W}|$. Furthermore, it has been shown Li et al. (2006) that the
random projection matrix itself can be chosen to also be sparse. This is very
beneficial in practice, since both $\tilde{\mathbf{x}}$ and $\mathrm{A}$ can
be stored and multiplied in sparse matrix format, e.g. using numerical
packages like SciPy Virtanen et al. (2020).

####  3.1.2 Pre-trained language models

A major drawback of the BOW-based representations is that they totally
disregard context and the sequential nature of text, since they only provide a
histogram-based statistic of token counts. As discussed earlier in sec. 2.1,
the state-of-the-art solution to language modeling is based on the transformer
architecture Vaswani et al. (2017), most notably as in Devlin et al. (2018),
for which a large number of models pre-trained on very large-scale corpora
exist.

While one gets better performance by further fine-tuning transformers on the
downstream task at hand, the computational requirements, most notably their
GPU memory consumption, makes the fine-tuning step very expensive for certain
tasks. In the case of CT protocols, there is usually more than 100 nodes for
each CT, making this step particularly difficult. We therefore suffice only
with fixed embeddings from pre-trained models.

To embed a piece of text using transformers into a vectorial representation,
we use mean-pooling that considers the attention mask for each token into
account, as suggested, e.g., in Reimers and Gurevych (2019).

###  3.2 Graph representation of hierarchical text

Hierarchical text usually comes with a tree structure, where free text appears
in the leaf nodes. Compared to the setup of sec. 2.2 for general graphs, the
difference that this brings to the message passing is that the neighborhood
$\mathcal{N}(u)$ of node $u$ reduces simply to the set of its children nodes
$\mathcal{C}(u)$. Furthermore, the non-leaf nodes
$\\{u\in\mathcal{V}|\mathcal{C}(u)\neq\emptyset\\}$ will be initialized with
zero features, and will aggregate features from their children during
iterations. Fig. 2 summarizes the graph representation steps.

Figure 2: A hierarchical structure with extracted feature vectors from free
text in leaf nodes is passed to a generic message passing algorithm. The
resulting graph with aggregated features is pooled and passed to an MLP to
produce the predicted class label.

####  3.2.1 Selective pooling

Since the general structure of CT protocols is invariable across different CT
examples, one can do better than the general pooling strategy of Eq. 2.

Consider a set of nodes $\bar{\mathcal{V}}\in\mathcal{V}$, for which the
enumeration is preserved across all $\mathcal{G}_{1},\cdots,\mathcal{G}_{N}$.
To benefit from this invariance, one can consider a simple “selective pooling”
as

$\mathbb{P}_{S}\big{[}\mathbf{x}_{v}^{[L]},v\in\bar{\mathcal{V}}\big{]}=\underset{v\in\bar{\mathcal{V}}}{\mathbin{\Big{missing}}\|}\mathbf{x}_{v}^{[L]},$
(4)

where $\mathbin{\|}$ denotes the concatenation of vectors. To also benefit
from the global pooling of GNN’s, one can consider the final graph
representation as a simple concatenation of global and selective pooling as:

$\mathbf{z}_{\mathcal{G}_{j}}=\mathbb{P}_{G}\big{\\{}\mathbf{x}_{v}^{[L]},v\in\mathcal{V}\big{\\}}\mathbin{\Big{missing}}\|\mathbb{P}_{S}\big{[}\mathbf{x}_{v}^{[L]},v\in\bar{\mathcal{V}}\big{]}.$
(5)

Note that while $\mathbb{P}_{G}\\{\cdots\\}$ is a set operation,
$\mathbb{P}_{S}[\cdots]$ is essentially a list operation and hence the order
of the elements should be kept uniform across all graphs.

##  4 Experiments111Source code is available at
https://github.com/sssohrab/ct-classification-graphs.

###  4.1 Data preparation

Healthcare authorities of different countries have different requirements for
the publication of the CT protocols. There are 17 CT registries as identified
by the WHO333https://www.who.int/clinical-trials-registry-platform/network,
where the largest and most complete one is that of ClinicalTrials.gov (CTGov).
This repository is publicly available to
download444https://ClinicalTrials.gov/AllAPIJSON.zip and is the one we use in
this paper. The CTGov corpus is updated daily, and the snapshot used in our
experiments (downloaded on 10th of December 2020) contains 360,497 CT
protocols. Similar to the work of Elkin and Zhu (2021), we include only
interventional studies (i.e., we exclude observational studies as they have a
different nature). Furthermore, we exclude the studies with recruiting status
(as their outcome is not clear yet), and only consider protocols whose overall
status is either completed (74% of our subset), which was used to assign the
“completed” class, or terminated (9%), withdrawn (5%) and suspended (1%),
which are grouped collectively into the “terminated” class, as these 3
categories have similar risk outcome in practice. This resulting set contains
188,915 protocols, which we split into train, validation and test sets with
ratios of $70\%$, $15\%$ and $15\%$, respectively.555The database, as well as
exact splits are available at zenodo Ferdowsi et al. (2021).

While numerous criteria can be considered to judge a CT as risky (e.g.,
whether they achieved FDA approval, whether they had reported safety issues,
..), as a basic label-assignment strategy, we consider the “completed” CT’s as
low-risk, and the “terminated” CT’s as risky ones. This leaves us with a
proportion of $\simeq(74\%,26\%)$ for low-risk and high risk classes,
respectively.

###  4.2 Baseline methods

We report the classification results based on the following methods.

The work of Elkin and Zhu (2021) described earlier uses a snapshot of the
CTGov collection that is downloaded in 2019, to which we do not have access.
Furthermore, their labeling strategy slightly differs from ours, as they only
consider “completed” and “terminated” status. Nevertheless, these are very
minor differences and the results are still comparable. They report F1-scores
$\simeq 0.33$, but only considering the positive class, hence no micro-macro
weighting to be included in table 1.

Fast-text Joulin et al. (2017) is a very efficient library for text
classification providing a strong baseline. We used the same pre-processing
steps as our BOW-based methods (lower-casing, removal of punctuations and
special characters) for tokenization. We trained the model and used the auto-
tuning functionality on the validation split using the standard hyper-
parameter sets.

BOW-W denotes the standard bag-of-words using a token size of $|\mathcal{W}|$
followed by TF-IDF re-weighting as described earlier in sec. 3.1. Note that if
the resultant vector representation is fed directly to a classifier with
learned parameters, the chance of over-fitting increases with $|\mathcal{W}|$,
forcing to chose small vocabulary sizes.

BOW-W-RPd addresses this issue with Random Projections, as described in sec.
3.1. As motivated earlier, along with the sparsity of the BOW representations,
the projection matrix itself can furthermore be chosen to be highly sparse. In
our experiments, we chose $|\mathcal{W}|=500,000$, $d=768$ (to be comparable
with transformers), and for each row, we set a sparsity of $0.01$ using
magnitude thresholding, i.e., only $5,000$ non-zero elements, followed by
normalization to unit-norm. This allowed us to significantly speedup the
calculations (as well as memory), hence not suffering from the very slow run-
time of packages like Gensim (models.rpmodel) Rehurek and Sojka (2011) with
our simple SciPy sparse package. As an example, to vectorize 1000 CT
protocols, it takes around 7 sec, which is roughly 50 times faster than
encoding them with a BERT model (in evaluation mode) on a GPU.

PubMedBERT-pretrain-768 refers to the base-BERT pre-trained on PubMed
abstracts and PubMedCentral full-texts as introduced in Gu et al. (2020). We
do not fine-tune the weights on our classification task and use the model in
evaluation mode only. We use the interface provided by the Transformer’s
library Wolf et al. (2020), and use the PyTorch framework Paszke et al. (2019)
in all our experiments. After the embedding vectors are calculated, we use the
exact same network as the BOW counterpart (but with different hyper-parameter
sets).

Flat-1 refers to the case where we take the tree structure of the CT protocol
and simply flatten it into 1 field. We then vectorize this field using the
above methods and feed it to a classifier network. As for the classifier, we
use a 3-layer MLP with a low-rank decomposition of the first linear layer,
along with the standard deep learning recipes (batch-normalization, dropout,
..) and use the Adam optimizer with standard hyper-parameters. At each mini-
batch, we re-weight the importance of each CT sample to the cross-entropy loss
based on the class priors, such that the classes become virtually balanced. We
keep this loss function (weighted-BCE) the same across all experiments.

Flat-9 summarizes each CT into 9 vectors, each corresponding to one major
parent node of the tree. This is to avoid shrinking all information into one
vector and keeps some of the original tree structure. The 9 chosen fields are
“sponsor-collaborator”, “oversight”, “description”, “condition”, “design”,
“arms-intervention”, “outcomes”, “eligibility” and “contacts-location” modules
of CTGov protocols. When non-existing in some protocols, we assign them all-
zero vectors. We feed the resulting 9-channel input tensor to a network with a
shared initial small MLP head that independently processes each channel and
then concatenates the results and passes it through another small MLP. Except
for the concatenation part, this is essentially equivalent to the network used
in flat-1.

GCN-global uses 3 layers of the standard graph convolutional block of Kipf and
Welling (2016) with hidden dimension of 200 and a global average pooling as in
Eq. 2. This is then followed by a standard MLP to produce the final output. We
use the GCN implementation as provided by the PyTorch-Geometric framework Fey
and Lenssen (2019) and use the data-loading functionalities therein to handle
our GNN experiments.

GCN-selective-9 uses the selective pooling that we introduced in Eqs. 4 and 5.
To keep the dimensionalities comparable with the global pooling, we chose the
output dimension of the third GCN as 20. When the 9 fields, plus the global
pooling are concatenated, this will amount to 200, same as in the GCN-global
above. In order to see the effect of graph-based modeling, these 9 fields are
chosen to be the same as in the Flat-9 method above.

###  4.3 Classification results

Table 1 summarizes the classification results on the test set of our
collection based on the standard precision, recall, F1-score macro, F1-score
micro, as well as the area under the ROC curve metrics.

Table 1: Performance comparison for models described in sec. 4.2.  Method | Precision | Recall | F1-score | AUC
---|---|---|---|---
|  |  | macro | micro |
Elkin and Zhu (2021) | - | - | - | - | 0.7281
Fast-text Joulin et al. (2017) | 0.8489 | 0.7205 | 0.7531 | 0.8402 | 0.8456
BOW-500000-RP768-flat-1 | 0.6145 | 0.6300 | 0.6146 | 0.6453 | 0.7034
PubMedBERT-pretrain-768-flat-1 | 0.6512 | 0.6763 | 0.6260 | 0.6346 | 0.7246
BOW-1000-flat-9 | 0.6489 | 0.6713 | 0.6488 | 0.6346 | 0.7369
BOW-500000-RP768-flat-9 | 0.7572 | 0.7793 | 0.7652 | 0.7906 | 0.8701
PubMedBERT-pretrain-768-flat-9 | 0.8144 | 0.8144 | 0.8144 | 0.8419 | 0.8911
BOW-500000-RP768-GCN-global | 0.8185 | 0.8233 | 0.8208 | 0.8462 | 0.9116
PubMedBERT-pretrain-768-GCN-global | 0.8426 | 0.8503 | 0.8463 | 0.8675 | 0.8881
BOW-500000-RP768-GCN-selective-9 | 0.8419 | 0.8337 | 0.8376 | 0.8632 | 0.9082
PubMedBERT-pretrain-768-GCN-selective-9 | 0.8454 | 0.8519 | 0.8485 | 0.8697 | 0.9267

The following observations can be made from the classification results:

  * •

We notice that taking the hierarchical structure of the CT protocols into
account is crucial for classification. The flat-9 models significantly
outperform those of flat-1.

  * •

Increasing the vocabulary size of BOW tokens significantly improves
performance. The random projections, as well as the sparsification of the
projector matrix are very effective tricks to make this practical.

  * •

The use of transformer-based embeddings invariably improves performance w.r.t.
the BOW. This, however, comes at the price of slower run-times, around 50
times slower than the BOW counterpart starting from raw text to the embedding.

  * •

GNN-based modeling of CT protocols provides a net increase of performance
w.r.t. the flat structures. As a very straightforward example for comparison,
because of the linear nature of BOW (disregarding the TF-IDF), the embedded
features of each of the fields of the BOW-flat-9 are the summation of their
corresponding children nodes of BOW-GCN-selective-9 before starting the
message passing. During the algorithm’s iterations, the message passing takes
the hierarchy into account and pools the information much more effectively
than a simple summation, resulting into a superior final performance.

  * •

The selective pooling proposed in this paper, which incorporates knowledge of
the document structure, as well as the message passing of GNN’s over the leaf
nodes increases performance w.r.t. the global pooling, which benefits only
from the latter. This is particularly useful for explainability analyses as we
will see next.

###  4.4 Explainability

While attracting a lot of recent attention from deep learning research
communities, the explainability of graph neural network models are less
explored and hence less developed compared to the grid-structured data like
flat text or images Yuan et al. (2020). This is in part due to the lack of
locality information which arises from the inherent permutation ambiguity of
nodes that we discussed earlier. So the extension of the explainability
techniques developed for grid data is not trivial, e.g., due to the non-
differentiable nature of the graph adjacency matrix.

Figure 3: Gradient norms of 9 CT protocol fields w.r.t. the class outputs
averaged over 1,000 not-completed CT’s.

As a useful workaround to bypass these issues, the selective pooling proposed
in this paper can readily use basic gradient-based techniques used in other
domains. As an example, we investigate the norm of the gradient of the
selectively-pooled nodes w.r.t. the output, i.e.:

$\alpha_{v}=\Big{|}\Big{|}\frac{\partial
y^{c}}{\partial\mathbf{x}_{v}^{[L]}}\Big{|}\Big{|}_{2},\;\;v\in\bar{\mathcal{V}}$
(6)

Fig. 3 sketches the average values for 1,000 CT’s classified as high-risk by
the BOW-500000-RP768-GCN-selective-9 model above.

Fig. 4 shows the t-SNE Van der Maaten and Hinton (2008) visualizations of the
same 9 fields ($\mathbf{x}_{v}^{[L]}\in\Re^{20}$) for the two classes.

(a) Per-field (b) Global

Figure 4: Visualization using t-SNE of the (a) selective pooling of the 9
fields (b) the layer after pooling. The selective pooling reveals the fields
usually associated to risk.

The two above figures confirm the source of risk in CT protocols to be the
“Design” and “ContactsLocation” fields. This is in accordance with studies
like Fogel (2018), which identify the main sources of CT failure as lack of
recruitment, that appears under the Design module of the protocol, and
problems related to funding, which can be associated with the locations in
which the trials are carried out.

##  5 Conclusions

We used Graph Neural Networks to represent the structure, as well as the
extracted features from free text within hierarchical documents. Our use case
was the classification of interventional clinical trials into two different
risk categories based on their protocols. On a publicly available corpus of
around 360K protocols, we showed that the use of GNN’s provides a net increase
in performance, compared to structure-agnostic baselines. To better
incorporate the power of GNN’s into the invariable a priori known template, we
proposed selective pooling to boost the performance of global pooling.
Furthermore, we showed that this approach provides straightforward solutions
for explainability, where we demonstrated some consistency between gradient
activities of protocol fields within our model to known factors of risk from
clinical trials research literature.

## Acknowledgments

This work is funded by the Swiss Innovation Agency, Innosuisse under the
project with funding number 41013.1 IP-ICT.

## References

  * Beltagy et al. (2020) Iz Beltagy, Matthew E Peters, and Arman Cohan. 2020.  Longformer: The long-document transformer.  _arXiv preprint arXiv:2004.05150_.
  * Benson and Grieve (2021) Tim Benson and Grahame Grieve. 2021.  Uml, xml and json.  In _Principles of Health Interoperability_ , pages 399–426. Springer.
  * Bronstein et al. (2017) Michael M Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. 2017.  Geometric deep learning: going beyond euclidean data.  _IEEE Signal Processing Magazine_ , 34(4):18–42.
  * Candes and Tao (2005) Emmanuel J Candes and Terence Tao. 2005.  Decoding by linear programming.  _IEEE transactions on information theory_ , 51(12):4203–4215.
  * Choi et al. (2017) Edward Choi, Mohammad Taha Bahadori, Le Song, Walter F Stewart, and Jimeng Sun. 2017\.  Gram: graph-based attention model for healthcare representation learning.  In _Proceedings of the 23rd ACM SIGKDD international conference on knowledge discovery and data mining_ , pages 787–795.
  * Devlin et al. (2018) Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018.  Bert: Pre-training of deep bidirectional transformers for language understanding.  _arXiv preprint arXiv:1810.04805_.
  * DiMasi et al. (2016) Joseph A DiMasi, Henry G Grabowski, and Ronald W Hansen. 2016.  Innovation in the pharmaceutical industry: new estimates of r&d costs.  _Journal of health economics_ , 47:20–33.
  * Ding et al. (2020) Kaize Ding, Jianling Wang, Jundong Li, Dingcheng Li, and Huan Liu. 2020.  Be more with less: Hypergraph attention networks for inductive text classification.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 4927–4936.
  * Elkin and Zhu (2021) Magdalyn E Elkin and Xingquan Zhu. 2021.  Predictive modeling of clinical trial terminations using feature engineering and embedding learning.  _Scientific reports_ , 11(1):1–12.
  * Ferdowsi et al. (2021) Sohrab Ferdowsi, Nikolay Borissov, Julien Knafou, Poorya Amini, and Douglas Teodoro. 2021.  Classification of hierarchical text using geometric deep learning: the case of clinical trials corpus.
  * Fey and Lenssen (2019) Matthias Fey and Jan E. Lenssen. 2019.  Fast graph representation learning with PyTorch Geometric.  In _ICLR Workshop on Representation Learning on Graphs and Manifolds_.
  * Fogel (2018) David B Fogel. 2018.  Factors associated with clinical trials that fail and opportunities for improving the likelihood of success: a review.  _Contemporary clinical trials communications_ , 11:156–164.
  * Follett et al. (2019) Lendie Follett, Simon Geletta, and Marcia Laugerman. 2019.  Quantifying risk associated with clinical trial termination: a text mining approach.  _Information Processing & Management_, 56(3):516–525.
  * Geletta et al. (2019) S Geletta, L Follett, and MR Laugerman. 2019.  Latent dirichlet allocation in predicting clinical trial failures.
  * Gilmer et al. (2017) Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. 2017.  Neural message passing for quantum chemistry.  In _International Conference on Machine Learning_ , pages 1263–1272. PMLR.
  * Gu et al. (2020) Yu Gu, Robert Tinn, Hao Cheng, Michael Lucas, Naoto Usuyama, Xiaodong Liu, Tristan Naumann, Jianfeng Gao, and Hoifung Poon. 2020.  Domain-specific language model pretraining for biomedical natural language processing.
  * Joulin et al. (2017) Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. 2017.  Bag of tricks for efficient text classification.  In _Proceedings of the 15th Conference of the European Chapter of the Association for Computational Linguistics: Volume 2, Short Papers_ , pages 427–431. Association for Computational Linguistics.
  * Katharopoulos et al. (2020) A. Katharopoulos, A. Vyas, N. Pappas, and F. Fleuret. 2020.  Transformers are rnns: Fast autoregressive transformers with linear attention.  In _Proceedings of the International Conference on Machine Learning (ICML)_.
  * Kim (2014) Yoon Kim. 2014.  Convolutional neural networks for sentence classification.  In _Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 1746–1751, Doha, Qatar. Association for Computational Linguistics.
  * Kipf and Welling (2016) Thomas N Kipf and Max Welling. 2016.  Semi-supervised classification with graph convolutional networks.  _arXiv preprint arXiv:1609.02907_.
  * Kitaev et al. (2019) Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. 2019.  Reformer: The efficient transformer.  In _International Conference on Learning Representations_.
  * Li et al. (2006) Ping Li, Trevor J Hastie, and Kenneth W Church. 2006.  Very sparse random projections.  In _Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining_ , pages 287–296.
  * Liu et al. (2019) Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019.  Roberta: A robustly optimized bert pretraining approach.  _arXiv preprint arXiv:1907.11692_.
  * Mikolov et al. (2013a) Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013a.  Efficient estimation of word representations in vector space.  _arXiv preprint arXiv:1301.3781_.
  * Mikolov et al. (2013b) Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013b.  Distributed representations of words and phrases and their compositionality.  _arXiv preprint arXiv:1310.4546_.
  * Paszke et al. (2019) Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. 2019.  Pytorch: An imperative style, high-performance deep learning library.  In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, _Advances in Neural Information Processing Systems 32_ , pages 8024–8035. Curran Associates, Inc.
  * Pennington et al. (2014) Jeffrey Pennington, Richard Socher, and Christopher D Manning. 2014.  Glove: Global vectors for word representation.  In _Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP)_ , pages 1532–1543.
  * Plenge (2016) Robert M Plenge. 2016.  Disciplined approach to drug discovery and early development.  _Science translational medicine_ , 8(349):349ps15–349ps15.
  * Rehurek and Sojka (2011) Radim Rehurek and Petr Sojka. 2011.  Gensim–python framework for vector space modelling.  _NLP Centre, Faculty of Informatics, Masaryk University, Brno, Czech Republic_ , 3(2).
  * Reimers and Gurevych (2019) Nils Reimers and Iryna Gurevych. 2019.  Sentence-bert: Sentence embeddings using siamese bert-networks.  In _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_ , pages 3973–3983.
  * Shang et al. (2019a) Junyuan Shang, Tengfei Ma, Cao Xiao, and Jimeng Sun. 2019a.  Pre-training of graph augmented transformers for medication recommendation.  _arXiv preprint arXiv:1906.00346_.
  * Shang et al. (2019b) Junyuan Shang, Cao Xiao, Tengfei Ma, Hongyan Li, and Jimeng Sun. 2019b.  Gamenet: Graph augmented memory networks for recommending medication combination.  In _proceedings of the AAAI Conference on Artificial Intelligence_ , volume 33, pages 1126–1133.
  * Shen et al. (2021) Zhuoran Shen, Mingyuan Zhang, Haiyu Zhao, Shuai Yi, and Hongsheng Li. 2021.  Efficient attention: Attention with linear complexities.  In _Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision_ , pages 3531–3539.
  * Tai et al. (2015) Kai Sheng Tai, Richard Socher, and Christopher D Manning. 2015.  Improved semantic representations from tree-structured long short-term memory networks.  _arXiv preprint arXiv:1503.00075_.
  * Tay et al. (2020) Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. 2020.  Long range arena: A benchmark for efficient transformers.  In _International Conference on Learning Representations_.
  * Turner (2020) J Rick Turner. 2020.  New fda guidance on general clinical trial conduct in the era of covid-19.  _Therapeutic Innovation & Regulatory Science_, 54:723–724.
  * Van der Maaten and Hinton (2008) Laurens Van der Maaten and Geoffrey Hinton. 2008.  Visualizing data using t-sne.  _Journal of machine learning research_ , 9(11).
  * Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017.  Attention is all you need.  _arXiv preprint arXiv:1706.03762_.
  * Veličković et al. (2017) Petar Veličković, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua Bengio. 2017.  Graph attention networks.  _arXiv preprint arXiv:1710.10903_.
  * Virtanen et al. (2020) Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J. van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, C J Carey, İlhan Polat, Yu Feng, Eric W. Moore, Jake VanderPlas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, E. A. Quintero, Charles R. Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul van Mulbregt, and SciPy 1.0 Contributors. 2020.  SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python.  _Nature Methods_ , 17:261–272.
  * Wang et al. (2020) Sinong Wang, Belinda Z Li, Madian Khabsa, Han Fang, and Hao Ma. 2020.  Linformer: Self-attention with linear complexity.  _arXiv preprint arXiv:2006.04768_.
  * Wang et al. (2019) Xiaofeng Wang, Zhen Li, Mingjian Jiang, Shuang Wang, Shugang Zhang, and Zhiqiang Wei. 2019.  Molecule property prediction based on spatial graph embedding.  _Journal of Chemical Information and Modeling_ , 59(9):3817–3828.  PMID: 31438677.
  * Wolf et al. (2020) Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. 2020.  Transformers: State-of-the-art natural language processing.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations_ , pages 38–45, Online. Association for Computational Linguistics.
  * Yang et al. (2019) Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. 2019.  Xlnet: Generalized autoregressive pretraining for language understanding.  _arXiv preprint arXiv:1906.08237_.
  * Yao et al. (2019) Liang Yao, Chengsheng Mao, and Yuan Luo. 2019.  Graph convolutional networks for text classification.  In _Proceedings of the AAAI Conference on Artificial Intelligence_ , volume 33, pages 7370–7377.
  * Yuan et al. (2020) Hao Yuan, Haiyang Yu, Shurui Gui, and Shuiwang Ji. 2020.  Explainability in graph neural networks: A taxonomic survey.  _arXiv preprint arXiv:2012.15445_.
  * Zhang and Zhang (2020) Haopeng Zhang and Jiawei Zhang. 2020.  Text graph transformer for document classification.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 8322–8327.


# Energy Tank-based Control Framework for Satisfying the ISO/TS 15066
Constraint

F. Benzi  F. Ferraguti  C. Secchi  Department of Sciences and Methods of
Engineering, University of Modena and Reggio Emilia, Italy (e-mail:
<EMAIL_ADDRESS><EMAIL_ADDRESS>cristian.secchi@unimore.it).

###### Abstract

The technical specification ISO/TS 15066 provides the foundational elements
for assessing the safety of collaborative human-robot cells, which are the
cornerstone of the modern industrial paradigm. The standard implementation of
the ISO/TS 15066 procedure, however, often results in conservative motions of
the robot, with consequently low performance of the cell. In this paper, we
propose an energy tank-based approach that allows to directly satisfy the
energetic bounds imposed by the ISO/TS 15066, thus avoiding the introduction
of conservative modeling and assumptions. The proposed approach has been
successfully validated in simulation.

###### keywords:

Robotics, Human Machine Systems

##  1 Introduction

Collaborative robotics is a fast growing field in the industrial setting and
it allows direct robot and operator interface without traditional
safeguarding. As a consequence of the introduction of human-robot
collaboration technologies, great importance has been attributed to robot
safety standards, which have been updated to address new co-working scenarios.
In particular, the international ISO 10218-1-2011 (2011) and ISO 10218-2-2011
(2011) safety standards have identified specific applications and criteria
where collaborative operations can occur and they have been integrated by the
introduction of the technical specification ISO TS 15066:2016 (2016). The
safety regulations identify four collaborative operations which can be adopted
depending on the requirement of the application concerned and the design of
the robot system: Safety-rated Monitored Stop (SMS), Speed and Separation
Monitoring (SSM), Power and Force Limiting (PFL) and Hand Guiding (HG). These
modalities can be applied in combination in order to achieve higher levels of
productivity, while still preserving safety of the human operators Pupa et al.
(2021). However, in the industrial practice, PFL is typically adopted for
tasks in which intentional or incidental contact between the human and the
robot can occur. Safety is guaranteed by limiting the power and the force
during the contact to values at which the risk of injuries is not expected and
by imposing speed limits that guarantee safe human-robot contacts. Current
approaches for implementing the ISO/TS 15066 guidelines lead to a conservative
behavior (e.g. low velocity) of the robot and, consequently, to poor
performance of the collaborative cell. In Ferraguti et al. (2020), Control
Barrier Functions (CBF) Ferraguti et al. (2022) have been exploited for
enhancing the performance of a robot operating in a collaborative cell while
satisfying the PFL velocity limit. However, the definition of the safe set is
very conservative since it is a collection of ellipses and the overall CBF is
non-smooth due to the abrupt activation and deactivation of the ellipsoids.
Moreover, as stated in the regulation itself, the velocity limit computed
according to the ISO/TS 15066 is based on conservative assumptions and this
results in robot motions that are still very slow. Indeed, the original
formulation of the PFL constraint is a limitation onto the exchanged energy,
which is then turned into a velocity constraint under strong assumptions
(i.e., the assumption of a fully inelastic contact, a two-body model after the
impact). Recently, an energy-based approach has been proposed in Lachner et
al. (2021) to reduce the safety-related parameters to be determined in
physical Human-Robot Interaction (pHRI) applications to a single energy value.
However, the proposed architecture relies heavily on the precise knowledge of
the dynamic model of the manipulator and, in particular, of its inertia
matrix, which is not always available or known with sufficient accuracy.

To overcome these issues, in this paper we leverage energy tanks and
passivity-based control in order to directly address the PFL energetic
constraint. To this aim, we exploit the modulated energy-tanks presented in
recent works Benzi and Secchi (2021); Benzi et al. (2022). These are energy
storing elements which have proven effective in ensuring safety layers for
collaborative applications, by passively implementing any desired dynamics. By
simply controlling the power flow in the system, these techniques can, in
fact, bound the energy of the interconnected system without requiring any
knowledge of its model, while at the same time providing formal guarantees of
robust stability.

Thus, the contribution of this paper is an energy tank-based control
architecture designed to comply directly with the time-varying energetic
bounds of the ISO TS 15066:2016 (2016). This allows us to overcome the
modeling assumptions underlying the conservative velocity limitation. At the
same time, owing to the passivity-based nature of the formulation, our
approach does not require the precise knowledge of the dynamic model of the
robot, improving upon this limitation of Lachner et al. (2021).

##  2 Background on Power and Force Limiting

As specified in ISO/TS 15066, PFL is a form of collaborative operation in
which intentional or incidental contact between the moving robot and a human
body region can occur. Safety is achieved by limiting the contact pressure and
force to values at which injuries and risks are not to be expected. These
maximum values (bio-mechanical load limits) have been established on the basis
of pain sensitivity thresholds. The Annex A of the ISO/TS 15066 reports the
maximum contact pressure and force for each body area. From these values, the
maximum energy transfer due to an hypothetical human-robot contact is
determined, treating the body part as a linear spring. Formally, for each body
region the maximum permissible energy transfer can be calculated as ISO TS
15066:2016 (2016):

$E_{max}=\frac{f^{2}_{max}}{2k},$ (1)

where $f_{max}\in\mathbb{R}$ is the maximum contact force for the body region
and $k\in\mathbb{R}$ is the related effective spring constant.

The energy transfer limit established in (1) is then used to compute the
maximum velocity at which the robot can move into the collaborative workspace,
while ensuring safety in case of collision. Let us define
$v_{rel}\in\mathbb{R}$ as the relative velocity between the robot and the
human along the minimum distance direction between the threatened body part
and the closest link of the robot.

In order to derive a relationship between the relative velocity and the
contact force, the ISO/TS 15066 assumes a fully inelastic contact during the
collision, in which the total kinetic energy of the two-body system is
transferred to the human body part. The resulting balance is:

$E=\frac{f^{2}}{2k}=\frac{1}{2}\mu v^{2}_{rel},$ (2)

where $E\in\mathbb{R}$ is the energy transferred and $\mu\in\mathbb{R}$ is the
reduced mass of the two body system, computed as:

$\mu=(m_{h}^{-1}+m_{r}^{-1})^{-1},$ (3)

in which $m_{h}\in\mathbb{R}$ is the mass of the human body area and
$m_{r}\in\mathbb{R}$ the mass of the robot, the latter computed as:

$m_{r}=(M/2)+m_{L},$ (4)

being $M\in\mathbb{R}$ the mass of the moving parts of the robot, while
$m_{L}\in\mathbb{R}$ is the total payload. Both $m_{h}$ and $k$ are tabulated
in the Annex A of the ISO/TS 15066, for each body region. Thus, combining (1)
and (2), safety in PFL operations is encoded by the following constraint on
the velocity between the robot and a given human body part:

$v_{rel}\leq v_{max}=\frac{f_{max}}{\sqrt{\mu k}}.$ (5)

##  3 Problem Statement

The velocity limit computed according to the ISO/TS 15066 and given by (5) is
severely conservative, due to the assumptions underlying its formulation. In
particular, we could list the following drawbacks related to the direct
implementation of the ISO/TS 15066:

  1. 1.

As showcased, e.g., in Khatib (1995) and Haddadin et al. (2010), the force
exerted during a contact scenario $f$ depends on both the robot configuration
and the direction of the contact. Therefore, the computation of the effective
robot mass $m_{r}$ in (4) is often inaccurate and can result in large over-
estimations.

  2. 2.

The assumption that the transient contact between a robot and a human body
part results in a fully inelastic two-body collision is highly conservative.
The actual transient contact scenario is, in most cases, an intermediate
condition between a fully elastic and a fully inelastic collision. Thus, the
value of $v_{max}$ computed through the model in (5) would end up being in
most cases inaccurate and/or conservative.

  3. 3.

Even if the ISO/TS 15066 limits the energy exchange, there is no formal
analysis related to the stability of the system while in contact with the
human, as well as while switching from interaction to free motion and vice-
versa. Thus, instabilities might arise during the contact, threatening the
safety of the human.

Points 1) and 2) in the previous list highlight that using the velocity limit
(5) can be severely conservative. In the remainder of this section we discuss
how, by applying the robot mass evaluation proposed by the ISO/TS 15066
through (4), we obtain in most cases a conservative value.

Let us consider a torque-controlled fully actuated $n-$DOF manipulator
represented by the following Euler-Lagrange dynamic model:

$\textbf{M}(\textbf{q})\ddot{\textbf{q}}(t)+\textbf{C}(\textbf{q},\dot{\textbf{q}})\dot{\textbf{q}}(t)+\textbf{g}(\textbf{q})=\bm{\tau}(t)+\textbf{J(q)}^{T}\mathbf{F}_{e}(t),$
(6)

where $\textbf{q}(t)\in\mathbb{R}^{n}$ is the vector of joint variables,
$\textbf{M}(\textbf{q})\in\mathbb{R}^{n\times n}$ is the positive definite and
symmetric inertia matrix,
$\textbf{C}(\textbf{q},\dot{\textbf{q}})\in\mathbb{R}^{n\times n}$ encompasses
Coriolis and centrifugal effects and $\textbf{g}(\textbf{q})\in\mathbb{R}^{n}$
is the gravitational term. The vector $\bm{\tau}(t)\in\mathbb{R}^{n}$
represents the controlled joint torques and the term
$\textbf{J(q)}^{T}\mathbf{F}_{e}(t)\in\mathbb{R}^{n}$ represents the torque
applied to the joints because of the external wrench
$\mathbf{F}_{e}(t)\in\mathbb{R}^{m}$ applied on the end-effector. Let us
assume that the robot is carrying a negligible load, i.e. $m_{L}\approx 0$ in
(4). Thus, according to the ISO/TS 15066, the effective mass of the robot can
be computed as $m_{r}=\frac{M}{2}$. The effective mass value $m_{r}$ is then
used in (2), through $\mu$, to evaluate the velocity $v_{rel}$. However, the
value of the contact force $f$ along a given direction, indicated by the unit
vector $\textbf{n}\in\mathbb{R}^{3}$, depends upon the apparent mass
$m_{app}\in\mathbb{R}$ of the robot at the contact point Khatib (1995);
Haddadin et al. (2010), namely

$m_{app}=\left(\textbf{n}^{T}\bm{\Lambda}(\textbf{q})^{-1}\textbf{n}\right)^{-1},$
(7)

in which $\bm{\Lambda}(\textbf{q})^{-1}\in\mathbb{R}^{3\times 3}$ is the end-
point mobility tensor Hogan (1984). For a manipulator, this measure provides a
description of the inertial properties at a given configuration and can be
computed, considering a pure translational motion, as

$\bm{\Lambda}(\textbf{q})^{-1}=\textbf{J}_{v}(\textbf{q})\textbf{M}(\textbf{q})^{-1}\textbf{J}_{v}(\textbf{q})^{T},$
(8)

where $\textbf{J}_{v}(\textbf{q})\in\mathbb{R}^{3\times n}$ is the Jacobian
associated with the linear velocity at the operational point.

Since the robot mass in (4) is computed without information regarding the
configuration of the robot and the direction of contact, the estimated value
could be significantly larger than $m_{app}$, as thoroughly showcased in
Haddadin et al. (2009). This, in turn, leads to smaller values of $v_{max}$
according to (5), producing an over-conservative velocity limit for the robot.
A thorough comparison in this regard is presented in Kirschner et al. (2021).

A possible solution would be to directly use the apparent mass in (4), instead
of $m_{r}$. However, the computation of $m_{app}$ requires the precise
knowledge of the dynamic model of the robot, specifically of the inertia
matrix $\textbf{M}(\textbf{q})$, which is not always available or known with
sufficient accuracy.

Therefore, in this paper we propose a control architecture which exploits
directly the energetic constraint in (1) for satisfying the safety
requirements of PFL in the ISO/TS 15066, via an energy tank-based formulation.
In this way, we can avoid the conservative assumptions underlying the
derivation of the velocity limit in (5), thus overcoming the drawbacks
presented in points 1) and 2). Moreover, we provide a model-agnostic
passivity-based framework in order to guarantee a robustly stable behavior of
the overall system both in free motion and in contact with the human, thus
addressing the issue described in point 3).

##  4 Optimized Tank-based Control Architecture for Ensuring Variable Bounds
on the Kinetic Energy

Consider a robot that needs to execute a task in a collaborative cell. Let
$0<H_{1}\leq H_{2}\leq\cdots\leq H_{N}$ be the bounds on the energy transfer
imposed by PFL in (1) for guaranteeing safety during contact with each of the
$N$ human body parts. Since the closest body part can change online, the bound
to guarantee is time-varying.

Since the nature of the problem is energetic, we provide an energy-based
solution exploiting the modulated energy tank Benzi et al. (2022); Benzi and
Secchi (2021). In this section, we first provide a short background on
modulated energy tanks. Then, we describe the control architecture to ensure a
single bound on the kinetic energy, both in free motion and in contact phase.
Finally, we extend it for switching among the different bounds imposed by PFL.

###  4.1 Background on Modulated Energy Tanks

The energy tank is an energy storing element, traditionally employed for
storing the energy dissipated by the controlled system. It can be generally
represented as

$\begin{cases}\dot{x}_{t}(t)=u_{t}(t)\\\ y_{t}(t)=\frac{\partial
T(t)}{\partial x_{t}(t)}=x_{t}(t),\end{cases}$ (9)

where $x_{t}(t)\in\mathbb{R}$ is the tank state,
$(u_{t}(t),y_{t}(t))\in\mathbb{R}\times\mathbb{R}$ is the power port of the
tank, with associated energy function

$T(x_{t}(t))=\frac{1}{2}x_{t}^{2}(t).$ (10)

The tank stores/releases energy by means of the port $(u_{t}(t),y_{t}(t))$. In
particular, this can be exploited for reproducing any desired port-behavior
(Benzi et al. (2022)):

$\begin{cases}u_{t}(t)=\textbf{a}(t)^{T}\textbf{u}(t)\\\
\textbf{y}(t)=\textbf{a}(t)y_{t}(t),\end{cases}$ (11)

where $(\textbf{u}(t),\textbf{y}(t))\in\mathbb{R}^{n}\times\mathbb{R}^{n}$ is
the I-O port of the system and $\textbf{a}(t)\in\mathbb{R}^{n}$ is a
modulating term, defined as

$\textbf{a}(t)=\frac{\bm{\gamma}(t)}{x_{t}(t)},$ (12)

with $\bm{\gamma}(t)\in\mathbb{R}^{n}$ being the desired value for the output
$\textbf{y}(t)$. By embedding (11) in (9) we obtain

$\begin{cases}\dot{x}_{t}(t)=\textbf{a}(t)^{T}\textbf{u}(t)\\\
\textbf{y}(t)=\textbf{a}(t)y_{t}(t)=\bm{\gamma}(t),\end{cases}$ (13)

which shows how the modulating term $\textbf{a}(t)$ allows to control the
energy flowing in the interconnected system to obtain any desired value for
the port output $\textbf{y}(t)$. A lower bound $\varepsilon>0$ such that
$T(x_{t}(t))\geq\varepsilon\quad\forall t\geq 0$ must be enforced, in order to
avoid numeric singularities in (12). Additionally, an upper tank energy bound
has to be set, or practically unstable behaviors could be implemented.

The tank (13) has been proven to implement a passive exchange of energy as
long as the tank is not empty (Benzi et al. (2022)), thus the following
proposition holds.

######  Proposition 1 (Benzi et al. (2022), Prop. 1)

If
$T(x_{t}(t))\geq\varepsilon$ $\forall t\geq 0$, then the modulated tank (13)
is passive independently of the desired value of $\bm{\gamma}(t)$.

Thus, as long as some energy is present in the tank, any desired port behavior
can be passively implemented.

###  4.2 Tank-based Control Architecture for Energy Limitation

Consider the model of the robot (6) in operational space:

$\bm{\Lambda}(\textbf{x})\ddot{\textbf{x}}(t)+\textbf{S}(\textbf{x},\dot{\textbf{x}})\dot{\textbf{x}}(t)=\textbf{F}(t),$
(14)

where $\bm{\Lambda}(\textbf{x})\in\mathbb{R}^{m\times m}$ and
$\textbf{S}(\textbf{x},\dot{\textbf{x}})\in\mathbb{R}^{m\times m}$ are,
respectively, the inertia matrix and the centrifugal and Coriolis matrix in
the operational space, with $\textbf{x}(t)\in\mathbb{R}^{m}$ being the
Cartesian pose (position and orientation) of the end-effector and
$\textbf{F}(t)\in\mathbb{R}^{m}$ the operational force vector. We decompose
the latter into two terms,

$\mathbf{F}(t)=-\mathbf{F}_{c}(t)+\mathbf{F}_{e}(t),$ (15)

with $\textbf{F}_{c}(t)\in\mathbb{R}^{m}$ being the control forces due to the
actuation and $\mathbf{F}_{e}(t)\in\mathbb{R}^{m}$ being the external wrench,
due to the interaction with the environment or the human. We can then compute
the kinetic energy of (14) as

$H(t)=\frac{1}{2}\dot{\textbf{x}}(t)^{T}\bm{\Lambda}(\textbf{x})\dot{\textbf{x}}(t)\geq
0$ (16)

It is well known that (14) is passive with respect to the pair
$(\textbf{F}(t),\dot{\textbf{x}}(t))$, since
$\textbf{F}(t)^{T}\dot{\textbf{x}}(t)=\dot{H}(t)$ (see, e.g., Secchi et al.
(2007)). Our initial goal is to limit $H(t)$ to a fixed value
$\bar{H}\in\mathbb{R}$ during free motion (i.e.,
$\mathbf{F}_{e}(t)=\mathbf{0}$). Formally, we aim at bounding
$H(t)\leq\bar{H}$ with $\bar{H}\geq H(0)$. This can be accomplished by
interconnecting (14) with the modulated energy tank (13) as shown in Fig. 1.
Here, the input and the output of the modulated tank are the Cartesian
velocity $\dot{\bm{x}}(t)\in\mathbb{R}^{m}$ and the control forces
$\mathbf{F}_{c}(t)\in\mathbb{R}^{m}$, respectively, while the goal is to
implement the desired control action $\mathbf{F}_{des}(t)\in\mathbb{R}^{m}$.
The control input is then provided to an optimization block, which computes
the best passive approximation $\mathbf{F}_{opt}(t)\in\mathbb{R}^{m}$ of the
control action $\mathbf{F}_{des}(t)$ considering the energy available in the
tank and the desired behavior. The output $\mathbf{F}_{opt}(t)$ is then used
for modulating the energy flowing into/out of the energy tank according to
(13) by setting $\bm{\gamma}(t)=\mathbf{F}_{opt}(t)$.

Figure 1: Modulated energy tank control architecture. The optimizer provides
the closest passive approximation $\mathbf{F}_{opt}$, which is then used to
properly modulate, via the term $\textbf{a}(t)$, the power flow at the ports
of the tank.

Since (14) is passive and the negative feedback interconnection is power
preserving, the passivity of (13) would guarantee the passivity of the overall
controlled system and, consequently, a stable behavior both during free motion
and interaction Secchi et al. (2007). According to Prop. 1, passivity of (13)
is guaranteed if $T(x_{t}(t))\geq\varepsilon$. Thus, given the desired input
$\mathbf{F}_{des}(t)$, it is possible to find $\mathbf{F}_{opt}(t)$ by solving
the following optimization problem:

$\displaystyle\underset{\mathbf{F}_{c}(t)}{\text{minimize}}$
$\displaystyle||\mathbf{F}_{c}(t)-\mathbf{F}_{des}(t)||^{2}$ (17) subject to
$\displaystyle T(x_{t}(t))\geq\varepsilon.$

The optimization problem (17) can be rewritten for a discrete time
implementation, $\tau>0$ being the cycle time, as shown in Benzi et al.
(2022), to obtain a convex optimization problem, suitable for real-time
implementations:

$\displaystyle\underset{\mathbf{F}_{c}(k)}{\text{minimize}}$
$\displaystyle||\mathbf{F}_{c}(k)-\mathbf{F}_{des}(k)||^{2}$ (18) subject to
$\displaystyle\tau{\underbrace{\vphantom{\sum_{i=0}^{k-1}\tau\textbf{F}_{c}(i)^{T}\dot{\textbf{x}}(i)}\textbf{F}_{c}(k)^{T}\dot{\textbf{x}}(k)}_{\dot{T}(k)}}+{\underbrace{\sum_{i=0}^{k-1}\tau\textbf{F}_{c}(i)^{T}\dot{\textbf{x}}(i)}_{T(k-1)}}\geq\varepsilon.$

Notice how, deploying this architecture, we only allow a set amount of energy
to the robot for implementing the task in free motion, i.e. its kinetic energy
will at most be equal to $H(t)=H(0)+T(0)-\varepsilon$. Thus, by a proper
choice of $T(0)$, we can guarantee a fixed bound $\bar{H}$ on $H(t)$:

###### Proposition 2

Consider the robot (14) interconnected with the tank (13) as in Fig. 1. If
$T(0)=\bar{H}-H(0)+\varepsilon$ and $T(t)\geq\varepsilon$ $\forall t\geq 0$,
then $H(t)\leq\bar{H}\,\,\forall t\geq 0$ in free motion
($\mathbf{F}_{e}(t)=\mathbf{0}$).

Since

$\left\\{\begin{array}[l]{ll}\mathbf{u}(t)=\mathbf{\dot{x}}(t)\\\
\mathbf{y}(t)=\mathbf{F}_{c}(t)=-\mathbf{F}(t)\end{array}\right.$ (19)

and

$\mathbf{F}(t)^{T}\mathbf{\dot{x}}(t)=-\mathbf{u}(t)^{T}\mathbf{y}(t),$ (20)

we have that

$\dot{H}(t)+\dot{T}(t)=0,$ (21)

whence

$H(t)=H(0)+T(0)-T(t)\leq H(0)+T(0)-\varepsilon,$ (22)

in which the inequality comes from the assumption that $T(t)\geq\varepsilon$
$\forall t\geq 0$. Then, by setting $T(0)=\bar{H}-H(0)+\varepsilon$, we get
$H(t)\leq\bar{H}$, thus concluding the proof.

The condition on the lower bound can be enforced by synthesizing the control
input $\mathbf{F}_{c}(t)$ via the optimization problem (18). We can thus
compute the best approximation of $\mathbf{F}_{des}(t)$ complying with the
energetic limitation.

The approximated input $\mathbf{F}_{c}$ in (18), however, does not necessarily
preserve the direction of the desired behavior $\mathbf{F}_{des}$. As, in this
work, we focus on safely accomplishing industrial tasks, in which maintaining
a given direction can be critical, we further modify the formulation as:

$\displaystyle\underset{\alpha(k)}{\text{minimize}}$
$\displaystyle||\alpha\mathbf{F}_{des}(k)-\mathbf{F}_{des}(k)||^{2}$ (23)
subject to
$\displaystyle\tau\alpha\textbf{F}_{des}(k)^{T}\dot{\textbf{x}}(k)+T(k-1)\geq\varepsilon.$

Thus, by setting $\mathbf{F}_{c}=\alpha\mathbf{F}_{des}$, we obtain the safe
version of $\mathbf{F}_{des}$ preserving the intended direction. As $\alpha=0$
is always admissible, the problem always possesses a solution.

###  4.3 Control Architecture for Switching Between Variable Energy Levels and
Contact with the External Environment

The control architecture presented in Sec. 4.2 allows to bound the kinetic
energy in free motion to a set value. On the other hand, when in contact with
the external environment, the power injected through the port
$(\mathbf{F}_{e}(t),\dot{\textbf{x}}(t))$, i.e. directly on the robot, can
lead to uncontrolled variations of the kinetic energy. Indeed, according to
Prop. 2, the maximum allowable amount of energy for the robot is already
stored in the closed loop system, since $T(0)-\varepsilon+H(0)=\bar{H}$. Thus,
any uncontrolled additional energy injection on the robot (e.g., pushing the
robot along its direction of motion) from external sources could violate the
energy bound condition. On the contrary, uncontrolled external energy
extractions (e.g., deceleration due to collisions) can degrade the overall
performance, since the tank would not account for the energy loss. We can
address this issue by properly re-routing the external energy in the tank,
further augmenting the dynamics as follows:

${\left\\{\begin{array}[l]{l}\dot{x}_{t}(t)=\frac{1}{x_{t}(t)}\left[-\mathbf{F}_{e}(t)^{T}\dot{\textbf{x}}(t)+b(t)\dot{\textbf{x}}(t)^{T}\dot{\textbf{x}}(t)\right]+\mathbf{a}(t)^{T}\mathbf{u}(t)\\\
\mathbf{F}_{c}(t)=\mathbf{a}(t)y_{t}(t),\end{array}\right.}$ (24)

in which $b$ is a variable damper that we activate only for dissipating the
external energy injection whenever this would violate the energetic bound, as
shown in Fig. 2, i.e.,

Figure 2: Modulated energy tank architecture with external energy flows. By
means of energy re-routing, external power injections/extractions are properly
handled, without affecting the bounding process.

$b(t)=\left\\{\begin{array}[l]{ll}\frac{\mathbf{F}_{e}(t)^{T}\dot{\textbf{x}}(t)}{\dot{\textbf{x}}(t)^{T}\dot{\textbf{x}}(t)}&\mbox{if
}\mathbf{F}_{e}(t)^{T}\dot{\textbf{x}}(t)>0\text{ and }T(t)=\varepsilon\\\
0&\mbox{else.}\end{array}\right.$ (25)

This is an emergency term which dissipates the external injection only when
$H(t)=\bar{H}$, and is thus rarely activated. The additional terms in (24)
allow the tank to track the external energy flowing in/out of the robot. In
case of injection, i.e., $\mathbf{F}_{e}(t)^{T}\dot{\mathbf{x}}>0$, the
corresponding amount of power is extracted from the tank. Conversely, any
external extraction, i.e. $\mathbf{F}_{e}(t)^{T}\dot{\mathbf{x}}<0$, is
injected back into the tank.

###### Proposition 3

Consider the robot (14) interconnected with the tank (13). If
$T(0)=\bar{H}-H(0)+\varepsilon$ and $T(t)\geq\varepsilon\,\,\forall t\geq 0$,
then $H(t)\leq\bar{H}\,\,\forall t\geq 0$, both in free motion and in contact
with the external environment.

Using (24) and (25), the following balance holds:

$\begin{array}[]{ll}\dot{H}(t)+\dot{T}(t)&=\\\
&=\mathbf{F}(t)^{T}\dot{\textbf{x}}(t)-b(t)\dot{\textbf{x}}(t)^{T}\dot{\textbf{x}}(t)\\\
&-\left(\mathbf{F}_{e}(t)+\mathbf{F}_{c}(t)\right)^{T}\dot{\textbf{x}}(t)+b(t)\dot{\textbf{x}}(t)^{T}\dot{\textbf{x}}(t)=\\\
&=0,\end{array}$ (26)

Thus, by integrating, we get the following energy balance

$H(t)\leq H(0)+T(0)-T(t)\leq H(0)+T(0)-\varepsilon,$ (27)

where the inequality comes, again, from the fact that $T(t)\geq\varepsilon$
$\forall t\geq 0$. Therefore, setting $T(0)=\bar{H}-H(0)+\varepsilon$ we get
from (27) that $H(t)\leq\bar{H}$, thus concluding the proof. Thus, the kinetic
energy bound can be ensured and external injections/extraction of energy are
accounted for via the interconnection in (24). Since none of the terms in (24)
depends upon the control input, these can simply be added into the
optimization problem (23), preserving the convexity of the problem. In
particular, we can utilize the architecture to comply directly with the
energetic bounds imposed by PFL (1), by setting $\bar{H}=E_{max}$.

Nonetheless, the bounds introduced by PFL can often change during the robot
motion, as the value of $E_{max}$ in (1) depends on the currently closest body
region to the robot. Let us consider the previously introduced energy levels
$0<H_{1}\leq H_{2}\leq\cdots\leq H_{N}$. Each energy bound $H_{i}$ can be
ensured at different times by modifying online (23)

$\displaystyle\underset{\alpha(k)}{\text{minimize}}$
$\displaystyle||\alpha\mathbf{F}_{des}(k)-\mathbf{F}_{des}(k)||^{2}$ (28)
subject to
$\displaystyle\tau\alpha\textbf{F}_{des}(k)^{T}\dot{\textbf{x}}(k)+\tau
P_{ext}+T(k-1)\geq\varepsilon(k),$

where the term
$P_{ext}=\mathbf{F}_{e}(t)^{T}\dot{\textbf{x}}(t)+b(t)\dot{\textbf{x}}(t)^{T}\dot{\textbf{x}}(t)$
encompasses the power flows due to the environmental interaction, and in which
we vary online the lower bound $\varepsilon(k)>0$ in order to change how much
energy is made available to the robot. Let $k_{i}$ be the discrete time
instant at which the closest body part to the robot changes. Correspondingly,
the bound on the kinetic energy of the robot switches to $H_{i}$. In order to
address this switch, $\varepsilon(k_{i})$ is changed s.t.
$\varepsilon(k_{i})=T(0)-H_{i}+H(0)$. In this way, the result of Prop. 3 keeps
on holding despite the varying energy bound, thus guaranteeing stability also
during the switching.

In this way, we have build an energy-based control architecture capable of
limiting the kinetic energy of the robot to different arbitrary bounds, both
in free motion and in interaction phase. Moreover, this can be performed
without knowledge of the dynamic parameters (i.e., the inertial and Coriolis
terms) of the robot in (6).

##  5 Simulations

Simulations have been performed in order to validate the control architecture,
using a KUKA LWR 4+ 7-DOF force-controlled manipulator in MATLAB, modeled as
in (6), whose dynamic behavior is computed using the Robotics Toolbox Corke
(1996) with a sampling time of 1$ms$. The robot is set to accomplish a simple
motion task between two poses. The desired input $F_{des}$ is generated via a
standard PD controller, for the sake of generality.

First, following the procedure in Sec. 2, we compute $v_{max}$ according to
the TS. During the first part of the motion, the closest human body part is
the chest. From the tables in ISO TS 15066:2016 (2016), we retrieve the
maximum force for this part ($140N$), together with its stiffness ($25N/mm$),
mass ($40kg$), and maximum energy ($E_{max1}=1.6J$), under the assumption that
the robot is carrying no payload. Using (5), the maximum velocity for the
first motion according to the TS would be $v_{max1}=0.29m/s$.

In order to directly comply with the energetic bound of the TS instead, we
leverage our architecture in Sec. 4 and approximate the control input
$F_{des}$ by means of the optimization problem in (28). Since the robot is in
free motion, $P_{ext}=0W$ in this case. We initially set the tank lower bound
to a conservative value of $\varepsilon_{1}=3.4J$. Then, as previously
described, we initialize the tank as $T(0)=\varepsilon_{1}+E_{max1}=5.0J$. In
this way, assuming $H(0)=0J$ (the robot is initially stopped), we can limit
the kinetic energy of the robot s.t. $H(t)\leq E_{max1}$. The scaled input
$F_{c}=\alpha F_{des}$ is then applied to the robot.

During the second part of the motion, the threatened body part changes to the
shoulders of the operator. Performing the previous procedure according to the
TS for this body part, we obtain the new values for the maximum velocity
$v_{max2}=0.37m/s$ and transferred energy $E_{max2}=2.5J$. This switch can be
managed in the architecture by simply changing the lower bound of the tank to
$\varepsilon_{2}=T(0)-E_{max2}=2.5J$, thus allowing additional task energy.

Figure 3: Evolution of the kinetic energy of the robot during task execution.
Figure 4: Evolution of the energy in the tank during task execution.  Figure
5: Velocity along the direction of motion during task execution.

The results are showcased in Fig. 3, Fig. 4 and Fig. 5: during the first part
of the motion, the robot follows the desired velocity profile as long as its
kinetic energy remains below the safety bound $E_{max1}$, i.e., as long as the
energy in the tank remains above $\varepsilon_{1}$. Whenever the bound is
reached, the input is approximated via (28), trading off performance in order
to guarantee safety. From Fig. 5 in particular, two important conclusions can
be drawn. Firstly, that the bound on the robot velocity is generally
conservative, as during both parts of the motion task we manage to move at an
higher speed value than the one imposed by $v_{max1}$ and $v_{max2}$, while
still complying with the energetic requirement of PFL. Secondly, that a
velocity limit is not enough to guarantee the safety of the operator. Notice
how, during the second part of the motion, the robot slows down after $7.5sec$
to a value lower than $v_{max2}$. This is because, due to postural conditions
and to its self-motions, the kinetic energy of the robot is already at the
maximum allowed value $E_{max2}$. Since our architecture is energy-based, we
can easily take these factors into account during the input computations. It
is easy to see that, in this case, the direct application of the velocity
bound would instead lead to an unsafe behavior, i.e., the energetic bound
$E_{max2}$ would not be respected.

##  6 Conclusions and Future Works

In this paper we developed a model-agnostic energy tank-based control
architecture capable of complying directly with the time-varying energetic
bounds of ISO TS 15066. The architecture is general purpose, and can be
directly employed as a safety layer for any force/torque controlled robot.
Future works aim at experimentally validating the architecture in a real
collaborative scenario, providing a formal proof of stability and safety
during bound-switching phases, and leveraging kinematic redundancy for
reducing the apparent mass of the robot during the motion.

## References

  * Benzi et al. (2022) Benzi, F., Ferraguti, F., Riggio, G., and Secchi, C. (2022).  An energy-based control architecture for shared autonomy.  _IEEE Transactions on Robotics_ , 1–19.  10.1109/TRO.2022.3180885.
  * Benzi and Secchi (2021) Benzi, F. and Secchi, C. (2021).  An optimization approach for a robust and flexible control in collaborative applications.  In _IEEE International Conference on Robotics and Automation_ , 3575–3581.
  * Corke (1996) Corke, P.I. (1996).  A robotics toolbox for matlab.  _IEEE Robotics & Automation Magazine_, 3(1), 24–32.
  * Ferraguti et al. (2020) Ferraguti, F., Bertuletti, M., Landi, C.T., Bonfè, M., Fantuzzi, C., and Secchi, C. (2020).  A control barrier function approach for maximizing performance while fulfilling to iso/ts 15066 regulations.  _IEEE Robotics and Automation Letters_ , 5(4), 5921–5928.
  * Ferraguti et al. (2022) Ferraguti, F., Landi, C.T., Singletary, A., Lin, H.C., Ames, A., Secchi, C., and Bonfè, M. (2022).  Safety and efficiency in robotics: The control barrier functions approach.  _IEEE Robotics and Automation Magazine_ , 29(3), 139–151.  10.1109/MRA.2022.3174699.
  * Haddadin et al. (2009) Haddadin, S., Albu-Schäffer, A., and Hirzinger, G. (2009).  Requirements for safe robots: Measurements, analysis and new insights.  _The International Journal of Robotics Research_ , 28(11-12), 1507–1527.
  * Haddadin et al. (2010) Haddadin, S., Albu-Schäffer, A., and Hirzinger, G. (2010).  Safe physical human-robot interaction: measurements, analysis and new insights.  In _Robotics research_ , 395–407. Springer.
  * Hogan (1984) Hogan, N. (1984).  Impedance control of industrial robots.  _Robotics and Computer-Integrated Manufacturing_ , 1(1), 97–113.
  * ISO 10218-1-2011 (2011) ISO 10218-1-2011 (2011).  Robots and robotic devices – Safety requirements for industrial robots. Part 1: Robots.  URL http://www.iso.org.
  * ISO 10218-2-2011 (2011) ISO 10218-2-2011 (2011).  Robots and robotic devices – Safety requirements for industrial robots. Part 2: Robot systems and integration.  URL http://www.iso.org.
  * ISO TS 15066:2016 (2016) ISO TS 15066:2016 (2016).  Robots and robotic devices – Collaborative robots.  URL http://www.iso.org.
  * Khatib (1995) Khatib, O. (1995).  Inertial properties in robotic manipulation: An object-level framework.  _The international journal of robotics research_ , 14(1), 19–36.
  * Kirschner et al. (2021) Kirschner, R.J., Mansfeld, N., Peña, G.G., Abdolshah, S., and Haddadin, S. (2021).  Notion on the correct use of the robot effective mass in the safety context and comments on iso/ts 15066.  In _2021 IEEE International Conference on Intelligence and Safety for Robotics (ISR)_ , 6–9. IEEE.
  * Lachner et al. (2021) Lachner, J., Allmendinger, F., Hobert, E., Hogan, N., and Stramigioli, S. (2021).  Energy budgets for coordinate invariant robot control in physical human–robot interaction.  _The International Journal of Robotics Research_ , 02783649211011639\.
  * Pupa et al. (2021) Pupa, A., Arrfou, M., Andreoni, G., and Secchi, C. (2021).  A safety-aware kinodynamic architecture for human-robot collaboration.  _IEEE Robotics and Automation Letters_ , 6(3), 4465–4471.  10.1109/LRA.2021.3068634.
  * Secchi et al. (2007) Secchi, C., Stramigioli, S., and Fantuzzi, C. (2007).  _Control of interactive robotic interfaces: A port-Hamiltonian approach_ , volume 29.  Springer.