-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
trigger CommandInjection also in the injection port
Otherwise one won't be able to use the command injection to salvage the vehicle if the 'regular' controllers stop producing commands.
- Loading branch information
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'minitest/spec' | ||
require 'orocos/test/component' | ||
require 'minitest/autorun' | ||
|
||
describe 'auv_control::PIDController' do | ||
include Orocos::Test::Component | ||
|
||
start 'injection', 'auv_control::CommandInjection' => 'injection' | ||
reader 'injection', 'cmd_out', attr_name: 'cmd_out' | ||
writer 'injection', 'cmd_injection', attr_name: 'cmd_injection' | ||
|
||
before do | ||
injection.expected_inputs = Hash[linear: [true, true, false], angular: [false, false, false]] | ||
injection.addCommandInput 'controller', Time.at(0) | ||
injection.configure | ||
injection.start | ||
end | ||
|
||
it "outputs the injected command if it matches the expectations regardless of the other input states" do | ||
injected_cmd = Types.base.commands.LinearAngular6DCommand.new( | ||
time: Time.now, linear: Eigen::Vector3.new(1, 2, 0), angular: Eigen::Vector3.Zero) | ||
|
||
w = injection.cmd_injection.writer | ||
w.write injected_cmd | ||
sample = assert_has_one_new_sample cmd_out | ||
assert_equal 1, sample.linear[0] | ||
assert_equal 2, sample.linear[1] | ||
assert Base.unknown?(sample.linear[2]) | ||
3.times { |i| assert Base.unknown?(sample.angular[i]) } | ||
end | ||
end | ||
|