'How do you connect an arbitrary list of discrete control inputs to a plant?

I have a numpy array of discrete control inputs to provide my plant (one per fixed time_step). How would I hook that array of inputs up to my plant such that the inputs are held for time_step time?

If I had a Trajectory I could create a TrajectorySource and hook that up to my plant, but I don't have a Trajectory object, just a numpy array.



Solution 1:[1]

I think you were on the right track. As best I can tell, what you're looking for is a PiecewisePolynomial::FirstOrderHold trajectory (to be fed into the TrajectorySource).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jwnimmer-tri