Major refactor of ethercat + maxon, designed to be seperate so other controllers can be added in future. Includes cli + gui#8
Open
prkrtg wants to merge 46 commits into
Open
Major refactor of ethercat + maxon, designed to be seperate so other controllers can be added in future. Includes cli + gui#8prkrtg wants to merge 46 commits into
prkrtg wants to merge 46 commits into
Conversation
…le package independent of the LRIS2 CSU.
…t as actual packages.
Remove addConfigurationFunc as moving to a subclass approach
…cept of slaveConfigFuncs with the EPOS4 bus and instead work them in through subclassing.
Renamed and refined public methods for network interface and EPOS4 motors to align with Python conventions. Introduced private methods for low-level operations, ensuring encapsulation and clarity. Added interface state validation using `netifaces` to improve robustness during interface operations.
Replaced direct access to EtherCAT hardware with a more centralized `_bus` abstraction, ensuring consistent interaction and easier maintenance. Simplified method naming, improved logging, and optimized state change handling. Updated dependent code to align with the new structure.
Replaced `print` statements with `getLogger` for structured logging. Modularized repetitive code by introducing `_block_during_move`. Refactored homing and motion control logic for better readability and maintainability.
Renamed variables for clarity, fixed a string format bug, reordered imports, and removed unused or redundant functions. This improves code readability and eliminates unnecessary functionality.
Simplified PDO send/receive code by consolidating methods. Introduced a threading to prevent timeouts with locks for concurrency control. Improved error handling, debugging, and logging for slave operations. Deprecated older configuration functions and improved style consistency across the codebase. Testing in progress.
Introduced methods for retrieving slave position, velocity, and error diagnostics, improving diagnostic capabilities. Simplified and cleaned up PDO handling logic by adjusting threading behavior and replacing redundant operations. Commented out unused `_set_controlword` and related methods to streamline functionality.
Introduced a ControlWord enum to define control word commands clearly, improving readability and maintainability. Enhanced the assertStatuswordState function to support both StatuswordStates and general Enums, increasing flexibility.
Revised device and network state management to support Enums and improve transition handling. Added thread safety for PDO operations using threading events for pending messages. Made variable naming more consistent and introduced properties for improved readability and encapsulation. Had a PEP8 party
Moved the EPOS4Bus class to a new file (epos4bus.py) to improve maintainability by modularizing the code. Updated imports accordingly in related files and removed redundant code in epos4.py. This is also helping hilight the questionable class model of having both EthercatBus and EPOS4Bus. I'm thinking Ethercat bus should be subsumed into EPOS4Bus
Updated control word commands and object dictionary for better motion control. Introduced fault clearing, status bit waiting, and additional SDO-dependent properties for improved device state handling. Refined motion handling logic, including homing and position setup, ensuring alignment with the EPOS4 device operations.
Refactored EPOS4 object dictionary types with `dataclass` for immutability and better iteration support. Introduced a centralized register file with EPOS4 errors (rest to be moved later) for improved error interpretation and handling in diagnostic messages. Removed redundant and unclear methods, and adapted code to consistently utilize the updated object structure.
Invoke `disable_pdo()` before initializing slaves to ensure clean startup. Fix `position` property access and enforce integer casting for motion parameters to improve type consistency and prevent errors.
…tive positioning. Actually looks like a set of slits. Introduced thread-safe locking for EtherCAT bus operations using RLock to prevent concurrency issues. Updated configuration in `csu.yaml` (`um_per_count` added) and include positional offsets. Refactored hardware logic to compute bar positions and added motor stop functionality in `epos4bus.py`.
Introduced methods to enable homing via SDO operations with various homing sources such as SSI or user-defined positions. Deprecated and replaced outdated homing methods to improve reliability and maintainability. Included error handling and logging for a more robust homing process.
…s are defined to clarify intent. Add a stub for a register class to aid debugging.
…eed to repeat some commands. This is indicative of some sort of larger library issue or misconception on my part. Will investigate more. For now indent to make pretty motions.
…vatories/ether-cat-soft into csu-refactor * 'csu-refactor' of https://github.com/CaltechOpticalObservatories/ether-cat-soft: COO-107 - Refactor ethercat library into pip installable package (#6) Updated the readme with more information on how to get started plus background
Added functionality to handle homing operations using SDO with detailed status checks, parameter configuration, and timeout handling. Reintroduced previously removed homing-related object dictionary entries to align with the new implementation.
Consolidated state transition handling by iterating over slaves individually and maintaining node-specific control sequences. Simplified logic to eliminate assumptions of uniform statusword states across devices and added safeguards against KeyError and IndexError during sequence processing.
Renamed `PDOCycleTime` to `_PDO_CYCLE_TIME` for clarity and consistency. Added optional `shutdown_first` argument to `enable_pdo` to safely bring devices to a ready state before operational setup. Enhanced logging to monitor sent/received PDO counters and implemented minor cleanup for better readability and functionality.
Refactored `StatuswordRegister` for more flexibility, including state and bit handling. Updated SDO methods with consistent naming and improved readability. Enhanced homing workflow and added support for profile position moves using better abstractions for Statusword states.
Refactored multiple class methods for better type hinting, readability, and consistency. Added new properties and parameters to improve monitoring, debugging, and control, including `fault_state`, `monitor`, and extended debug info. Removed unused or redundant code to streamline functionality.
Replaced netifaces-based network interface validation with a direct check against the operating state in the /sys/class/net directory. This simplifies dependencies and improves clarity by using native system files for interface status validation. Updated error handling for missing operstate files to ensure more informative exceptions.
…y class structure. Consolidated slit-related classes to streamline functionality and improve clarity. Removed unused methods and redundant logic. Updated demo and manager code to align with new MaskConfig and Slit implementations, ensuring consistency and reducing code complexity.
Replaced `object_dict` with `ADDRESS` in EPOS4Motor, streamlining the codebase for better maintainability and readability. Removed unnecessary initialization and configuration of the `object_dict` attribute. Added new EPOS4 objects to expand functionality and updated related references accordingly.
…ting. Introduced the `use_ssi_encoder` parameter in BarConfig and integrated it into BarMotor. PID controller configurations with dedicated parameter sets for position, velocity, and current controllers. Fixed a typo in the gear reduction numerator constant name, ensuring consistency across configurations.
Updated `status` methods in various modules to support a `verbose` flag, allowing for more detailed status information when needed. Modified related method calls and added a new `info_sdo` property to fetch concise status data.
Updated `repr` methods for enhanced error object representation, improving debugging clarity. Commented unused PDO mapping properties and standardized `error_code` retrieval to ensure consistent formatting.
…nd status for mktl json and do it better. Introduced an optional `one_at_a_time` parameter for the calibration process, allowing sequential calibration of components. Adjusted related methods to handle this parameter and modified error handling to improve debug output readability.
Changed default calibration to one-at-a-time and increased current thresholds during homing for improved precision. Added new mask configurations and enhanced fault handling with a `clear_faults` command. Adjusted homing timing and parameters for better stability and reliability.
Changed the `move_to` method in `hardware.py` to operate in non-blocking mode for better flexibility in execution. Added temperature reading to the motor status dictionary in `epos4.py` to enhance monitoring capabilities.
Removed verbose frame data logging in debug statements to improve log readability and reduce unnecessary clutter.
…controllers can be added in future. Includes cli + gui
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR also brings in the history and foundational code used from PDR
GUI example running on LRIS2 machine

You can also use the CLI which is more for engineering/advance users right now