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

[multibody] Deprecate FrameBase for removal #21891

Merged
merged 1 commit into from
Sep 11, 2024
Merged
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
2 changes: 2 additions & 0 deletions multibody/tree/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ drake_cc_library(
"fixed_offset_frame.cc",
"force_element.cc",
"frame.cc",
"frame_base.cc",
"joint.cc",
"joint_actuator.cc",
"linear_bushing_roll_pitch_yaw.cc",
Expand Down Expand Up @@ -134,6 +135,7 @@ drake_cc_library(
"fixed_offset_frame.h",
"force_element.h",
"frame.h",
"frame_base.h",
"joint.h",
"joint_actuator.h",
"linear_bushing_roll_pitch_yaw.h",
Expand Down
9 changes: 3 additions & 6 deletions multibody/tree/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#include <memory>
#include <optional>
#include <string>
#include <vector>

#include "drake/common/autodiff.h"
#include "drake/common/nice_type_name.h"
#include "drake/multibody/tree/frame_base.h"
#include "drake/multibody/tree/frame_body_pose_cache.h"
#include "drake/multibody/tree/multibody_element.h"
#include "drake/multibody/tree/multibody_tree_indexes.h"
Expand Down Expand Up @@ -50,15 +50,12 @@ template<typename T> class RigidBody;
///
/// @tparam_default_scalar
template <typename T>
class Frame : public MultibodyElement<T> {
class Frame : public FrameBase<T> {
public:
DRAKE_NO_COPY_NO_MOVE_NO_ASSIGN(Frame);

~Frame() override;

/// Returns this %Frame's unique index.
FrameIndex index() const { return this->template index_impl<FrameIndex>(); }

/// Returns a const reference to the body associated to this %Frame.
const RigidBody<T>& body() const {
return body_;
Expand Down Expand Up @@ -566,7 +563,7 @@ class Frame : public MultibodyElement<T> {
explicit Frame(
const std::string& name, const RigidBody<T>& body,
std::optional<ModelInstanceIndex> model_instance = {})
: MultibodyElement<T>(model_instance.value_or(body.model_instance())),
: FrameBase<T>(model_instance.value_or(body.model_instance())),
name_(internal::DeprecateWhenEmptyName(name, "Frame")),
body_(body) {}

Expand Down
15 changes: 15 additions & 0 deletions multibody/tree/frame_base.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "drake/multibody/tree/frame_base.h"

#include "drake/common/default_scalars.h"

namespace drake {
namespace multibody {

template <typename T>
FrameBase<T>::~FrameBase() = default;

} // namespace multibody
} // namespace drake

DRAKE_DEFINE_CLASS_TEMPLATE_INSTANTIATIONS_ON_DEFAULT_SCALARS(
class drake::multibody::FrameBase);
26 changes: 26 additions & 0 deletions multibody/tree/frame_base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#include "drake/multibody/tree/multibody_element.h"
#include "drake/multibody/tree/multibody_tree_indexes.h"

namespace drake {
namespace multibody {

/// %FrameBase is deprecated and will be removed on or after 2025-01-01.
/// @tparam_default_scalar
template <typename T>
class FrameBase : public MultibodyElement<T> {
public:
// TODO(jwnimmer-tri) On 2025-01-01 move this into `class Frame`.
/// Returns this element's unique index.
FrameIndex index() const { return this->template index_impl<FrameIndex>(); }

~FrameBase() override;

protected:
explicit FrameBase(ModelInstanceIndex model_instance)
: MultibodyElement<T>(model_instance) {}
};

} // namespace multibody
} // namespace drake