I would like to do declare an AbstractOutputPort is so I can use calculations from the abstract port in my controller.
Am I thinking of MultiBodyPlants wrong and should I define create my own LeafSystem
void outputGeometryPose(
const drake::systems::Context<double>& context,
drake::geometry::FramePoseVector<double>* poses) {
}
// I also tried
// void outputGeometryPose(
// const drake::systems::Context<double>& context,
// drake::geometry::FrameKinematicsVector<drake::math::RigidTransform<double> >* ) {
// }
MultibodyPlant<double>* dp = builder.AddSystem<MultibodyPlant<double>>(max_time_step);
dp->set_name("plant");
dp->RegisterAsSourceForSceneGraph(&scene_graph);
Parser parser(dp);
parser.AddModelFromFile(kDoublePendulumSdfPath);
dp->DeclareAbstractOutputPort("geometry_pose", outputGeometryPose);
This is what I'm trying but I get the following compile error
bazel-out/k8-opt/bin/external/drake/systems/framework/_virtual_includes/leaf_system/drake/systems/framework/leaf_system.h:1573:3: note: candidate template ignored: could not match 'void (MySystem::*)(const Context<double> &, OutputType *) const' against 'void (*)(const drake::systems::Context<double> &, drake::geometry::FrameKinematicsVector<drake::math::RigidTransform<double> > *)'
DeclareAbstractOutputPort(const OutputType& model_value,