Soft wearable flexible bioelectronics integrated with an ankle-foot exoskeleton for estimation of metabolic costs and physical effort

Activities and physical effort have been commonly estimated using a metabolic rate through indirect calorimetry to capture breath information. The physical effort represents the work hardness used to optimize wearable robotic systems. Thus, personalization and rapid optimization of the effort are critical. Although respirometry is the gold standard for estimating metabolic costs, this method requires a heavy, bulky, and rigid system, limiting the system’s field deployability. Here, this paper reports a soft, flexible bioelectronic system that integrates a wearable ankle-foot exoskeleton, used to estimate metabolic costs and physical effort, demonstrating the potential for real-time wearable robot adjustments based on biofeedback. Data from a set of activities, including walking, running, and squatting with the biopatch and exoskeleton, determines the relationship between metabolic costs and heart rate variability root mean square of successive differences (HRV-RMSSD) (R = −0.758). Collectively, the exoskeleton-integrated wearable system shows potential to develop a field-deployable exoskeleton platform that can measure wireless real-time physiological signals.


INTRODUCTION
The US Bureau of Labor Statistics (USBLS) in 2011 reported more than 310,000 cases of musculoskeletal disorders (MSD) in the work environment, despite the decrease in the number, incidence rate, and median days away from work of injuries and illnesses involving MSDs over the years since 2011, it only marks a decrease of 1.5% per year with more than 277,000 musculoskeletal disorders reported on the work environment in 2018. USBLS highlights laborers and freight, stock, and material movers are the most vulnerable class to have musculoskeletal injuries where overexertion from repetitive action involving squatting and lifting creates fatigue in workers causing MSDs 1 . Recent developments of wearable robots show great potential 2,3 in assisting industry workers, and many wearable robots target walking, squatting 4 , and running 5-7 by reducing required physical efforts 8 to reduce industrial risks and support post-injury rehabilitation 9,10 . Because user interaction with a wearable robot is always diverse in actual use, it ultimately requires an efficient biofeedback system to adjust the wearable robot for each user's need, called personalized assistance. However, earlier developments show limitations in this personalization using human-in-the-loop (HIL) optimization. The HIL optimization identifies a personalized wearable robot parameter by directly incorporating the user's physiological signals to construct more accurate and efficient human interaction models [11][12][13][14] . The method includes the estimation of metabolic cost with indirect calorimetry and a respiratory mask that collects oxygen intake and carbon dioxide outtake.
With all the efforts to estimate metabolic cost through mask indirect calorimetry, studies that use commercially available devices 15 require the rigid mask to be well-fitted for accurate measurement in addition to an antenna communication system on the user's back. These bulky systems directly counter the purpose of the development of wearable robots supporting workers' repetitive motion where they take a long setup and estimation time, are confined to lab settings, and are cumbersome to wear with a large form factor and heavyweight. In addition, mask-based indirect calorimetry is slow to determine a physiological response 16,17 , while taking a long time (>3 min) than electrocardiogram (ECG) processing 18 . It makes the wearable robot challenging to compute user response rapidly in a potential field-deployable system. A different approach has been made to optimize human parameters by estimating cognitive effort with HRV-RMSSD driven by ECG. An attempt to measure work intensity with an HR strap is reported 19 . However, commercial HR detection devices are intrinsically uncomfortable to wear and prevent the user's natural motion range introducing more motion artifacts due to their rigid form and lack of conformal contact with the skin 20 . Further, the inherent manufacturing complexity of epidermal electronics, specifically electrode fabrication 21,22 , has been a critical factor in preventing mass manufacture. Thus, an easily customizable low-cost electrode fabrication has been introduced utilizing a high-resolution micromachining tool. This paper presents a portable soft flexible biopatch with anklefoot-orthosis (AFO) as an alternative to the needs of metabolic cost estimation, discovering the relationship between metabolic rate from indirect respiratory calorimetry and HRV-RMSSD from the biopatch measuring high-quality HR, ECG, and motion. This system replaces the indirect calorimetry with a low profile, small form factor, and lightweight soft flexible biopatch (SFB), providing better comfort and movement advantages. The feasibility of SFB is validated by comparing it with commercial mask indirect calorimetry while wearing AFO during a set of squatting, running, and walking experiments. The ECG quality is validated with a signal-to-noise ratio (SNR) and HR comparison with a commercial HR chest strap. Further, the physical durability and stability of SFB are computationally calculated and experimentally proved. A manufacturing method to manufacture flexible and stretchable electrodes via a femtosecond laser processor is described with dimensional details. The fabrication process shows its superiority of manufacturability and ease of prototyping in contrast to conventional cleanroom processed flexible devices.

RESULTS AND DISCUSSION
Overview of an integrated wearable system for estimation of metabolic costs and physical effort To monitor the ECG and determine HRV-RMSSD during squatting and compare with metabolic cost, this study configures an SFB and a wearable AFO. Figure 1a introduces the overall configuration of the integrated wearable system, where the SFB is attached to the subject's sternum to reduce any chest muscle motion artifact that can cause misinterpretation of bio-signals during squatting. The location of SFB in the sternum provides a larger motion range with less motion artifacts and greater compatibility with other potential electronics that measure other bio-signals along with AFO. The flexibility of SFB is illustrated in Fig. 1b, where the electrode has conformal contact with the sternum skin surface. Figure 1c displays a schematic illustration of multilayered circuit architecture including 1) soldered flexible printed circuit board (fPCB) and power supply, 2) battery assembly with magnetic charging port and switch, and 3) micro-manufactured laser patterned gold bipolar and a reference electrode on a flexible and stretchable substrate (9907T, 3M). Figure 1d illustrates the wireless transmission of ECG, angular velocity, and 3-axis acceleration data through a Bluetooth-low-energy-enabled circuit to the android phone during squatting (left) and a brief flow chart for analyzing the quantitative data. The live squatting demonstration of wireless data transmission from the biosensor can be found in Supplementary Video 1. This video shows good connectivity and reduced motion artifacts during each action. In this study, four male and two female subjects (aged between 20 to 30 years) use the AFO exoskeleton and participate in squatting and walkingrunning. ECG, HR, and metabolic costs are measured and analyzed during each session. HRV-RMSSD is calculated from filtered HR, and the metabolic cost is driven by indirect respiratory calorimetry. The normalized metabolic cost and normalized HRV-RMSSD results in a Pearson R correlation of −0.758 with a p-value of 1.2e−7 (Fig. 1e), a strong negative correlation between calorimetry and HRV.
Design and characterization of an SFB Electrode fabrication methods in this study utilize high precision micro-laser machine (Femtosecond Laser Micro-Machining System, OPTEC), which enables time-efficient electrode manufacturing of large batches with minimized cleanroom use and rapid prototyping without photolithography. To fabricate electrodes, polydimethylsiloxane (PDMS) is spun-coated in glass slides, followed by chromium and gold deposition of 10 nm and 200 nm, respectively. The gold-deposited slide is then patterned with a micro-machining system. Figure 2 shows the dimensional details and physical characteristics of electrodes and interconnectors. The bipolar electrode system for SFB is made of three identical electrodes having patterns with 8.5 cm long and 7.5 cm center-to-center distance from positive to negative to provide good ECG signal quality. Supplementary Fig. 1 describes the circuit board assembly (top) and electrode fabrication (bottom) details. Each electrode pattern is guided to an appropriate location via serpentine interconnects for easier construction of the SFB. The electrode pattern width of 150 µm (Fig. 2a) and the total thickness of 8 µm (Fig. 2b) from the profilometer (VK-X3000 3D Profilometer, Keyence) provide enough flexibility and stretchability to maintain conformal contact with the skin. The details of profilometric data are represented in Supplementary Fig. 2 with a top-down optical photo of a single laser-patterned electrode (left) and a profilometric illustration of the electrode with color-matching height variance (right). The stretchability of electrodes and interconnects are computationally calculated in finite element analysis (FEA; Abaqus, Dassault Systèmes) with 30% uniaxial elongation to estimate its durability under skin stretch during squatting (Fig. 2c,  d). Both electrode and interconnect FEA result under 4% maximum von Mises stress with 30% uniaxial elongation, sufficient stress for gold-deposited layers to endure. For experimental validation, electrodes and interconnects are mounted on a soft substrate (9907T, 3M) and are loaded on cyclic uniaxial stretching. The resistance between the two furthest points is measured where settings are shown in Fig. 2e, f for an electrode and interconnector, respectively. Figure 2g reports details of resistance change per load cycle. Despite a slight shift of resistance over time, the resistance change within a single cycle is less than 0.05 Ω which is less than 0.1% of change. The electrode test shows little to no difference with an increase in the strain, which portrays the durability of SFB against skin elongation during squatting. The resistance change against uniaxial cyclic loading is minimal less than 2 Ω. Similarly, the interconnector (Fig. 2h) shows little to no change with an increase in the strain, which portrays the durability of SFB against skin elongation during squatting. Zoomed-in optical image is taken before cyclic loading and after to confirm little to no delamination via microscope, shown in Supplementary  Fig. 3. An epidermal electronics should withhold 30% of strain due to the nature of skin elongation limitation 23 . Supplementary Fig. 4 presents an SFB's stress-strain curve until the fracture point; the SFB shows an electric response up to 50% elongation before turning into a plastic response and finally fracturing at 123% of extension. The slope of this stress-strain curve reports Young's modulus of 500 kPa showing SFB's capability of maintaining conformal contact on the subject's chest under skin elongation. Patterned electrodes are transferred to a stretchable substrate with water-soluble tape to fabricate the device. The mainboard is stacked on top of the power board and connected with copper wires for corresponding power line pads. The battery assembly is put aside from the fPCB stack but placed in a position where the high-frequency antenna is not affected by the conductance of the battery system. The powered board system is then put on a biocompatible soft stretchable layer (Ecoflex TM Gel, Smooth-On) to reduce stress on skin attachment, followed by placement on top of the substrate. The analog inputs are connected to the corresponding electrode pattern with asymmetric conductive films (ACFs) using fast-drying silver paint (Leitsilber Conductive Silver, Ted Pella). The silver paint with ACFs is cured at 60°C for 1 h to secure the electric connection fully. The attached ACFs are routed directly to corresponding electrode pads through the gap created from a small cut. Lastly, a soft elastomer (Ecoflex TM 30, Smooth-On) encapsulates the device to protect the circuit electronically and mechanically. An additional device stretchability test with different stretching speeds has been conducted, shown in Supplementary Fig. 5, with a detailed view of the ACF connection and stretchability test. Two different stretching speeds are used to elongate the SFB at 5 mm s −1 . Similarly, the stretching test result of 2.5 mm s −1 is shown. For both cases, the whole device has shown minimal resistance change of less than 1% overall, and the final cycle proves its ability to return the original value after 30% elongation. The breathability of the fabric used in the design of SFB has been compared with other potential fabrics and materials shown in Supplementary Fig. 6. Supplementary Fig.  6a, b illustrates the experimental setup of the breathability test calculating the moisture vapor transmission rate (MVTR) by measuring water evaporation weight through each material for 72 h. The MVTR result shown in Supplementary Fig. 6c indicates that the 3M 9907T has superior breathability compared to other elastomers, such as PDMS, Ecoflex, and micropore layers. Moreover, the chosen 9907T's peeling forces in various humid conditions are tested to fully secure the SFB from delamination, where the sample device has been attached to the arm with a force transducer pulling directly upward ( Supplementary Fig. 7). The fabric maintained up to 1N of peeling force with 1.0 mL of water drop on the arm, which proves enough attachability to withhold its position against delamination 24 . The detailed peeling energy calculation is reported in Supplementary Fig. 7 with peeling energy of 70 J m −2 on dry skin and degradation to 40 J m −2 with water drop.
Overview of a robotic ankle-foot system and metabolic cost estimation This study uses two degrees of freedom ankle-foot orthosis endeffector with an active plantarflexion utilizing a tethered emulator system for the squatting assistance (Fig. 3). Off-board actuator transmits mechanical power via two Bowden cable tethers attached to the orthosis. Ankle range of motion is −80°to 50°i n plantarflexion and −20°to 20°in inversion-eversion, with respect to the neutral standing position. Plantarflexion occurs when both toes rotate in the same direction. The squatting trajectory is designed to assist the subject both while ascending (moving up) and descending (moving down) (Fig. 3a). During these phases, the assistance or desired torque is proportional to the ankle angle, where the proportional constant is changed based on the condition. This controller was previously tested and has also been used to personalize the assistance using human-inthe-loop optimization (Fig. 3b) 4,11 . Figure 3c illustrates the whole system of SFB and AFO with indirect mask calorimetry (K5, Cosmed). The AFO and SFB are attached to participants' sternum after cleaning with isopropyl alcohol and proper drying. The powered SFB is connected to a nearby android device to record raw ECG and motion signals. In addition, respiratory measures are recorded to determine the metabolic cost of squatting. The indirect respiratory calorimetry measures oxygen intake and carbon dioxide outtake to calculate the estimated metabolic cost 25 The estimated metabolic costs are divided by the subject's body weight and then normalized to compare with HRV-RMSSD. The AFO emulator is worn on the subject's dominant limb during squatting. The participants are required to maintain a standing position for the baseline condition. They are asked to squat under six conditions in random order, including no power AFO condition and no assist condition by AFO. After squatting sessions, the participants are asked to remove AFO and perform walking and running. The orders of walking and running are randomized for every subject. In contrast to squatting, resting times for walking and running are 3 min and rest.
Experimental design and validation of an SFB integrated with a wearable system Details of the squatting protocol of a single session are illustrated in Fig. 4a (left) with individual squatting timing. For both squatting and walking-running, records of raw ECG data via SFB are filtered with a bandpass filter. The implementation of this algorithm mentioned in the method section on a representative dataset collected by the SFB is provided in Supplementary Fig. 8. The filtered ECG and peak data are filtered again with a dynamic threshold line to eliminate incorrect ECG R peaks 26 . HR is graphed with finalized ECG peaks and then averaged to show a smooth curve. ECG signal quality is a major factor in determining the feasibility of the SFB. In response, SFB provides overall SNR higher than 25 dB and clear distinguishable ECG R peaks for all activities, including standing, squatting, walking, and running (Fig. 4b).
Total captures of a single squatting session and walking-running session are shown in Fig. 4c, and 30 s capture (top) with normalized ECG peaks during squatting and running gives clear HR and provides respiration rate (RR) for other potential calculations. Smoothed HR graphs (middle) show an increase in HR during squatting and walking-running, where running shows the highest average HR, followed by squatting and walking. Supplementary Videos 2 and 3 show examples of walking and running, respectively, with the soft, flexible biopatch on the subject's sternum. They illustrate mechanical stability during actions, reduced noise from conformal contact, and good ECG signal quality. The y-axis acceleration motion data from the IMU sensor (bottom) are distinguished with different colors for each action and are used to classify motion through machine learning. More 30 s ECG peak data and average HR outcomes during squatting from other subjects are represented in Supplementary  Fig. 9 to show device compatibility from subject to subject. Before calculating the HRV-RMSSD, the ECG quality is compared against one of the commercially available ECG straps (Polar H10, Polar Electro). The red graph portrays the HR curve from SFB and black dots from the commercial ECG strap (Supplementary Fig. 10). At the beginning of squatting, the HR from SFB and Polar H10 shows a more significant difference due to the smoothing of a sudden HR change in the algorithm but soon converges as HR increases and reaches a steady state. The comparison results R 2 = 0.961 for n = 447 with a p-value of 0.002, and 90% of HR difference data are scattered in one standard deviation range between −2.27 and 1.72 bpm.

HR detection algorithm
The ECG signal is filtered with a first-order Butterworth bandpass filter with cutoff frequencies of 0.5 and 60 Hz. A moving average filter is then applied by convolving the signal with a sequence of length 0.15Fs and magnitude (0.15Fs) −1 . An RMS envelope is employed to reject periods of high noise. To detect a QRS complex, the highest local peaks spaced at least 200 milliseconds apart are identified as fiducials. These fiducials are compared to a threshold defined in Eq. (2): where NoiseLevel and SignalLevel are estimates of the noise and signal level, respectively 27 . These parameters are dynamically updated after each fiducial is classified such that if the peak is above the threshold shown in Eq. (3), if not, in Eq. (4).
SignalLevel ¼ 0:125 Peak þ 0:875 SignalLevel NoiseLevel ¼ 0:125 Peak þ 0:875 SignalLevel (4) Suppose no QRS is detected within 166% of the average R peak interval for the previous nine beats. In that case, the maximal fiducial within this period is added as a QRS complex if it exceeds half the threshold value. Finally, fiducials within 360 milliseconds of a QRS that exceed the threshold are rejected if the slope is less than half the average of the previous 9 QRS complexes, which indicates that it is likely a T wave with abnormally high amplitude. The HRV is typically measured for longer than 15 min for accuracy, but in this study, HRV-RMSSD is used for a short-term interval of 30 s 28 . The average RMSSD calculated from the 30 s intervals from the last 2 min of each squatting condition is compared with the steady-state metabolic cost. A single value is calculated to compare HRV-RMSSD with estimated metabolic cost to represent energy expenditure. Because metabolic cost is the real-time varying quantity and estimated metabolic cost increases for the first half of squatting then convergences into a single value, the converged filtered metabolic cost value in the last 2 min of the squatting session is used to compare with normalized HRV-RMSSD. For the cleaning and calculating HRV-RMSSD values, neurokit2 29 library is used for python after ECG filtering. The representative subject's ECG, HR, Fig. 3 Overview of a robotic AFO system and experimental setup. a Comparison between the actual torque (blue) and desired torque (orange) according to ankle angle. The angle-torque relationship compares the torque trajectory commanded to the low-level controller and the corresponding torque observed at the exosuit. b Illustration of the experiment setup, where the subject wears the AFO exosuit on the right foot, the SFB measuring ECG, and the mask-based calorimetry device on the face. c Detailed system architecture for the mid-level and low-level controller.
RR, and HRV-RMSSD data from the single session are shown in Supplementary Fig. 11, including standing, squatting, walking, and running with a gradient of 0-4.

HRV analysis and motion classification via machine learning
The designed model shows 91% test accuracy and 97% training accuracy (training and loss curve in Supplementary Fig. 12). In Fig. 4 Experimental setup and performance validation of an SFB integrated with a wearable system. a Timestamp and illustration of squatting and walking-running experimental protocols. The color saturation on the right side indicates elevation changes. b Representative ECG data showing 3 s of peak shapes and SNR during standing, squatting, walking, and running with an AFO. No significant degradation and motion artifacts in the signal qualities are observed during standing and running. c Filtered and normalized ECG data during 30 s of squatting and walking-running session (top), moving average of HR for squatting and walking-running conditions (middle), and vertical axis acceleration during activities, including standing, squatting, walking, and running (bottom).
addition, the classification report shows overall accuracy of 88% (Fig. 5a), with the lowest accuracy of 74% from running and 82% from elevated walking. Standing and squatting both present accuracy of 99%. The details of the convolution process are summarized in Fig. 5b. The high accuracy of classification between walking, running, standing, and squatting shows that the model can successfully identify the dynamically distinct conditions. The reduction in the gradient condition's accuracy showed that the model is not confident in differentiating between gradients. This can be due to the three-axis accelerometer, and future studies can explore the usage of a gyroscope in a combination of an accelerometer and a Madgwick filter 30 to estimate the Euler angle and use the information as part of motion classification. The raw metabolic cost is also measured and filtered with a fourth-order bandpass filter 27,31 , as shown in Fig. 5c. Each subject's metabolic cost for every squatting condition is compared against the HRV values. Further, perceived effort (PE), a clinical term to determine the hardness of action described with numbers between 6 and 20, is used for each subject to record the user's perceived physical effort feedback (Borg rate perceived effort scale) 32 . The user's perceived efforts are subjective and vary substantially from subject to subject. This could be a reason for a moderate correlation. Yet, the quantified perceived effort by each subject and its relationship to HRV-RMSSD indicates the overall participants' ability to recognize the step loading from the AFO. The Pearson R correlation between normalized metabolic cost and normalized PE shows R = −0.689 with a p-value of 6.6e−6 and an acceptable negative correlation (Fig. 5d). Table 1 compares recent exosuit studies to estimate metabolic costs and physical effort. This summary shows the limitation of current studies using respirometer and HRV studies due to their form factor and application, and there yet has not been an attempt to relate HRV-RMSSD and metabolic cost.
In conclusion, this work reports a wearable bioelectronic system that integrates a soft biopatch, an ankle-foot exoskeleton, and a machine-learning algorithm to estimate metabolic costs and physical effort. The miniaturized, all-in-one wearable biopatch can measure highly accurate metabolic rates to replace the existing bulky, heavy, and cumbersome tools. The soft biopatch can detect motion hardness, cognitive effort, and physical effort as metabolic costs and energy expenditure in exosuit studies. In addition, the skin-conformal device offers intimate contact with the skin for a high-quality recording of ECG and HRV-RMSSD. Unlike the conventional mask-based calorimetry, the wearable system, including the SFB and AFO, provides a high SNR (>25 dB) on different activities (walking, running, and squatting) and high  (6)(7)(8)(9)(10)(11)(12)(13)(14)(15)(16)(17)(18)(19)(20). The measured Pearson R correlation is −0.689 (p-value: 6.6e−6).
Pearson R correlation (−0.758, p-value: 1.2e−7) 33 to steady-state metabolic costs. Future studies will focus on a large-group rehabilitation exosuit study targeting real-time optimization of human parameters. Also, the portable biopatch will add additional functions to measure muscle activities, temperature, and stress levels, providing an insight into real-time human-in-the-loop optimization.

METHODS Preparation of a soft flexible biopatch
This study develops an SFB with multiple electronic components, wireless flexible circuits, and stretchable electrodes. The fPCB, designed in this work, provides mechanical flexibility and low Young's modulus for offering conformal contact with the skin. The fPCB is composed of 2 boards: the mainboard and the power supply board. The mainboard is a 25 mm × 14 mm size double copper layer with a 12.7 µm polyimide separation and immersion gold surface finish. The power supply board is an 18 mm × 10.2 mm double copper layer with the same separation and surface finish resulting in an overall thickness of 0.5 mm. The fPCBs are purposefully separated into two boards to reduce system's rigidity by providing more freedom to bend and less volume by stacking the main board on top of the power supply board (Supplementary Fig. 13). The main board consists of 4 discrete sections: ECG analog to digital converter, microprocessor, IMU motion sensor, and Bluetooth Antenna (Supplementary Fig.  13a). The analog-to-digital converter (ADS1292, Texas Instruments) receives raw voltage from bipolar electrodes from the skin. Then it transfers the signal into a digital signal along with the IMU sensor (IMU20948, InvenSense). The transferred digital signals are processed in a microprocessor (NRF 52832, Nordic) and transmitted through a high-frequency (~2.4 GHz) low-power Bluetooth antenna. The power board receives 3.7 V input from a battery (3.7 V, 40 mAh, 1.13 g). Then it transforms into two different power lines via a 1.8 V regulator (S1318A18, ABLIC) and a 3.3 V regulator (S1318A33, ABLIC) to power the mainboard. More lists of functional microchips used in making the fPCB mainboard and power supply board can be found in Supplementary Table 1.

Mechanical reliability
Because human skin has various curvatures, the physical properties of SFB, especially the flexibility of the fPCB requires it to exceed at least 15°to have conformal contact with the sternum. To test the flexibility, the fPCB is tested with a cyclic bending test ( Supplementary Fig. 14). A fully soldered mainboard is mounted on a custom-built motorized test stand ( Supplementary Fig. 14a), and resistance between the two furthest ground pads is measured during cyclic bending of 15°to −15°for 100 cycles. Overall, there is no shifting of resistance or sudden failure; a consistent fluctuation range between 0.35 Ω and 0.38 Ω shows the sufficient quality of fPCB to be used on human skin ( Supplementary  Fig. 14b).

Battery lifetime
The battery in the SFB (3.7 V, 40 mAh, 1.13 g) can easily be charged with a magnetic charging port and designated charger. The charger has a USB type-A for its wide compatibility, and a physical switch controls the power status of the SFB. A fully charged battery can be used for over 9 h of continuous operation without disconnection and only requires about 30 min of charging ( Supplementary Fig. 15). University of Illinois-Chicago (#2020-0563). All participants agreed and signed the consent form to allow the experiment procedure. In this experiment, each squatting phase is done for 4 min with the subject squatting for 2 s (1 s descending and 1 s ascending) and standing for 6 s before and after squatting, followed by walking and running with different magnitudes of elevation (Supplementary Video 4). After each condition, the subjects are asked to rest for 12 min with a ratio of 1:3 to squatting time 34 . The AFO emulator is worn on the subject's dominant limb during squatting. All squatting session is controlled by a metronome and timer display on a screen. These devices act as audio and visual cues for the squat and rest. The subjects are asked to perform a full squat or the deepest squat possible with a distance between ankles approximately shoulder-width apart 35,36 . The squat posture and leg position are determined prior to the start of the study based on the subject's capability and biomechanical range and are fixed for the complete study. During the study, each squat is observed, and additional verbal instructions are given if there is any deviation or inconsistency during the squat with leg width or squat depth to achieve the predefined squat posture and leg position.

Classification method
The 3-axis acceleration data of six subjects are processed and segmented into splits of 0.5 s. These segmented data are hand labeled for six conditions (running, elevated running, walking, elevated walking, standing, and squatting). The labeled data are then split in 80:20 for train and testing, respectively. The set is then loaded to pytorch 37 dataloader module, and training data order is randomized for each training epoch. To perform activity classification, three convolutional layers are selected as the training of model, followed by the max-pooling layer and dropout layer. Three more convolution layers then follow these layers. Finally, a fully connected layer with 6 output is used. For each layer, the output is activated using reLU activation expect for the final layer, the activation is soft-max. The convolution layer has one stride, and the training is performed in the batch of 50 with cross entropy loss and adam optimizer with a learning rate of 0.001. The model and training are built using pytorch library, and each iteration training time is 15 s (wall clock time) using GPU (Geforce RTX 2060 super, NVIDIA). During the training process, the training and test loss and accuracy for each epoch are recorded. The model with the best test accuracy is used to report results.

Robotic AFO setup
The setup for the squatting assistance uses an AFO emulator, composed of high and low-level controllers and actuators. The high-level controller generated desired torque using an impedance curve shown in Fig. 3a. There are ascending and descending parameters where two parameters control the torque profile. The ankle angle and applied torque were measured using a load cell and the rotary magnetic encoder. Using the desired torque, the low-level controller conducted a torque control and commanded control input, desired velocity, to the servo actuator (Humotech ® ). The power and signal were transmitted through wires to the AFO end-effector.

DATA AVAILABILITY
The data that support the findings of this study are available in the Supplementary Information of this article.