feathersdk.comms.comms_manager Module¶
- feathersdk.comms.comms_manager.MsgUIDType¶
Type of the unique identifier of a message.
- feathersdk.comms.comms_manager.SingleMsgCheckerFuncType¶
Type of a function that checks for expected responses in single message mode.
alias of
Callable[[CanSocketResult|TcpSocketResult|ErrorSocketResult],str|None]
- exception feathersdk.comms.comms_manager.SocketCANLibError¶
Bases:
ExceptionError raised when the socketcan library returns a non-zero error code.
- exception feathersdk.comms.comms_manager.EndpointOverloadError¶
Bases:
ExceptionError raised when the CAN bus is overloaded.
- exception feathersdk.comms.comms_manager.UnknownEndpointError(*args, **kwargs)¶
Bases:
ExceptionError raised when the interface is not an interface, or is not being tracked by CommsManager.
- exception feathersdk.comms.comms_manager.CommsManagerDisabledError¶
Bases:
ExceptionError raised when the comms manager is disabled.
- exception feathersdk.comms.comms_manager.MissingMsgUIDError(*args, **kwargs)¶
Bases:
ExceptionError raised when a message UID is required but not provided.
- exception feathersdk.comms.comms_manager.PendingReceiveMessageError(*args, **kwargs)¶
Bases:
ExceptionError raised when a message is to be sent when we are awaiting a response in single message mode.
- class feathersdk.comms.comms_manager.CommsManagerConfig(*, max_can_rate=3000.0, can_leniency=100.0, max_ip_rate=10000.0, ip_leniency=1000.0, result_operating_frequency=200.0, await_thread_start_timeout=1.0, processing_toggle_timeout=0.3, show_all_sdo_errors=False, disable=False, DANGEROUS_disable_overload_checks=False)¶
Bases:
PyDFrozenBaseModelConfiguration for the comms manager.
- Parameters:
- max_can_rate: float¶
The maximum messages per second that can be send on a CAN interface. If the rate is exceeded, an error will be raised. See EventThrottler for more information.
- can_leniency: float¶
The amount of leniency allowed when checking for CAN bus overload. We allow max_can_rate / can_leniency messages to be sent in a burst before throttling occurs. See EventThrottler for more information.
- max_ip_rate: float¶
The maximum messages per second that can be send on an IP interface. If the rate is exceeded, an error will be raised. See EventThrottler for more information.
- ip_leniency: float¶
The amount of leniency allowed when checking for IP bus overload. We allow max_ip_rate / ip_leniency messages to be sent in a burst before throttling occurs. See EventThrottler for more information.
- result_operating_frequency: float¶
The frequency at which the comms manager result processing thread will attempt to process results from the socket result buffer.
- await_thread_start_timeout: float¶
The timeout in seconds to wait for the processing thread to start.
- processing_toggle_timeout: float¶
The timeout in seconds to wait for the processing thread to toggle processing when making changes to the processing state.
- show_all_sdo_errors: bool¶
CANOpen often logs unneeded SDO messages, so we can disable them by default. Set to True to re-enable them.
- disable: bool¶
Disable the comms manager. Used internally for clients talking to server to avoid duplicate comms manager.
- DANGEROUS_disable_overload_checks: bool¶
Disable the overload checks for the comms manager. This is dangerous and should only be used for testing!
- model_config: ClassVar[ConfigDict] = {'frozen': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class feathersdk.comms.comms_manager.Endpoint(*, name, type='can', socket_idx, iface_uid)¶
Bases:
PyDFrozenBaseModelAn endpoint to send and receive messages from.
- model_config: ClassVar[ConfigDict] = {'frozen': True}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class feathersdk.comms.comms_manager.CanopenNetwork(endpoint, bitrate=1000000)¶
Bases:
objectA CANopen network.
- network: Network¶
The CANopen network.
- read(node_id, idx, subidx=None)¶
Read a CANopen value.
- write(node_id, value, idx, subidx=None)¶
Write a CANopen value.
- add_node(node_id, obj_dict=None)¶
Add a CANopen node to the network. If the node already exists, returns the existing node.
- remove_node(node_id)¶
Remove a CANopen node from the network.
- Parameters:
node_id (int)
- Return type:
None
- disconnect()¶
Disconnect the network.
- Return type:
None
- feathersdk.comms.comms_manager.initialize_comms_manager(config)¶
Initialize the CommsManager. Should only be called once.
- Parameters:
config (CommsManagerConfig)
- Return type:
_CommsManager
- feathersdk.comms.comms_manager.get_comms_manager()¶
Get the CommsManager instance. Should only be called after initialize_comms_manager has been called.
- Return type:
_CommsManager
- feathersdk.comms.comms_manager.is_comms_manager_initialized()¶
Check if the CommsManager is initialized.
- Return type: