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.
We provide these great 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.
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. :::
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)