Write a custom Part¶
Draft
This guide is scaffolded. The outline below marks what it should cover.
Subclass Part to add a new behavior with its own
parameters, state, inputs, and per-tick wrench contribution.
To cover¶
- Declaring channels at class scope (
Parameter/State/Input/Output/Noise) — see Parts. - Implementing
update(self, ctx) -> PartUpdate(or returning a bareWrenchfor a stateless part): readingctxviews (pose, twist, frames), returning a frame-taggedWrenchand any state derivatives. - Choosing a manifold for a
State(R1 / R3 / SO3). - Declaring
requires_fields/requires_planetwhen the part samples a field. - Making a
Parameterfittable (give it amanifold=). - Testing the part in isolation.
Worked example skeleton¶
from manta.parts import Part, Parameter, Input, Wrench
# from manta.ir.frames import CraftFrame
class MyThruster(Part):
gain = Parameter(1.0)
throttle = Input(0.0)
def update(self, ctx):
... # return PartUpdate(wrench=Wrench(force=..., frame=CraftFrame))
Source material¶
- Reference: Parts
- Code:
manta/parts/actuation/thruster.py(a simple worked part)