A general purpose, ROS installable OR pure python package for keeping track of machine calibration data.
Project description
calibration_manager
A simple, ROS installable OR pure python package for keeping track of configuration and calibration data.
Calibrations are organized by machine setup, component, and time of the calibration in a file structure. Thay may contain any standard python type, and will automatically load numpy arrays and pandas dataframes.
A calibration is considered valid for a specific configuration, so a snapshot of the current cfg is stored in the calibration; this allows easy recall of a specific state for later analysis.
Once created, calibrations can be loaded and accessed as a dictionary:
import calibration_manager as cm
setup = cm.Setup('my_machine')
setup.save_example_cal()
components = setup.load()
pA = setup.cfg['example_component']['test_param_A']
cA = setup.cal['example_component']['test_cal_A']
arr = setup.cal['example_component']['test_array_B']
Don't forget that you can unpack all the dict keys into a function variable directly:
def func(test_param_A, test_array_B, **kwargs):
return test_param_A + test_array_B
arr_B = func(**setup.cal['example_component'])
To save a new calibration, just construct a dictionary of your parameters and pass to cal:
my_np_array = np.random.rand(3,3)
my_calibration = {
'A': 3.0,
'B': True,
'C': 'pinhole',
'subsystem': {
'1': my_np_array
}
}
setup.save_component_cal('camera1', my_calibration)
If ros is installed (optional!) and the code has connection to a roscore, it can automatically upload parameters to the rosparam server. If a ros_param_ns is provided in load(), all values in the cal.yaml will be loaded, or if ros_param_ns is set to 'default', it will default to /{machine}/{component}/{params}.
Setups are stored in ~/.ros/setups/ by default, but this can overwritten with:
setup = cm.Setup('my_machine', '/my/setups/root/dir/')
Future features planned:
- when instantiating a component for the first time when no default_cfg is available, run a prompt to get the user input
- load from a SCOPS build folder
- allow datetime loading
Suggestions and commits are welcome.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for calibration_manager-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c30af64b6ba8d142f268030bbcd2bb7dfeea6b17593d58acd96d4d93bd7f3cee |
|
MD5 | 223a9e596826ffa813cf4e608c02b3e4 |
|
BLAKE2b-256 | 66f2f3bb858faf921cbe1169f4d2db083babefcb1d991ca9d764bb74da723cc8 |
Hashes for calibration_manager-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 496e448c439a493d4f4ec9dcff058679f416ed7da8951407a3a0f1dcb7c32db4 |
|
MD5 | a2e00e63b8e5b5c7c2c41958ad56168c |
|
BLAKE2b-256 | 6cafcbf52f23997e01fd1b26414118c73320da1c17049417f8de2039ed1f7d8e |