symforce.opt.timestep_sub_problem module#

class TimestepSubProblem(timesteps, name=None)[source]#

Bases: SubProblem

A SubProblem intended for use when the Inputs block contains sequences tied to timesteps.

Provides a timesteps variable for the number of timesteps, and a build_inputs() function which works for Inputs blocks containing sequences as long as the number of timesteps.

  • timesteps (int) – The number of timesteps

  • name (str) – (optional) The name of the subproblem, derived from the class name by default

timesteps: int#

Build the inputs block of the subproblem, and store in self.inputs.

Each field in the subproblem Inputs that’s meant to be a sequence of length timesteps should be marked with "timestepped": True in the field metadata. Other sequences of known length should be marked with the "length": <sequence length> in the field metadata, where <sequence length> is the length of the sequence. For example:

class Inputs:
    my_timestepped_field: T.Sequence[sf.Scalar] = field(metadata={"timestepped": True})
    my_sequence_field: T.Sequence[sf.Scalar] = field(metadata={"length": 3})

Any remaining fields of unknown size will cause an exception.

Return type: