Skip to content

Commit

Permalink
systems: Move spring_mass_system to a test utility (RobotLocomotion#1…
Browse files Browse the repository at this point in the history
…4284)

This allows us to remove the awkward and misleading drake/system/plants
directory.

This is a breaking change for anyone who was using this plant via the
precompiled binaries.
  • Loading branch information
jwnimmer-tri authored Nov 4, 2020
1 parent 96e0cc0 commit 4cdc131
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 60 deletions.
8 changes: 4 additions & 4 deletions systems/analysis/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ drake_cc_googletest(
"//common/test_utilities:expect_throws_message",
"//systems/analysis/test_utilities:implicit_integrator_test",
"//systems/analysis/test_utilities:quadratic_scalar_system",
"//systems/plants/spring_mass_system",
"//systems/analysis/test_utilities:spring_mass_system",
],
)

Expand All @@ -516,7 +516,7 @@ drake_cc_googletest(
deps = [
":implicit_integrator",
"//common/test_utilities:expect_no_throw",
"//systems/plants/spring_mass_system",
"//systems/analysis/test_utilities:spring_mass_system",
],
)

Expand All @@ -525,7 +525,7 @@ drake_cc_googletest(
deps = [
":integrator_base",
"//common/test_utilities:expect_throws_message",
"//systems/plants/spring_mass_system",
"//systems/analysis/test_utilities:spring_mass_system",
],
)

Expand All @@ -542,7 +542,7 @@ drake_cc_googletest(
"//systems/analysis/test_utilities:implicit_integrator_test",
"//systems/analysis/test_utilities:linear_scalar_system",
"//systems/analysis/test_utilities:quadratic_scalar_system",
"//systems/plants/spring_mass_system",
"//systems/analysis/test_utilities:spring_mass_system",
],
)

Expand Down
2 changes: 1 addition & 1 deletion systems/analysis/test/implicit_integrator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <gtest/gtest.h>

#include "drake/systems/plants/spring_mass_system/spring_mass_system.h"
#include "drake/systems/analysis/test_utilities/spring_mass_system.h"

using Eigen::VectorXd;

Expand Down
2 changes: 1 addition & 1 deletion systems/analysis/test/integrator_base_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <gtest/gtest.h>

#include "drake/common/test_utilities/expect_throws_message.h"
#include "drake/systems/plants/spring_mass_system/spring_mass_system.h"
#include "drake/systems/analysis/test_utilities/spring_mass_system.h"

namespace drake {
namespace systems {
Expand Down
2 changes: 1 addition & 1 deletion systems/analysis/test/simulator_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
#include "drake/systems/analysis/test_utilities/controlled_spring_mass_system.h"
#include "drake/systems/analysis/test_utilities/logistic_system.h"
#include "drake/systems/analysis/test_utilities/my_spring_mass_system.h"
#include "drake/systems/analysis/test_utilities/spring_mass_system.h"
#include "drake/systems/analysis/test_utilities/stateless_system.h"
#include "drake/systems/framework/diagram_builder.h"
#include "drake/systems/framework/event.h"
#include "drake/systems/plants/spring_mass_system/spring_mass_system.h"
#include "drake/systems/primitives/constant_vector_source.h"
#include "drake/systems/primitives/integrator.h"
#include "drake/systems/primitives/signal_logger.h"
Expand Down
27 changes: 24 additions & 3 deletions systems/analysis/test_utilities/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ drake_cc_package_library(
":quintic_scalar_system",
":robertson_system",
":spring_mass_damper_system",
":spring_mass_system",
":stateless_system",
":stationary_system",
":stiff_double_mass_spring_system",
Expand All @@ -42,9 +43,9 @@ drake_cc_library(
srcs = ["controlled_spring_mass_system.cc"],
hdrs = ["controlled_spring_mass_system.h"],
deps = [
":spring_mass_system",
"//systems/controllers:pid_controller",
"//systems/framework",
"//systems/plants/spring_mass_system",
"//systems/primitives:adder",
"//systems/primitives:constant_vector_source",
"//systems/primitives:demultiplexer",
Expand Down Expand Up @@ -128,7 +129,7 @@ drake_cc_library(
testonly = 1,
hdrs = ["my_spring_mass_system.h"],
deps = [
"//systems/plants/spring_mass_system",
":spring_mass_system",
],
)

Expand Down Expand Up @@ -180,7 +181,27 @@ drake_cc_library(
testonly = 1,
hdrs = ["spring_mass_damper_system.h"],
deps = [
"//systems/plants/spring_mass_system",
":spring_mass_system",
],
)

drake_cc_library(
name = "spring_mass_system",
testonly = 1,
srcs = ["spring_mass_system.cc"],
hdrs = ["spring_mass_system.h"],
deps = [
"//systems/framework:leaf_system",
],
)

drake_cc_googletest(
name = "spring_mass_system_test",
size = "medium",
deps = [
":spring_mass_system",
"//common/test_utilities",
"//systems/framework/test_utilities",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#include "drake/common/default_scalars.h"
#include "drake/common/drake_copyable.h"
#include "drake/systems/analysis/test_utilities/spring_mass_system.h"
#include "drake/systems/controllers/pid_controller.h"
#include "drake/systems/framework/diagram.h"
#include "drake/systems/plants/spring_mass_system/spring_mass_system.h"
#include "drake/systems/primitives/constant_vector_source.h"

namespace drake {
Expand Down
2 changes: 1 addition & 1 deletion systems/analysis/test_utilities/implicit_integrator_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include "drake/systems/analysis/test_utilities/linear_scalar_system.h"
#include "drake/systems/analysis/test_utilities/robertson_system.h"
#include "drake/systems/analysis/test_utilities/spring_mass_damper_system.h"
#include "drake/systems/analysis/test_utilities/spring_mass_system.h"
#include "drake/systems/analysis/test_utilities/stationary_system.h"
#include "drake/systems/analysis/test_utilities/stiff_double_mass_spring_system.h"
#include "drake/systems/plants/spring_mass_system/spring_mass_system.h"

namespace drake {
namespace systems {
Expand Down
2 changes: 1 addition & 1 deletion systems/analysis/test_utilities/my_spring_mass_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <vector>

#include "drake/common/drake_copyable.h"
#include "drake/systems/plants/spring_mass_system/spring_mass_system.h"
#include "drake/systems/analysis/test_utilities/spring_mass_system.h"

namespace drake {
namespace systems {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <limits>
#include <utility>

#include "drake/systems/plants/spring_mass_system/spring_mass_system.h"
#include "drake/systems/analysis/test_utilities/spring_mass_system.h"

// WARNING WARNING WARNING
// This test is currently used only as a stiff system test for implicit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "drake/systems/plants/spring_mass_system/spring_mass_system.h"
#include "drake/systems/analysis/test_utilities/spring_mass_system.h"

#include <utility>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "drake/systems/plants/spring_mass_system/spring_mass_system.h"
#include "drake/systems/analysis/test_utilities/spring_mass_system.h"

#include <memory>

Expand Down
43 changes: 0 additions & 43 deletions systems/plants/spring_mass_system/BUILD.bazel

This file was deleted.

1 change: 0 additions & 1 deletion tools/install/libdrake/build_components.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ LIBDRAKE_COMPONENTS = [
"//systems/framework",
"//systems/lcm",
"//systems/optimization",
"//systems/plants/spring_mass_system",
"//systems/primitives",
"//systems/rendering",
"//systems/sensors",
Expand Down

0 comments on commit 4cdc131

Please sign in to comment.