Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Just the interface for a combined gripper+manipulator. #11320

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions examples/manipulation_station/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,17 @@ drake_cc_library(
],
)

drake_cc_library(
name = "combined_arm_and_gripper_model",
hdrs = [
"combined_arm_and_gripper_model.h",
],
visibility = ["//visibility:public"],
deps = [
"//multibody/tree",
],
)

drake_cc_binary(
name = "mock_station_simulation",
srcs = [
Expand Down
87 changes: 87 additions & 0 deletions examples/manipulation_station/combined_arm_and_gripper_model.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#pragma once

#include "drake/common/eigen_types.h"
#include "drake/multibody/tree/multibody_tree_indexes.h"
#include "drake/systems/framework/context.h"
#include "drake/systems/framework/diagram.h"

namespace drake {

namespace systems {
template <typename T>
class DiagramBuilder;
}

namespace multibody {
template <typename T>
class MultibodyPlant;
}

namespace examples {
namespace manipulation_station {

/**
* A virtual class for adding a combined arm/gripper model and its
* controller to a Diagram and querying aspects of that model.
*/
template <typename T>
class CombinedArmAndGripperModel {
public:
explicit CombinedArmAndGripperModel(
multibody::MultibodyPlant<T>* plant) : plant_(plant) {}
virtual ~CombinedArmAndGripperModel() {}

/// Gets the number of joints in the gripper.
virtual int num_gripper_joints() const = 0;

/// Gets the gripper generalized positions.
virtual VectorX<T> GetGripperPositions(
const systems::Context<T>& plant_context) const = 0;

/// Sets the gripper generalized positions to the default "open" position.
virtual void SetGripperPositionsToDefaultOpen(
const systems::Context<T>& plant_context,
systems::State<T>* plant_state) const = 0;

/// Sets the gripper generalized positions.
virtual void SetGripperPositions(
const systems::Context<T>& plant_context,
const Eigen::Ref<const VectorX<T>>& q,
systems::State<T>* plant_state) const = 0;

/// Gets the gripper generalized velocities.
virtual VectorX<T> GetGripperVelocities(
const systems::Context<T>& plant_context) const = 0;

/// Sets the gripper generalized velocities.
virtual void SetGripperVelocities(
const systems::Context<T>& plant_context,
const Eigen::Ref<const VectorX<T>>& v,
systems::State<T>* plant_state) const = 0;

/// This method adds the arm and gripper models to the internal plant.
virtual AddRobotModelToMultibodyPlant() = 0;

/// This method builds the control diagram for the arm and gripper
/// and adds it to the given builder for a Diagram.
virtual void BuildControlDiagram(systems::DiagramBuilder<T>* builder) = 0;

/// Gets a reference to the plant used for control.
virtual const multibody::MultibodyPlant<T>& get_controller_plant() const = 0;

/// Gets the model instance for the arm in the internal plant.
virtual multibody::ModelInstanceIndex arm_model_instance() const = 0;

/// Gets the model instance for the gripper in the internal plant.
virtual multibody::ModelInstanceIndex gripper_model_instance() const = 0;

protected:
// The MultibodyPlant holding the robot model (and possibly other models as
// well).
multibody::MultibodyPlant<T>* plant_{nullptr};
};

} // namespace manipulation_station
} // namespace examples
} // namespace drake