robomorphic / Fixed-Point-Controller

4 stars 1 forks source link

Robot controller with Fixed-Point Arithmetic

Introduction

This project is built to analyze how fixed-point arithmetic can be used to control a robot. The control problem is modelled as a quadratic problem, and it is solved using OSQP. The problem formulation can be seen in Notes file.

Dependencies

Essential:

Optional:

Installation

You can use the Dockerfile to install the simulation and its dependencies. You may also need to setup X11 forwarding in the host system. In the future I'll try to remove this dependency for headless operation.

Extra notes

You need to change the line

/opt/homebrew/include/eigen3/Eigen/Core/MathFunctions.h line 1372

from

template EIGEN_DEVICE_FUNC bool (isfinite)(const T &x) { return internal::isfinite_impl(x); }

to

template EIGEN_DEVICE_FUNC bool (isfinite)(const T &x) { return true; }

Otherwise, Eigen refuses to work with our fixed-point arithmetic class. This may be fixable.

Usage

Currently the project is set up for Franka Panda robot, it can be run with the following command:

./scripts.sh panda

If you'd like to sweep different fixed-point configurations, you can use the following command:

./scripts.sh panda_sweep

The joint positions for each control iteration are stored in the exp directory, and other results are stored in exp_data.

If you'd like to process the latest run's results:

python3 scripts/detailed_inspection.py # produces experiment_summary.json, containing all the important data in a nice format
python3 scripts/experiment_summary_plot.py # produces ratio values, plots, ratio plot videos, and a nice json file for all ratio values

Pointers

Start by reading trajectory_tracking.cc and config.hpp. They contain the crucial parts, configs, and the main function.