Skip to content

Commit

Permalink
Remove deprecated methods (2019-07) (RobotLocomotion#11757)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwnimmer-tri authored Jul 1, 2019
1 parent d15d147 commit 3106f05
Show file tree
Hide file tree
Showing 30 changed files with 13 additions and 713 deletions.
9 changes: 1 addition & 8 deletions bindings/pydrake/math_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void DoScalarDependentDefinitions(py::module m, T) {
const char* doc_iso3_deprecation =
"DO NOT USE!. We only offer this API for backwards compatibility with "
"Isometry3 and it will be deprecated soon with the resolution of "
"#9865. This will be removed on or around 2019-07-01.";
"#9865. This will be removed on or around 2019-08-01.";

constexpr auto& doc = pydrake_doc.drake.math;
{
Expand Down Expand Up @@ -95,13 +95,6 @@ void DoScalarDependentDefinitions(py::module m, T) {
return *self * p_BoQ_B;
},
py::arg("p_BoQ_B"), cls_doc.operator_mul.doc_1args_p_BoQ_B)
.def("multiply",
[doc_iso3_deprecation](
const RigidTransform<T>* self, const Isometry3<T>& other) {
WarnDeprecated(doc_iso3_deprecation);
return *self * RigidTransform<T>(other);
},
py::arg("other"), doc_iso3_deprecation)
.def("matrix", &RigidTransform<T>::matrix, doc_iso3_deprecation)
.def("linear", &RigidTransform<T>::linear, py_reference_internal,
doc_iso3_deprecation);
Expand Down
25 changes: 2 additions & 23 deletions bindings/pydrake/multibody/plant_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,7 @@ void DoScalarDependentDefinitions(py::module m, T) {
const CoulombFriction<double>&>(
&Class::RegisterCollisionGeometry),
py::arg("body"), py::arg("X_BG"), py::arg("shape"), py::arg("name"),
py::arg("coulomb_friction"),
cls_doc.RegisterCollisionGeometry
.doc_5args_body_X_BG_shape_name_coulomb_friction)
py::arg("coulomb_friction"), cls_doc.RegisterCollisionGeometry.doc)
.def("RegisterCollisionGeometry",
[](Class* self, const Body<T>& body,
const RigidTransform<double>& X_BG,
Expand All @@ -602,26 +600,7 @@ void DoScalarDependentDefinitions(py::module m, T) {
},
py::arg("body"), py::arg("X_BG"), py::arg("shape"), py::arg("name"),
py::arg("coulomb_friction"), py::arg("scene_graph"),
(std::string("(Deprecated.) ") +
cls_doc.RegisterCollisionGeometry
.doc_5args_body_X_BG_shape_name_coulomb_friction)
.c_str())
.def("RegisterCollisionGeometry",
[](Class* self, const Body<T>& body, const Isometry3<double>& X_BG,
const geometry::Shape& shape, const std::string& name,
const CoulombFriction<double>& coulomb_friction,
geometry::SceneGraph<T>* scene_graph) {
WarnDeprecated(doc_iso3_deprecation);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
return self->RegisterCollisionGeometry(body,
RigidTransform<double>(X_BG), shape, name, coulomb_friction,
scene_graph);
#pragma GCC diagnostic pop
},
py::arg("body"), py::arg("X_BG"), py::arg("shape"), py::arg("name"),
py::arg("coulomb_friction"), py::arg("scene_graph") = nullptr,
doc_iso3_deprecation)
cls_doc.RegisterCollisionGeometry.doc_deprecated)
.def("get_source_id", &Class::get_source_id, cls_doc.get_source_id.doc)
.def("get_geometry_query_input_port",
&Class::get_geometry_query_input_port, py_reference_internal,
Expand Down
66 changes: 0 additions & 66 deletions bindings/pydrake/systems/framework_py_semantics.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,6 @@ void DefineFrameworkPySemantics(py::module m) {
// Bindings for Context methods inherited from ContextBase.
.def("num_input_ports", &Context<T>::num_input_ports,
doc.ContextBase.num_input_ports.doc)
.def("get_num_input_ports",
[](const Context<T>* self) {
WarnDeprecated(
"Use num_input_ports() instead. Will be removed on or after "
"2019-07-01.");
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
self->get_num_input_ports();
#pragma GCC diagnostic pop
},
doc.ContextBase.get_num_input_ports.doc_deprecated)
.def("num_output_ports", &Context<T>::num_output_ports,
doc.ContextBase.num_output_ports.doc)
// TODO(russt): Add remaining methods from ContextBase here.
Expand Down Expand Up @@ -227,28 +216,6 @@ void DefineFrameworkPySemantics(py::module m) {
.def("get_abstract_parameter", &Context<T>::get_abstract_parameter,
py::arg("index"), py_reference_internal,
doc.Context.get_numeric_parameter.doc)
.def("get_num_discrete_state_groups",
[](const Context<T>* self) {
WarnDeprecated(
"Use num_discrete_state_groups() instead. Will be removed "
"on or after 2019-07-01.");
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
self->get_num_discrete_state_groups();
#pragma GCC diagnostic pop
},
doc.Context.get_num_discrete_state_groups.doc_deprecated)
.def("get_num_abstract_states",
[](const Context<T>* self) {
WarnDeprecated(
"Use num_abstract_states() instead. Will be removed on or "
"after 2019-07-01.");
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
self->get_num_abstract_states();
#pragma GCC diagnostic pop
},
doc.Context.get_num_abstract_states.doc_deprecated)
// Bindings for the Context methods in the Doxygen group titled
// "Methods for changing locally-stored values", placed in the same
// order as the header file.
Expand Down Expand Up @@ -298,28 +265,6 @@ void DefineFrameworkPySemantics(py::module m) {
doc.Context.FixInputPort.doc_2args_index_data)
.def("SetAccuracy", &Context<T>::SetAccuracy, py::arg("accuracy"),
doc.Context.SetAccuracy.doc)
.def("set_time",
[](Context<T>* self, const T& time) {
WarnDeprecated(
"Use SetTime() instead. Will be removed on or after "
"2019-07-01.");
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
self->set_time(time);
#pragma GCC diagnostic pop
},
doc.Context.set_time.doc_deprecated)
.def("set_accuracy",
[](Context<T>* self, const optional<double>& accuracy) {
WarnDeprecated(
"Use SetAccuracy() instead. Will be removed on or after "
"2019-07-01.");
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
self->set_accuracy(accuracy);
#pragma GCC diagnostic pop
},
doc.Context.set_accuracy.doc_deprecated)
// Bindings for the Context methods in the Doxygen group titled
// "Dangerous methods for changing locally-stored values", placed in the
// same order as the header file.
Expand Down Expand Up @@ -498,17 +443,6 @@ void DefineFrameworkPySemantics(py::module m) {
system_output
.def("num_ports", &SystemOutput<T>::num_ports,
doc.SystemOutput.num_ports.doc)
.def("get_num_ports",
[](const SystemOutput<T>* self) {
WarnDeprecated(
"Use num_ports() instead. Will be removed on or after "
"2019-07-01.");
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
self->get_num_ports();
#pragma GCC diagnostic pop
},
doc.SystemOutput.get_num_ports.doc_deprecated)
.def("get_data", &SystemOutput<T>::get_data, py_reference_internal,
doc.SystemOutput.get_data.doc)
.def("get_vector_data", &SystemOutput<T>::get_vector_data,
Expand Down
26 changes: 2 additions & 24 deletions bindings/pydrake/systems/framework_py_systems.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ namespace {

// TODO(eric.cousineau): Remove `*DeprecatedProtectedAlias*` cruft and
// replace `PYDRAKE_TRY_PROTECTED_OVERLOAD` with `PYBIND11_OVERLOAD` once
// deprecated methods are removed (on or around 2019-07-01).
// deprecated methods are removed (on or around 2019-08-01).

// Generates deprecation message pursuant to #9651.
std::string DeprecatedProtectedAliasMessage(
std::string name, std::string verb) {
return fmt::format(
"'_{0}' is deprecated and will be removed on or around 2019-07-01. "
"'_{0}' is deprecated and will be removed on or around 2019-08-01. "
"Please {1} '{0}' instead.",
name, verb);
}
Expand Down Expand Up @@ -358,35 +358,13 @@ struct Impl {
// Topology.
.def("num_input_ports", &System<T>::num_input_ports,
doc.SystemBase.num_input_ports.doc)
.def("get_num_input_ports",
[](const System<T>* self) {
WarnDeprecated(
"Use num_input_ports() instead. Will be removed on or after "
"2019-07-01.");
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
self->get_num_input_ports();
#pragma GCC diagnostic pop
},
doc.SystemBase.get_num_input_ports.doc_deprecated)
.def("get_input_port", &System<T>::get_input_port,
py_reference_internal, py::arg("port_index"),
doc.System.get_input_port.doc)
.def("GetInputPort", &System<T>::GetInputPort, py_reference_internal,
py::arg("port_name"), doc.System.GetInputPort.doc)
.def("num_output_ports", &System<T>::num_output_ports,
doc.SystemBase.num_output_ports.doc)
.def("get_num_output_ports",
[](const System<T>* self) {
WarnDeprecated(
"Use num_output_ports() instead. Will be removed on or "
"after 2019-07-01.");
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
self->get_num_output_ports();
#pragma GCC diagnostic pop
},
doc.SystemBase.get_num_output_ports.doc_deprecated)
.def("get_output_port", &System<T>::get_output_port,
py_reference_internal, py::arg("port_index"),
doc.System.get_output_port.doc)
Expand Down
6 changes: 3 additions & 3 deletions bindings/pydrake/systems/framework_py_values.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ void DefineFrameworkPyValues(py::module m) {
.def("SetFrom", &AbstractValue::SetFrom,
pydrake_doc.drake.AbstractValue.SetFrom.doc)
.def("get_value", abstract_stub("get_value"),
pydrake_doc.drake.AbstractValue.GetValue.doc)
pydrake_doc.drake.AbstractValue.get_value.doc)
.def("get_mutable_value", abstract_stub("get_mutable_value"),
pydrake_doc.drake.AbstractValue.GetMutableValue.doc)
pydrake_doc.drake.AbstractValue.get_mutable_value.doc)
.def("set_value", abstract_stub("set_value"),
pydrake_doc.drake.AbstractValue.SetValue.doc);
pydrake_doc.drake.AbstractValue.set_value.doc);

// Add value instantiations for nominal data types. Types that require more
// pizazz are listed below.
Expand Down
12 changes: 0 additions & 12 deletions bindings/pydrake/systems/test/custom_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,14 @@ def _create_adder_system(self):

def _fix_adder_inputs(self, context):
self.assertEqual(context.num_input_ports(), 2)
with catch_drake_warnings(expected_count=1):
context.get_num_input_ports()
context.FixInputPort(0, BasicVector([1, 2, 3]))
context.FixInputPort(1, BasicVector([4, 5, 6]))

def test_diagram_adder(self):
system = CustomDiagram(2, 3)
self.assertEqual(system.num_input_ports(), 2)
with catch_drake_warnings(expected_count=1):
system.get_num_input_ports()
self.assertEqual(system.get_input_port(0).size(), 3)
self.assertEqual(system.num_output_ports(), 1)
with catch_drake_warnings(expected_count=1):
system.get_num_output_ports()
self.assertEqual(system.get_output_port(0).size(), 3)

def test_adder_execution(self):
Expand Down Expand Up @@ -511,8 +505,6 @@ def __init__(self):
context.get_continuous_state_vector() is
context.get_mutable_continuous_state_vector())
self.assertEqual(context.num_discrete_state_groups(), 1)
with catch_drake_warnings(expected_count=1):
context.get_num_discrete_state_groups()
self.assertTrue(
context.get_discrete_state_vector() is
context.get_mutable_discrete_state_vector())
Expand All @@ -529,8 +521,6 @@ def __init__(self):
context.get_mutable_discrete_state(0) is
context.get_mutable_discrete_state().get_vector(0))
self.assertEqual(context.num_abstract_states(), 1)
with catch_drake_warnings(expected_count=1):
context.get_num_abstract_states()
self.assertTrue(
context.get_abstract_state() is
context.get_mutable_abstract_state())
Expand Down Expand Up @@ -669,8 +659,6 @@ def DoCalcAbstractOutput(self, context, y_data):
context.FixInputPort(0, AbstractValue.Make(expected_input_value))
output = system.AllocateOutput()
self.assertEqual(output.num_ports(), 1)
with catch_drake_warnings(expected_count=1):
output.get_num_ports()
system.CalcOutput(context, output)
value = output.get_data(0)
self.assertEqual(value.get_value(), expected_output_value)
Expand Down
4 changes: 0 additions & 4 deletions bindings/pydrake/systems/test/general_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,8 @@ def check_output(context):

# Create simulator specifying context.
context = system.CreateDefaultContext()
with catch_drake_warnings(expected_count=1):
context.set_time(0.)
context.SetTime(0.)

with catch_drake_warnings(expected_count=1):
context.set_accuracy(1e-4)
context.SetAccuracy(1e-4)
self.assertEqual(context.get_accuracy(), 1e-4)

Expand Down
40 changes: 0 additions & 40 deletions common/test/value_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,6 @@ GTEST_TEST(ValueTest, MaybeGetValue) {

ASSERT_NE(string_value->maybe_get_value<std::string>(), nullptr);
EXPECT_EQ(*string_value->maybe_get_value<std::string>(), "hello");

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
EXPECT_EQ(double_value->MaybeGetValue<std::string>(), nullptr);
EXPECT_EQ(string_value->MaybeGetValue<double>(), nullptr);

ASSERT_NE(double_value->MaybeGetValue<double>(), nullptr);
EXPECT_EQ(*double_value->MaybeGetValue<double>(), 3.);

ASSERT_NE(string_value->MaybeGetValue<std::string>(), nullptr);
EXPECT_EQ(*string_value->MaybeGetValue<std::string>(), "hello");
#pragma GCC diagnostic pop
}

TYPED_TEST(TypedValueTest, Access) {
Expand All @@ -219,14 +207,6 @@ TYPED_TEST(TypedValueTest, Access) {
EXPECT_EQ(3, erased.get_value<T>());
ASSERT_NE(erased.maybe_get_value<T>(), nullptr);
EXPECT_EQ(3, *erased.maybe_get_value<T>());

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
EXPECT_EQ(3, erased.GetValue<T>());
EXPECT_EQ(3, erased.GetValueOrThrow<T>());
ASSERT_NE(erased.MaybeGetValue<T>(), nullptr);
EXPECT_EQ(3, *erased.MaybeGetValue<T>());
#pragma GCC diagnostic pop
}

TYPED_TEST(TypedValueTest, Clone) {
Expand All @@ -248,18 +228,6 @@ TYPED_TEST(TypedValueTest, Mutation) {
EXPECT_EQ(5, erased.get_value<T>());
erased.SetFrom(Value<T>(6));
EXPECT_EQ(6, erased.get_value<T>());

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
erased.SetValue<T>(T{7});
EXPECT_EQ(7, erased.GetValue<T>());
erased.SetValueOrThrow<T>(T{8});
EXPECT_EQ(8, erased.GetValue<T>());
erased.SetFrom(Value<T>(9));
EXPECT_EQ(9, erased.GetValue<T>());
erased.SetFromOrThrow(Value<T>(10));
EXPECT_EQ(10, erased.GetValue<T>());
#pragma GCC diagnostic pop
}

TYPED_TEST(TypedValueTest, BadCast) {
Expand All @@ -271,14 +239,6 @@ TYPED_TEST(TypedValueTest, BadCast) {
EXPECT_THROW(erased.get_mutable_value<T>(), std::logic_error);
EXPECT_THROW(erased.set_value<T>(T{3}), std::logic_error);
EXPECT_THROW(erased.SetFrom(Value<T>(2)), std::logic_error);

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
EXPECT_THROW(erased.GetValueOrThrow<T>(), std::logic_error);
EXPECT_THROW(erased.GetMutableValueOrThrow<T>(), std::logic_error);
EXPECT_THROW(erased.SetValueOrThrow<T>(T{3}), std::logic_error);
EXPECT_THROW(erased.SetFromOrThrow(Value<T>(2)), std::logic_error);
#pragma GCC diagnostic pop
}

class PrintInterface {
Expand Down
Loading

0 comments on commit 3106f05

Please sign in to comment.