28 from controller_manager_msgs.msg 
import ControllerState 
as CtrlState
    29 from controller_manager_msgs.msg 
import HardwareInterfaceResources
    33     CtrlState(name=
'foo_controller',
    37                   HardwareInterfaceResources(
    38                       hardware_interface=
'hardware_interface::FooInterface',
    39                       resources=[
'one', 
'two', 
'three'])
    41     CtrlState(name=
'bar_controller',
    45                   HardwareInterfaceResources(
    46                       hardware_interface=
'hardware_interface::BarInterface',
    49     CtrlState(name=
'foobar_controller',
    51               type=
'foobar_base/foobar',
    53                   HardwareInterfaceResources(
    54                       hardware_interface=
'hardware_interface::FooBarInterface',
    57     CtrlState(name=
'foobaz_controller',
    59               type=
'foobaz_base/foobaz',
    61                   HardwareInterfaceResources(
    62                       hardware_interface=
'hardware_interface::FooInterface',
    64                   HardwareInterfaceResources(
    65                       hardware_interface=
'hardware_interface::BazInterface',
    66                       resources=[
'one', 
'two'])
    73     assert(
not filter_by_name(ctrl_list, 
'null', match_substring=
False))
    74     assert(
not filter_by_name(ctrl_list, 
'null', match_substring=
True))
    77     out = filter_by_name(ctrl_list, 
'foo_controller')
    79     assert(out[0].name == 
'foo_controller')
    82     out = filter_by_name(ctrl_list, 
'foo_controller', match_substring=
True)
    84     assert(out[0].name == 
'foo_controller')
    86     out = filter_by_name(ctrl_list, 
'foo', match_substring=
True)
    88     assert(out[0].name == 
'foo_controller')
    89     assert(out[1].name == 
'foobar_controller')
    90     assert(out[2].name == 
'foobaz_controller')
    95     assert(
not filter_by_state(ctrl_list, 
'null', match_substring=
False))
    96     assert(
not filter_by_state(ctrl_list, 
'null', match_substring=
True))
    99     out = filter_by_state(ctrl_list, 
'stopped')
   100     assert(1 == len(out))
   101     assert(out[0].name == 
'foobar_controller')
   104     out = filter_by_state(ctrl_list, 
'stopped', match_substring=
True)
   105     assert(1 == len(out))
   106     assert(out[0].name == 
'foobar_controller')
   108     out = filter_by_state(ctrl_list, 
'run', match_substring=
True)
   109     assert(3 == len(out))
   110     assert(out[0].name == 
'foo_controller')
   111     assert(out[1].name == 
'bar_controller')
   112     assert(out[2].name == 
'foobaz_controller')
   117     assert(
not filter_by_type(ctrl_list, 
'null', match_substring=
False))
   118     assert(
not filter_by_type(ctrl_list, 
'null', match_substring=
True))
   121     out = filter_by_type(ctrl_list, 
'foo_base/foo')
   122     assert(1 == len(out))
   123     assert(out[0].name == 
'foo_controller')
   126     out = filter_by_type(ctrl_list, 
'foo_base/foo', match_substring=
True)
   127     assert(1 == len(out))
   128     assert(out[0].name == 
'foo_controller')
   130     out = filter_by_type(ctrl_list, 
'foo', match_substring=
True)
   131     assert(3 == len(out))
   132     assert(out[0].name == 
'foo_controller')
   133     assert(out[1].name == 
'foobar_controller')
   134     assert(out[2].name == 
'foobaz_controller')
   139     assert(
not filter_by_hardware_interface(ctrl_list,
   141                                             match_substring=
False))
   142     assert(
not filter_by_hardware_interface(ctrl_list,
   144                                             match_substring=
True))
   147     out = filter_by_hardware_interface(ctrl_list,
   148                                        'hardware_interface::FooInterface')
   149     assert(2 == len(out))
   150     assert(out[0].name == 
'foo_controller')
   151     assert(out[1].name == 
'foobaz_controller')
   154     out = filter_by_hardware_interface(ctrl_list,
   155                                        'hardware_interface::BazInterface',
   156                                        match_substring=
True)
   157     assert(1 == len(out))
   158     assert(out[0].name == 
'foobaz_controller')
   160     out = filter_by_hardware_interface(ctrl_list,
   162                                        match_substring=
True)
   163     assert(1 == len(out))
   164     assert(out[0].name == 
'foobaz_controller')
   169     assert(
not filter_by_resources(ctrl_list, [
'null'], match_any=
False))
   170     assert(
not filter_by_resources(ctrl_list, [
'null'], match_any=
True))
   173     assert(
not filter_by_resources(
   175         hardware_interface=
'hardware_interface::FooInterface',
   179     assert(
not filter_by_resources(
   181         hardware_interface=
'hardware_interface::FooInterface',
   187     assert(
not filter_by_resources(
   189         hardware_interface=
'hardware_interface::FooInterface',
   193     assert(
not filter_by_resources(
   195         hardware_interface=
'hardware_interface::FooInterface',
   200     res = ctrl_list[0].claimed_resources[0].resources
   201     out = filter_by_resources(ctrl_list, res)
   202     assert(1 == len(out))
   203     assert(out[0].name == 
'foo_controller')
   206     out = filter_by_resources(
   208         hardware_interface=
'hardware_interface::FooInterface',
   210     assert(1 == len(out))
   211     assert(out[0].name == 
'foo_controller')
   213     out = filter_by_resources(
   215         hardware_interface=
'hardware_interface::FooInterface',
   217     assert(2 == len(out))
   218     assert(out[0].name == 
'foo_controller')
   219     assert(out[1].name == 
'foobaz_controller')
   222     out = filter_by_resources(ctrl_list, res, match_any=
True)
   223     assert(3 == len(out))
   224     assert(out[0].name == 
'foo_controller')
   225     assert(out[1].name == 
'foobar_controller')
   226     assert(out[2].name == 
'foobaz_controller')
   229     out = filter_by_resources(
   231         hardware_interface=
'hardware_interface::BazInterface',
   234     assert(1 == len(out))
   235     assert(out[0].name == 
'foobaz_controller')
 def filter_by_state_test()
 
def filter_by_type_test()
 
def filter_by_name_test()
 
def filter_by_resources_test()
 
def filter_by_hardware_interface_test()