Class: Orocos::TaskContextBase

Inherits:
Object
  • Object
show all
Includes:
Namespace, PortsSearchable, TaskContextBaseAbstract
Defined in:
lib/orocos/task_context_base.rb

Overview

Base implementation for Orocos::TaskContext

Direct Known Subclasses

Log::TaskContext, ROS::Node

Constant Summary collapse

RUNNING_STATES =
[]

Constants included from Namespace

Namespace::DELIMATOR

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Namespace

#map_to_namespace, #namespace, #namespace=, #same_namespace?, split_name, #split_name, validate_namespace_name, #verify_same_namespace

Methods included from PortsSearchable

#find_all_input_ports, #find_all_output_ports, #find_all_ports, #find_input_port, #find_output_port, #find_port

Methods included from TaskContextBaseAbstract

#attribute, #attribute_names, #operation, #operation_names, #ping, #port, #port_names, #property, #property_names, #rtt_state

Constructor Details

#initialize(name, options = Hash.new) ⇒ TaskContextBase

Returns a new instance of TaskContextBase.

Parameters:

  • name (String)

    The name of the task.

  • options (Hash) (defaults to: Hash.new)

    The options.

Options Hash (options):

  • :process (Orocos::Process)

    The process supporting the task

  • :namespace (String)

    The namespace of the task


301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/orocos/task_context_base.rb', line 301

def initialize(name,options = Hash.new)
    options = Kernel.validate_options options,:namespace,:process,:model

    @ports = Hash.new
    @properties = Hash.new
    @attributes = Hash.new
    @state_queue = Array.new
    @ior = ""

    namespace,@name = split_name(name)
    namespace = if options.has_key?(:namespace)
                      options[:namespace]
                  else
                      namespace
                  end
    self.namespace = namespace
    @process    = options[:process]

    @process ||= Orocos.enum_for(:each_process).
        find do |p|
            p.task_names.any? { |n| n == name }
        end
    if process
        process.register_task(self)
    end

    if options.has_key?(:model)
        self.model = options[:model]
    end

    # Load the model from remote if it is not set yet
    model

    if !@state_symbols
        @state_symbols = []
        @state_symbols[STATE_PRE_OPERATIONAL] = :PRE_OPERATIONAL
        @state_symbols[STATE_STOPPED]         = :STOPPED
        @state_symbols[STATE_RUNNING]         = :RUNNING
        @state_symbols[STATE_RUNTIME_ERROR]   = :RUNTIME_ERROR
        @state_symbols[STATE_EXCEPTION]       = :EXCEPTION
        @state_symbols[STATE_FATAL_ERROR]     = :FATAL_ERROR
        @error_states     = Set.new
        @runtime_states   = Set.new
        @exception_states = Set.new
        @fatal_states     = Set.new
        add_default_states
    end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object

:nodoc:


798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
# File 'lib/orocos/task_context_base.rb', line 798

def method_missing(m, *args) # :nodoc:
    m = m.to_s
    if m =~ /^(\w+)=/
        name = $1
        begin
            return property(name).write(*args)
        rescue Orocos::NotFound
        end

    else
        if has_port?(m)
            if !args.empty?
                raise ArgumentError, "expected zero arguments for #{m}, got #{args.size}"
            end
            return port(m)
        elsif has_operation?(m)
            return operation(m).callop(*args)
        elsif has_property?(m) || has_attribute?(m)
            if !args.empty?
                raise ArgumentError, "expected zero arguments for #{m}, got #{args.size}"
            end
            prop = if has_property?(m) then property(m)
                   else attribute(m)
                   end
            value = prop.read
            if block_given?
                yield(value)
                prop.write(value)
            end
            return value
        end
    end
    super(m.to_sym, *args)
end

Instance Attribute Details

#attributesObject (readonly)

A name => Attribute instance mapping of cached attribute objects


292
293
294
# File 'lib/orocos/task_context_base.rb', line 292

def attributes
  @attributes
end

#configuration_logObject (readonly)

If set, this is a Pocolog::Logfiles object in which the values of properties and attributes should be logged.

Orocos.rb only logs the values that are set from within Ruby. There are no ways to log the values changed from within the task context.


286
287
288
# File 'lib/orocos/task_context_base.rb', line 286

def configuration_log
  @configuration_log
end

#current_stateObject (readonly)

Returns the last-known state


289
290
291
# File 'lib/orocos/task_context_base.rb', line 289

def current_state
  @current_state
end

#iorObject (readonly)

The IOR of this task context


275
276
277
# File 'lib/orocos/task_context_base.rb', line 275

def ior
  @ior
end

#processObject

The underlying process object that represents this node It is non-nil only if this node has been started by orocos.rb


279
280
281
# File 'lib/orocos/task_context_base.rb', line 279

def process
  @process
end

#propertiesObject (readonly)

A name => Property instance mapping of cached properties


295
296
297
# File 'lib/orocos/task_context_base.rb', line 295

def properties
  @properties
end

Class Method Details

.connect_to(task, task2, policy = Hash.new, &block) ⇒ Object

Connects all output ports with the input ports of given task. If one connection is ambiguous or none of the port is connected an exception is raised. All output ports which does not match any input port are ignored

Instead of a task the method can also be called with a port as argument


251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/orocos/task_context_base.rb', line 251

def self.connect_to(task,task2,policy = Hash.new, &block)
    if task2.respond_to? :each_port
        count = 0
        task.each_port do |port|
            next if !port.respond_to? :reader
            if other = task2.find_input_port(port.type,nil)
                port.connect_to other, policy, &block
                count += 1
            end
        end
        if count == 0
            raise NotFound, "#{task.name} has no port matching the ones of #{task2.name}."
        end
    else # assuming task2 is a port
        if port = task.find_output_port(task2.type,nil)
            port.connect_to task2, policy, &block
        else
            raise NotFound, "no port of #{task.name} matches the given port #{task2.name}"
        end
    end
    self
end

.find_one_running(*names) ⇒ Object

Find one running tasks from the provided names. Raises if there is not exactly one


230
231
232
# File 'lib/orocos/task_context_base.rb', line 230

def self.find_one_running(*names)
    Orocos.name_service.find_one_running(*names)
end

.get(options, process = nil) ⇒ Object

:call-seq:

TaskContext.get(name) => task
TaskContext.get(:provides => interface_name) => task

In the first form, returns the TaskContext instance representing the remote task context with the given name.

In the second form, searches for a task context that implements the given interface. This is doable only if orogen has been used to generate the components.

Raises Orocos::NotFound if the task name does not exist, if no task implements the given interface, or if more than one task does implement the required interface


216
217
218
219
220
221
222
223
224
225
226
# File 'lib/orocos/task_context_base.rb', line 216

def self.get(options, process = nil)
    if options.kind_of?(Hash)
        # Right now, the only allowed option is :provides
        options = Kernel.validate_options options, :provides => nil
        return Orocos.name_service.get_provides(options[:provides].to_str)
    else
        raise ArgumentError, 'no task name' if options.nil?
        name = options.to_str
    end
    result = Orocos.name_service.get(name,{:process => process})
end

.get_provides(type) ⇒ Object

Returns a task which provides the type interface.

Use Orocso.name_service.get(:provides => name) instead.


198
199
200
# File 'lib/orocos/task_context_base.rb', line 198

def self.get_provides(type) # :nodoc:
    Orocos.name_service.get_provides(type)
end

.reachable?(task_name) ⇒ Boolean

TODO this is bad performance wise it will load the model and all extensions use the nameservice for the check

Returns true if task_name is a TaskContext object that can be reached

Returns:

  • (Boolean)

240
241
242
# File 'lib/orocos/task_context_base.rb', line 240

def self.reachable?(task_name)
    Orocos.name_service.task_reachable? task_name
end

Instance Method Details

#add_default_statesObject


632
633
634
635
636
637
# File 'lib/orocos/task_context_base.rb', line 632

def add_default_states
    @error_states   << :RUNTIME_ERROR << :FATAL_ERROR << :EXCEPTION
    @runtime_states << :RUNNING << :RUNTIME_ERROR
    @exception_states << :EXCEPTION
    @fatal_states     << :FATAL_ERROR
end

#available_statesObject

Returns an array of symbols that give the tasks' state names from their integer value. This is mostly for internal use.


493
494
495
496
497
# File 'lib/orocos/task_context_base.rb', line 493

def available_states # :nodoc:
    if @states
        return @states
    end
end

#basenameObject


355
356
357
# File 'lib/orocos/task_context_base.rb', line 355

def basename
    @name
end

#connect_to(task, policy = Hash.new) ⇒ Object

Connects all output ports with the input ports of given task. If one connection is ambiguous or none of the port is connected an exception is raised. All output ports which does not match any input port are ignored

Instead of a task the method can also be called with a port as argument


607
608
609
# File 'lib/orocos/task_context_base.rb', line 607

def connect_to(task,policy = Hash.new)
    TaskContextBase.connect_to(self,task,policy)
end

#docObject

Returns a documentation string describing the task If no documentation is available it returns nil


580
581
582
# File 'lib/orocos/task_context_base.rb', line 580

def doc
    model.doc if model
end

#doc?Boolean

Returns true if a documentation about the task is available otherwise it returns false

Returns:

  • (Boolean)

443
444
445
# File 'lib/orocos/task_context_base.rb', line 443

def doc?
    (doc && !doc.empty?)
end

#each_attribute(&block) ⇒ Object

call-seq:

task.each_attribute { |a| ... } => task

Enumerates the attributes that are available on this task, as instances of Orocos::Attribute


394
395
396
397
398
399
400
401
402
403
# File 'lib/orocos/task_context_base.rb', line 394

def each_attribute(&block)
    if !block_given?
        return enum_for(:each_attribute)
    end

    names = attribute_names
    names.each do |name|
        yield(attribute(name))
    end
end

#each_input_portObject

call-seq:

task.each_input_port { |p| ... } => task

Enumerates the input ports that are available on this task, as instances of Orocos::InputPort


545
546
547
548
549
# File 'lib/orocos/task_context_base.rb', line 545

def each_input_port
    each_port do |p|
        yield(p) if p.respond_to?(:writer)
    end
end

#each_operation(&block) ⇒ Object

call-seq:

task.each_operation { |a| ... } => task

Enumerates the operation that are available on this task, as instances of Orocos::Operation


364
365
366
367
368
369
370
371
372
# File 'lib/orocos/task_context_base.rb', line 364

def each_operation(&block)
    if !block_given?
        return enum_for(:each_operation)
    end
    names = operation_names
    names.each do |name|
        yield(operation(name))
    end
end

#each_output_portObject

call-seq:

task.each_output_port { |p| ... } => task

Enumerates the input ports that are available on this task, as instances of Orocos::OutputPort


556
557
558
559
560
# File 'lib/orocos/task_context_base.rb', line 556

def each_output_port
    each_port do |p|
        yield(p) if p.respond_to?(:reader)
    end
end

#each_port(&block) ⇒ Object

call-seq:

task.each_port { |p| ... } => task

Enumerates the ports that are available on this task, as instances of either Orocos::InputPort or Orocos::OutputPort


410
411
412
413
414
415
416
417
418
419
# File 'lib/orocos/task_context_base.rb', line 410

def each_port(&block)
    if !block_given?
        return enum_for(:each_port)
    end

    port_names.each do |name|
        yield(port(name))
    end
    self
end

#each_property(&block) ⇒ Object

call-seq:

task.each_property { |a| ... } => task

Enumerates the properties that are available on this task, as instances of Orocos::Attribute


379
380
381
382
383
384
385
386
387
# File 'lib/orocos/task_context_base.rb', line 379

def each_property(&block)
    if !block_given?
        return enum_for(:each_property)
    end
    names = property_names
    names.each do |name|
        yield(property(name))
    end
end

#error?Boolean

Returns true if the task is in an error state (runtime or fatal)

Returns:

  • (Boolean)

472
473
474
# File 'lib/orocos/task_context_base.rb', line 472

def error?
    error_state?(peek_current_state)
end

#error_state?(sym) ⇒ Boolean

True if the given symbol is the name of an error state

Returns:

  • (Boolean)

458
# File 'lib/orocos/task_context_base.rb', line 458

def error_state?(sym); @error_states.include?(sym) end

#exception?Boolean

Returns true if the task is in an exceptional state

Returns:

  • (Boolean)

483
484
485
# File 'lib/orocos/task_context_base.rb', line 483

def exception?
    exception_state?(peek_current_state)
end

#exception_state?(sym) ⇒ Boolean

True if the given symbol is the name of an exception state

Returns:

  • (Boolean)

460
# File 'lib/orocos/task_context_base.rb', line 460

def exception_state?(sym); @exception_states.include?(sym) end

#fatal_error?Boolean

Returns true if the task is in a fatal error state

Returns:

  • (Boolean)

487
488
489
# File 'lib/orocos/task_context_base.rb', line 487

def fatal_error?
    fatal_error_state?(peek_current_state)
end

#fatal_error_state?(sym) ⇒ Boolean

True if the given symbol is the name of a fatal error state

Returns:

  • (Boolean)

462
# File 'lib/orocos/task_context_base.rb', line 462

def fatal_error_state?(sym); @fatal_states.include?(sym) end

#has_attribute?(name) ⇒ Boolean

Returns true if name is the name of a attribute on this task context

Returns:

  • (Boolean)

422
423
424
# File 'lib/orocos/task_context_base.rb', line 422

def has_attribute?(name)
    attribute_names.include?(name.to_str)
end

#has_operation?(name) ⇒ Boolean

Returns true if this task context has a command with the given name

Returns:

  • (Boolean)

432
433
434
# File 'lib/orocos/task_context_base.rb', line 432

def has_operation?(name)
    operation_names.include?(name.to_str)
end

#has_port?(name) ⇒ Boolean

Returns true if this task context has a port with the given name

Returns:

  • (Boolean)

437
438
439
# File 'lib/orocos/task_context_base.rb', line 437

def has_port?(name)
    port_names.include?(name.to_str)
end

#has_property?(name) ⇒ Boolean

Returns true if this task context has either a property or an attribute with the given name

Returns:

  • (Boolean)

427
428
429
# File 'lib/orocos/task_context_base.rb', line 427

def has_property?(name)
    property_names.include?(name.to_str)
end

#implements?(class_name) ⇒ Boolean

True if this task's model is a subclass of the provided class name

This is available only if the deployment in which this task context runs has been generated by orogen.

Returns:

  • (Boolean)

681
682
683
# File 'lib/orocos/task_context_base.rb', line 681

def implements?(class_name)
    model && model.implements?(class_name)
end

#infoOroGen::Spec::TaskDeployment

Returns the Orogen specification object for this task instance. This is available only if the deployment in which this task context runs has been generated by orogen and this deployment has been started by this Ruby instance

To get the Orogen specification for the task context itself (an OroGen::Spec::TaskContext instance), use #model.

Returns:

  • (OroGen::Spec::TaskDeployment)

See Also:


572
573
574
575
576
# File 'lib/orocos/task_context_base.rb', line 572

def info
    if process
        @info ||= process.orogen.task_activities.find { |act| act.name == name }
    end
end

#input_port(name) ⇒ Object


517
518
519
520
521
522
523
524
# File 'lib/orocos/task_context_base.rb', line 517

def input_port(name)
    p = port(name)
    if p.respond_to?(:writer)
        return p
    else
        raise InterfaceObjectNotFound.new(self, name), "#{name} is an output port of #{self.name}, was expecting an input port"
    end
end

#input_port_model(name) ⇒ OroGen::Spec::InputPort?

Resolves the model of a port

Returns:

  • (OroGen::Spec::InputPort, nil)

698
699
700
701
702
703
# File 'lib/orocos/task_context_base.rb', line 698

def input_port_model(name)
    if port_model = model.each_input_port.find { |p| p.name == name }
        port_model
    else model.find_dynamic_input_ports(name, nil).first
    end
end

#inspectObject


615
616
617
618
619
# File 'lib/orocos/task_context_base.rb', line 615

def inspect
    "#<#{self.class}: #{self.class.name}/#{name} state=#{state}>"
rescue Orocos::ComError
    "#<#{self.class}: #{self.class.name}/#{name} state=UNREACHABLE>"
end

#modelOroGen::Spec::TaskContext?

Returns the oroGen model that describes this node.

Returns:

  • (OroGen::Spec::TaskContext, nil)

    the oroGen model that describes this node


667
668
669
670
671
672
673
674
675
# File 'lib/orocos/task_context_base.rb', line 667

def model
    if @model
        @model
    elsif info && info.context
        self.model = info.context
    else
        nil
    end
end

#model=(model) ⇒ Object

load all informations from the model


640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# File 'lib/orocos/task_context_base.rb', line 640

def model=(model)
    if model
        @model = model

        @state_symbols = model.each_state.map { |name, type| name.to_sym }
        @error_states  = model.each_state.
            map { |name, type| name.to_sym if (type == :error || type == :exception || type == :fatal) }.
            compact.to_set
        @exception_states  = model.each_state.
            map { |name, type| name.to_sym if type == :exception }.
            compact.to_set
        @runtime_states = model.each_state.
            map { |name, type| name.to_sym if (type == :error || type == :runtime) }.
            compact.to_set
        @fatal_states = model.each_state.
            map { |name, type| name.to_sym if type == :fatal }.
            compact.to_set

        if ext = Orocos.extension_modules[model.name]
            ext.each { |m_ext| extend(m_ext) }
        end
        add_default_states
    else @model = nil
    end
end

#nameObject

The full name of the task context


351
352
353
# File 'lib/orocos/task_context_base.rb', line 351

def name
    map_to_namespace(@name)
end

#on_localhost?Boolean

True if it is known that this task runs on the local machine

This requires the process handling to be done by orocos.rb (the method checks if the process runs on the local machine)

Returns:

  • (Boolean)

451
452
453
# File 'lib/orocos/task_context_base.rb', line 451

def on_localhost?
    process && process.on_localhost?
end

#output_port(name) ⇒ Object


526
527
528
529
530
531
532
533
# File 'lib/orocos/task_context_base.rb', line 526

def output_port(name)
    p = port(name)
    if p.respond_to?(:reader)
        return p
    else
        raise InterfaceObjectNotFound.new(self, name), "#{name} is an input port of #{self.name}, was expecting an output port"
    end
end

#output_port_model(name) ⇒ OroGen::Spec::OutputPort?

Resolves the model of a port

Returns:

  • (OroGen::Spec::OutputPort, nil)

688
689
690
691
692
693
# File 'lib/orocos/task_context_base.rb', line 688

def output_port_model(name)
    if port_model = model.each_output_port.find { |p| p.name == name }
        port_model
    else model.find_dynamic_output_ports(name, nil).first
    end
end

#peek_current_stateObject

This is meant to be used internally Returns the current task's state without “hiding” any state change to the task's user.

This is meant to be used internally


505
506
507
# File 'lib/orocos/task_context_base.rb', line 505

def peek_current_state
    peek_state.last || @current_state
end

#peek_stateObject


509
510
511
512
513
514
515
# File 'lib/orocos/task_context_base.rb', line 509

def peek_state
    current_state = rtt_state
    if (@state_queue.empty? && current_state != @current_state) || (@state_queue.last != current_state)
        @state_queue << current_state
    end
    @state_queue
end

#portsObject

Returns an array of all the ports defined on this task context


536
537
538
# File 'lib/orocos/task_context_base.rb', line 536

def ports
    enum_for(:each_port).to_a
end

#pretty_print(pp) ⇒ Object

:nodoc:


755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
# File 'lib/orocos/task_context_base.rb', line 755

def pretty_print(pp) # :nodoc:
    pp.text "Component #{name}"
    pp.breakable
    pp.text "  state: #{peek_current_state}"
    pp.breakable

    [['attributes', each_attribute], ['properties', each_property]].each do |kind, enum|
        objects = enum.to_a
        if objects.empty?
            pp.text "No #{kind}"
            pp.breakable
        else
            pp.text "#{kind.capitalize}:"
            pp.breakable
            pp.nest(2) do
                pp.text "  "
                objects.each do |o|
                    o.pretty_print(pp)
                    pp.breakable
                end
            end
            pp.breakable
        end
    end

    ports = enum_for(:each_port).to_a
    if ports.empty?
        pp.text "No ports"
        pp.breakable
    else
        pp.text "Ports:"
        pp.breakable
        pp.nest(2) do
            pp.text "  "
            each_port do |port|
                port.pretty_print(pp)
                pp.breakable
            end
        end
        pp.breakable
    end
end

#reachable?Boolean

Returns true if the remote task context can still be reached through and false otherwise.

Returns:

  • (Boolean)

593
594
595
596
597
598
# File 'lib/orocos/task_context_base.rb', line 593

def reachable?
    ping
    true
rescue RuntimeError
    false
end

#ready?Boolean

Returns true if the task has been configured.

Returns:

  • (Boolean)

470
# File 'lib/orocos/task_context_base.rb', line 470

def ready?; peek_current_state && (peek_current_state != :PRE_OPERATIONAL) end

#running?Boolean

Returns true if the task is in a state where code is executed. This includes of course the running state, but also runtime error states.

Returns:

  • (Boolean)

466
467
468
# File 'lib/orocos/task_context_base.rb', line 466

def running?
    runtime_state?(peek_current_state)
end

#runtime_error?Boolean

Returns true if the task is in a runtime error state

Returns:

  • (Boolean)

476
477
478
479
480
481
# File 'lib/orocos/task_context_base.rb', line 476

def runtime_error?
    state = self.peek_current_state
    error_state?(state) &&
        !exception_state?(state) &&
        !fatal_error_state?(state)
end

#runtime_state?(sym) ⇒ Boolean

True if the given symbol is the name of a runtime state

Returns:

  • (Boolean)

456
# File 'lib/orocos/task_context_base.rb', line 456

def runtime_state?(sym); @runtime_states.include?(sym) end

#state(return_current = true) ⇒ Object

Returns the state of the task, as a symbol. The possible values for all task contexts are:

:PRE_OPERATIONAL
:STOPPED
:ACTIVE
:RUNNING
:RUNTIME_WARNING
:RUNTIME_ERROR
:FATAL_ERROR

If the component is an oroGen component on which custom states have been defined, these custom states are also reported with their name. For instance, after the orogen definition

runtime_states "CUSTOM_RUNTIME"

#state will return :CUSTOM_RUNTIME if the component goes into that state.

If return_current is true, the current component state is returned. Otherwise, only the next state in the state queue is returned. This is only valid for oroGen components with extended state support (for which all state changes are saved instead of only the last one)


729
730
731
732
733
734
735
736
737
738
739
740
# File 'lib/orocos/task_context_base.rb', line 729

def state(return_current = true)
    peek_state
    if @state_queue.empty?
        @current_state
    elsif return_current
        @current_state = @state_queue.last
        @state_queue.clear 
    else
        @current_state = @state_queue.shift
    end
    @current_state
end

#state_changed?Boolean

True if we got a state change announcement

Returns:

  • (Boolean)

586
587
588
589
# File 'lib/orocos/task_context_base.rb', line 586

def state_changed?
    peek_state
    !@state_queue.empty?
end

#statesObject

Returns all states which were received since the last call and sets the current state to the last one.


744
745
746
747
748
749
750
751
752
753
# File 'lib/orocos/task_context_base.rb', line 744

def states
    peek_state
    if !@state_queue.empty?
        @current_state = @state_queue.last
        @state_queue,old = [],@state_queue
        old
    else
        []
    end
end

#to_hObject


833
834
835
836
837
838
839
# File 'lib/orocos/task_context_base.rb', line 833

def to_h
    Hash[
        name: name,
        model: model.to_h,
        state: state
    ]
end

#to_sObject


611
612
613
# File 'lib/orocos/task_context_base.rb', line 611

def to_s
    "#<TaskContextBase: #{self.class.name}/#{name}>"
end

#toplevel_state(state) ⇒ Symbol

Returns the toplevel state that corresponds to state, i.e. the value returned by #rtt_state when #state returns 'state'.

Returns:

  • (Symbol)

    the toplevel state that corresponds to state, i.e. the value returned by #rtt_state when #state returns 'state'


623
624
625
626
627
628
629
630
# File 'lib/orocos/task_context_base.rb', line 623

def toplevel_state(state)
    if exception_state?(state) then :EXCEPTION
    elsif fatal_state?(state) then :FATAL_ERROR
    elsif error_state?(state) then :RUNTIME_ERROR
    elsif runtime_state?(state) then :RUNNING
    else state
    end
end