Context Plugins#
A plugin is basically a bunch of predefined callback methods. It implements specific functions by registering a series of callback methods, such as ESC or GPS speed correction.
Built-in Plugins#
We provide these great plugins:
ESC Plugins#
ESCPlugin is a type of plugin that involves electric stability control. It is just
like regular plugins but will be forcibly disabled when the ESC mode of the context is set to
OFF. See ESC Mode. The 5 built-in plugins listed above are all ESC plugins
except the last one.
Mount a Plugin#
The following example mounts DTCS to the context.
from leads import LEADS, SystemLiteral, DTCS
context: LEADS = LEADS()
context.plugin(SystemLiteral.DTCS, DTCS())
SystemLiteral contains 4 predefined keys for the 4 ESC plugins.
Tip
The specification stipulates that all plugin keys should consist of capital letters and underscores only.
Disable a Plugin#
In Mount a Plugin, we have mounted DTCS to the context. What if we
want it to be disabled?
from leads import LEADS, SystemLiteral, DTCS
context: LEADS = LEADS()
context.plugin(SystemLiteral.DTCS, DTCS())
context.plugin(SystemLiteral.DTCS).enabled(False)