Toolkit for human in the loop optimization
- HIL Toolkit: Acquisition, estimation and optimization of human in the loop experiments
- Table of contents
- Requirements for the toolkit
- Installation
- HIL optimization.
- Device setup
- Cost Estimation
- Python 3.10 or higher.
- Labstreaminglayer - install here.
- pylsl - install by running
pip install pylsl.
- Cosmed or other metabolic cart device.
- Setup metabolic cost acquisition code.
- Polar H10
- Bluetooth capible laptop for ECG.
- Pressure SDK.
Complete python HIL toolkit install using pip in main directory.
pip install -e .- First setup the device as mentioned in the device setup section.
- Setup the optimization problem in the
config/<optimization>.ymlfile. An example of the optimization problem is provided in theconfig/ECG_config.ymlfile. - Setup optimization using HIL toolkit. Example of this is provided in the
scripts/ECG_optimization.pyfile. - Run the optimization script.
python scripts/ECG_optimization.py
- Since the most physiological sensors are not open source, we have to use provided an acquisition script for the sensors.
- Example of this script is provided in the
scripts/cost_acq.pyfolder. - This script will help setup the cost acquisition device and send the data to the optimization pc.
For setting up the new polar H10 ( ECG sensor )
- Please turn on the computer bluetooth connection.
- Run the following script to find all the available POLAR sensor scripts
python scripts/search_polar.py. This script will search for polar sensors in the bluetooth range and save the BLE information in theconfig/polar.ymlfile. And return success or failure. - Run the script to collect data from the polar and send it.
python scripts/collect_polar.py
Follow these steps to the setup the exoskeleton device.
- Connect the device to the network or use a ethernet cable to connect the device to the computer.
- Check the IP address of the device. The IP address can be found in the control panel of the device or use command window, type
ipconfigorifconfigand find the IP address of the device. - Check if the device is connected using
ping <IP address of the device>. If the device is connected it will return the response from the device. - Create a server in the optimization pc for testing the communication.
- If control system is in matlab/simulink use the matlab script provided here to test the communication.
comms/communication_test.m - If control system is in python use the python script provided here to test the communication.
comms/communication_test.py - If the communication is successful, the device is ready to be used for the optimization.
- Add the device the following lines in the
config/<optimization>.yml
Exoskeleton:
port: 5555
ip: "192.168.0.10"Warning The estimation is not fully tested. Please use with caution.
Please refer the following paper for the details of the estimation.
Reference
Kantharaju, Prakyath, and Myunghee Kim. "Phase-Plane Based Model-Free Estimation of Steady-State Metabolic Cost." IEEE Access 10 (2022): 97642-97650.
- Run the following script to estimate the metabolic cost.
python scripts/estimate_metabolic_cost.py - This script will estimate the estimate the metabolic cost data in the provided in the
data/met_data.npy. - The scrip will generate the estimation and the also video as shown in the following figure.

- It will also make a video of the estimation and the actual data. The video will be saved in the
scripts/Results/videos/folder.
- Run the following notebook .
notebooks/preprocessing_cosmed.ipynbto convert the raw data to the metabolic cost data. - To perform the estimation run the following notebook.
notebooks/estimation_cosmed.ipynb
