4 #include <fmt/format.h>
6 #include "drake/systems/framework/leaf_system.h"
8 #include "drake/multibody/plant/externally_applied_spatial_force.h"
9 #include "drake/multibody/plant/multibody_plant.h"
10 #include "drake/multibody/math/spatial_force.h"
12 #include "drake/geometry/meshcat.h"
13 #include "drake/geometry/shape_specification.h"
15 #include "drake/common/value.h"
20 namespace mimpc::simulation {
21 class VizForces :
public drake::systems::LeafSystem<double> {
24 drake::multibody::MultibodyPlant<double> &plant_;
25 std::unique_ptr<drake::systems::Context<double>> plant_context_;
26 drake::geometry::Meshcat &meshcat_;
28 const int num_forces_;
29 const std::string body_link_name_;
31 const double arrow_len_multiplier_;
32 const double arrow_width_;
34 drake::systems::InputPort<double> *body_state_input_port_;
35 drake::TypeSafeIndex<drake::systems::InputPortTag> forces_input_port_;
40 VizForces(drake::multibody::MultibodyPlant<double> &plant, drake::geometry::Meshcat &meshcat,
42 const std::string &bodyLinkName,
const double arrowLenMultiplier);
44 void updateArrows(
const drake::systems::Context<double> &context)
const;
Definition: VizForces.hpp:21