@@ -166,3 +166,29 @@ TEST_F(TestSlidingModeControl, control_sign_opposes_surface)
166166
167167 EXPECT_LT (sDot , 0 .0f );
168168}
169+
170+ TEST_F (TestSlidingModeControl, reference_tracking_acts_on_error)
171+ {
172+ math::Vector<float , 2 > x{ { 1 .2f }, { 0 .3f } };
173+ math::Vector<float , 2 > reference{ { 0 .4f }, { -0 .1f } };
174+ math::Vector<float , 2 > error{ { x.at (0 , 0 ) - reference.at (0 , 0 ) }, { x.at (1 , 0 ) - reference.at (1 , 0 ) } };
175+
176+ auto uRef = smc.ComputeControl (x, reference);
177+ auto uErr = smc.ComputeControl (error);
178+
179+ EXPECT_NEAR (uRef.at (0 , 0 ), uErr.at (0 , 0 ), math::Tolerance<float >());
180+ }
181+
182+ TEST_F (TestSlidingModeControl, set_boundary_layer_matches_constructed_phi)
183+ {
184+ math::Vector<float , 2 > x{ { 0 .02f }, { -0 .015f } };
185+ const float phi2{ 0 .20f };
186+
187+ robust_control::SlidingModeControl<float , 2 , 1 > reference{ plant, S, K, phi2 };
188+ smc.SetBoundaryLayer (phi2);
189+
190+ auto uSet = smc.ComputeControl (x);
191+ auto uRef = reference.ComputeControl (x);
192+
193+ EXPECT_NEAR (uSet.at (0 , 0 ), uRef.at (0 , 0 ), math::Tolerance<float >());
194+ }
0 commit comments