MIMPC++
A fast typesafe Mixed Integer MPC C++ library
VizForces.hpp
1 #pragma once
2 
3 #include <math.h>
4 #include <fmt/format.h>
5 
6 #include "drake/systems/framework/leaf_system.h"
7 
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"
11 
12 #include "drake/geometry/meshcat.h"
13 #include "drake/geometry/shape_specification.h"
14 
15 #include "drake/common/value.h"
16 
17 
18 
19 
20 namespace mimpc::simulation {
21  class VizForces : public drake::systems::LeafSystem<double> {
22 
23  private:
24  drake::multibody::MultibodyPlant<double> &plant_;
25  std::unique_ptr<drake::systems::Context<double>> plant_context_;
26  drake::geometry::Meshcat &meshcat_;
27 
28  const int num_forces_;
29  const std::string body_link_name_;
30 
31  const double arrow_len_multiplier_;
32  const double arrow_width_;
33 
34  drake::systems::InputPort<double> *body_state_input_port_;
35  drake::TypeSafeIndex<drake::systems::InputPortTag> forces_input_port_;
36 
37 
38  public:
39 
40  VizForces(drake::multibody::MultibodyPlant<double> &plant, drake::geometry::Meshcat &meshcat,
41  const int num_forces,
42  const std::string &bodyLinkName, const double arrowLenMultiplier);
43 
44  void updateArrows(const drake::systems::Context<double> &context) const;
45 
46  };
47 }
48 
Definition: VizForces.hpp:21