Open RussTedrake opened 4 years ago
Note that the "State variables 2.0" doc in #9171, currently also includes the view concept:
// Returns the value of this numerical variable but overlaid with
// a struct to provide named access via members.
template <template<typename> Overlay>
const Overlay<T>& variable.value_overlay<Overlay>(const Context<T>&);
Let's keep these two ideas in sync!
In #11191 we introduced this for python.
Possible related to #9171.
Specific need/request: Authoring systems is safer/easier if we can work with structured data (as opposed to a BasicVector). But requiring the port to be a structured type defeats many workflows. For instance, in my
AcrobotGeometry
PR (coming shortly, will link to this issue), I was fine wiring up theAcrobotPlant
to theAcrobotGeometry
system if the input port had typeAcrobotState<double>
, but then I could NOT easily wire up a trajectory playback to visualize the output of trajectory optimization (as done inrun_swing_up_traj_optimization.cc
.I think a few sugar methods in the auto-generated
*.named_vector
workflow would be able to address this easily.