canberry package¶
Submodules¶
canberry.can_utils module¶
Implementation of the protocol for the MOVIDRIVE traction converter of SEW EURODRIVE
-
class
canberry.can_utils.
Service
[source]¶ Bases:
object
Namespace for convenient and consistent naming
-
NO_SERVICE
= 'no_service'¶
-
READ_ATTR
= 'attribute'¶
-
READ_DEFAULT
= 'default'¶
-
READ_MAX
= 'maximum'¶
-
READ_MIN
= 'minimum'¶
-
READ_PARAM
= 'parameter'¶
-
READ_SCALE
= 'scale'¶
-
WRITE_PARAM
= 'write_parameter'¶
-
WRITE_PARAM_VOLATILE
= 'write_parameter_volatile'¶
-
code
= {'minimum': 4, 'write_parameter_volatile': 3, 'scale': 7, 'default': 6, 'attribute': 8, 'write_parameter': 2, 'no_service': 0, 'parameter': 1, 'maximum': 5}¶
-
-
canberry.can_utils.
bytes_to_int
(bytes)[source]¶ Convert a bytearray to an integer
Parameters: bytes – bytearray Returns: integer
-
canberry.can_utils.
make_mgt_byte
(service, sync=False)[source]¶ Creates the management byte according to the protocol
Parameters: - service – Service code as defined in
Service
- sync – boolean if synchronized mode should be used
Returns: integer
- service – Service code as defined in
-
canberry.can_utils.
make_sdo
(recipient, index, service=None, value=None, sync=False)[source]¶ Creates a Service Data Object message
Parameters: - recipient – the recipient as integer
- index – integer for the sensor
- service – requested service from
Service
- value – None to read a value otherwise write value
- sync – Synchronized protocol
Returns: Service Data Object message
canberry.cli module¶
The command line interface for canberry
canberry.logic module¶
High-level functions to read and write a sensor of the MOVIDRIVE traction converter
-
class
canberry.logic.
Sensor
[source]¶ Bases:
object
Namespace for convenient and consistent naming
-
DUMMY1
= 'dummy1'¶
-
DUMMY2
= 'dummy2'¶
-
SPEED
= 'speed'¶
-
code
= {'dummy2': 65535, 'dummy1': 65535, 'speed': 8318}¶
-
-
canberry.logic.
is_sensor_known
(sensor)[source]¶ Check if sensor is known
Parameters: sensor – sensor as string Returns: boolean
canberry.utils module¶
Additional utilities
-
class
canberry.utils.
DummySensor
(trans=0.0, scale=1.0)[source]¶ Bases:
object
A dummy sensor for test purposes
-
canberry.utils.
add_timestamp
(dct)[source]¶ Adds a timestamp attribute in miliseconds to a dictionary
Parameters: dct – dictionary
-
canberry.utils.
list_attributes
(obj)[source]¶ Lists all attributes of an object or class
Parameters: obj – object or class Returns: dictionary of user-defined attributes
-
canberry.utils.
read_config
()[source]¶ Read the configuration files .canrc, can.conf etc. as defined by python can in order to retrieve all settings from the section [canberry]. :return: dictionary
canberry.views module¶
Views of the flask application