Drake Systems
About
Tips on how to program with the Drake systems framework.
Clunky
Difference in notation when using handles to input ports vs output ports
This is an except from Grant's Plant Evaluator.
Handles : Input vs Output Ports
struct PlantAPI { // Input and output ports, for use in Diagram::Connect. const drake::systems::InputPortDescriptor<double>* can_control_DS12S01_port; const drake::systems::InputPortDescriptor<double>* can_control_IPA2S03_port; const drake::systems::OutputPort<double>* dynamics_vehicle_state_port;};
Open Questions
Q) Why the need for BasicVector? Is it always needed, even when not AutoDiff'ing?
A) ...
Q) Why the need for InputPortDescriptor and not just InputPort?
A) ...
Closed Questions
Q) How to avoid raw index lookups of basic vectors?
A) Use the named vectors paradigm
Q) How to avoid raw index lookups of SystemOutput and Context::FixInputPort?
Use the indices provided by diagram builders when you call DiagramBuilder::ExportInput and DiagramBuilder::ExportOutput.