Python library for working with Maxon EPOS4 through UART without
using libEposCmd
library.
The library is incomplete yet!
At the moment you can use library with Profile Position Mode (PPM)
only.
Available connection thorough UART
only.
Folder epos4
contains code of the library.
Explanation of example_1.py.
- Making object of EPOS4. Setting COM for communication with Maxon EPOS4 through UART.
from epos4 import Epos4
from epos4 import definitions as df
e = Epos4('COM_NUM')
- Checking current Operation mode. Set to PPM if it isn't.
om = e.get_operation_mode().get()
if om != df.OM_PPM:
e.set_operation_mode(df.OM_PPM)
- Checking
Enabled state
and set it
if not e.get_enable_state():
e.set_enable_state()
- Checking
Fault state
. Moving to position if it isn't
if not e.get_fault_state():
e.move_to_position(0xFFF)
Clear Fault state
if it happened
e.clear_fault_state()
After clearing Fault state
you have to check Enable state
again
if not e.get_enable_state():
e.set_enable_state()
- Don't forget to close connection in the end
e.close()