---
# System prepended metadata

title: 'Motion Meeting Minutes | BaPSF | May 31, 2022'
tags: [minutes, ' motion']

---

---
tags: minutes, motion
---

# Motion Meeting Minutes | BaPSF | May 31, 2022

## Agenda

1. ...

## Attendees

* Erik
* Rishabh

## Minutes

* first take at...
    * `RunManger` class
    * interfacing functions for LV to call which commands `RunManager`

* How should data be passed from Pyton to LabView
    1. Have one Py factory function that LV communates with
        * will likely need to have the same return type for every request
        * a possible retrun type would be a string represenation of `json` data
        * then LV would have to parse the string based on known/diven data types
        * CON: would likely force us to use a 3rd party LV pkg
        * PR0: would likely be "easily" extensible
        
        `json` string data with single value
        ```json=

        response_data : true
        ```

        `json` string with multiple key-value pairs
        ```json=
        response_data : {
            "position": [1, 2, 3],
            "moving": true,
        }
        ```
    2. have LV call multiple python files specific to the given request
        * each python file would return a different data type
        * PRO: no parsing of `json` strings required
        * PRO: no additional dependence on 3rd part LV pkgs
        * CON: might not be as "easily" extensible
    3. **Hybrid approach...have one py facotry function that is called by LV, but on the LV side the "request" goes through a case structure that calls the py factory function with a given data type**
        * PRO: no dependence of 3rd party LV pkgs
        * PRO: not additional parsing of string
        * PRO: keeps a py factory function
        * PRO: to extend functionality a case structure entry needs to be added on the LV side (along w/ associated data type) and a new callable needs to by added to the py factory function
        * CON: 🤔 ...
* `RunManager` class

```python=
from .motion_group import MotorMovement

class RunMangaer:
    _motion_groups = None

    def __init__(self, filename=None, config=None):
        if filename is not None and config is not None:
            raise ValueError
        
        if filename is not None:
            self.load_file(filename):
        elif config is not None:
            self._validate_config(config)
            self._init_motion_groups(config)
    
    def load_file(self, filname):
        # reads the toml file
        config = ...  # from toml file
        self._validate_config(config)
        self._init_motion_groups(config)

    def _validate_config(self, config)
        # go through config and make sure it's structured correctly
        ...
        # idnetify motion group and validate it's data
        MotorMovement()._validate_config(mg_config)
        ...
    
    def _init_motion_groups(config):
        # create all the motion groups defined by config
        ...
```

```python=

class MotionGroup:
    _toml_dict: None

    def __init__(self, filename=None, config=None):
        if filename is not None and config is not None:
            raise ValueError
        
        if filename is not None:
            self.load_file(filename):
        elif config is not None:
            self._validate_config(config)
            self._init_drive(config)
    
    def load_file(self, filname):
        # reads the toml file
        config = ...  # from toml file
        self._validate_config(config)
        self._init_drive(config)

    def _validate_config(self, config)
        # go through config and make sure it's structured correctly
        ...
    
    def _init_drive(config):  # similar to ConnectDrive
        # initialize and connect the probe drive
        ...
    
    @property
    def x_ip(self):
        return self._toml_dict["Drive"]["xIP"]
```
* rescheduling meeting for Steve
* Test on LaPD DAQ (week of July 4th)...what needs to be done to get there?
