Class: Orocos::TaskContextBase

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

Overview

Base implementation for Orocos::TaskContext

Direct Known Subclasses

Log::TaskContext, ROS::Node, TaskContext

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, namespace: nil, process: nil, model: nil) ⇒ TaskContextBase

Returns a new instance of TaskContextBase

Parameters:

  • name (String)

    The name of the task.

  • options (Hash)

    The options.



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
349
# File 'lib/orocos/task_context_base.rb', line 305

def initialize(name, namespace: nil, process: nil, model: nil)
    @ports = Hash.new
    @properties = Hash.new
    @attributes = Hash.new
    @state_queue = Array.new

    if namespace
        self.namespace, @name = namespace, name
    else
        self.namespace, @name = split_name(name)
        name = @name
    end
    @process    = 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 model
        self.model = model
    else
        # Load the model from remote if it is not set yet
        self.model
    end

    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:



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
832
833
834
835
# File 'lib/orocos/task_context_base.rb', line 802

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



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

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.



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

def configuration_log
  @configuration_log
end

#current_stateObject (readonly)

Returns the last-known state



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

def current_state
  @current_state
end

#iorObject (readonly)

The IOR of this task context



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

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



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

def process
  @process
end

#propertiesObject (readonly)

A name => Property instance mapping of cached properties



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

def properties
  @properties
end

#state_symbolsObject (readonly)

A mapping from static numeric value to state names



299
300
301
# File 'lib/orocos/task_context_base.rb', line 299

def state_symbols
  @state_symbols
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



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

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



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

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



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

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.



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

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)


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

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

Instance Method Details

#add_default_statesObject



636
637
638
639
640
641
# File 'lib/orocos/task_context_base.rb', line 636

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.



499
500
501
502
503
# File 'lib/orocos/task_context_base.rb', line 499

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

#basenameObject



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

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



613
614
615
# File 'lib/orocos/task_context_base.rb', line 613

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



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

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)


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

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



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

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



551
552
553
554
555
# File 'lib/orocos/task_context_base.rb', line 551

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



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

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



562
563
564
565
566
# File 'lib/orocos/task_context_base.rb', line 562

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



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

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



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

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)


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

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)


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

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

#exception?Boolean

Returns true if the task is in an exceptional state

Returns:

  • (Boolean)


489
490
491
# File 'lib/orocos/task_context_base.rb', line 489

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


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

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)


685
686
687
# File 'lib/orocos/task_context_base.rb', line 685

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:



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

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

#input_port(name) ⇒ Object



523
524
525
526
527
528
529
530
# File 'lib/orocos/task_context_base.rb', line 523

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)


702
703
704
705
706
707
# File 'lib/orocos/task_context_base.rb', line 702

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



621
622
623
# File 'lib/orocos/task_context_base.rb', line 621

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

#modelOroGen::Spec::TaskContext?

Returns the oroGen model that describes this node

Returns:

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

    the oroGen model that describes this node



671
672
673
674
675
676
677
678
679
# File 'lib/orocos/task_context_base.rb', line 671

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



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

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



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

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)


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

def on_localhost?
    process && process.on_localhost?
end

#output_port(name) ⇒ Object



532
533
534
535
536
537
538
539
# File 'lib/orocos/task_context_base.rb', line 532

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)


692
693
694
695
696
697
# File 'lib/orocos/task_context_base.rb', line 692

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



511
512
513
# File 'lib/orocos/task_context_base.rb', line 511

def peek_current_state
    peek_state.last || @current_state
end

#peek_stateObject



515
516
517
518
519
520
521
# File 'lib/orocos/task_context_base.rb', line 515

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



542
543
544
# File 'lib/orocos/task_context_base.rb', line 542

def ports
    enum_for(:each_port).to_a
end

#pre_operational?Boolean

Returns true if the task is pre-operational

Returns:

  • (Boolean)


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

def pre_operational?
    peek_current_state && peek_current_state == :PRE_OPERATIONAL
end

#pretty_print(pp) ⇒ Object

:nodoc:



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
797
798
799
800
# File 'lib/orocos/task_context_base.rb', line 759

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)


599
600
601
602
603
604
# File 'lib/orocos/task_context_base.rb', line 599

def reachable?
    ping
    true
rescue RuntimeError
    false
end

#ready?Boolean

Returns true if the task has been configured.

Returns:

  • (Boolean)


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

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)


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

def running?
    runtime_state?(peek_current_state)
end

#runtime_error?Boolean

Returns true if the task is in a runtime error state

Returns:

  • (Boolean)


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

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)


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

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)



733
734
735
736
737
738
739
740
741
742
743
744
# File 'lib/orocos/task_context_base.rb', line 733

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)


592
593
594
595
# File 'lib/orocos/task_context_base.rb', line 592

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.



748
749
750
751
752
753
754
755
756
757
# File 'lib/orocos/task_context_base.rb', line 748

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

#to_hObject



837
838
839
840
841
842
843
# File 'lib/orocos/task_context_base.rb', line 837

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

#to_sObject



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

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'



627
628
629
630
631
632
633
634
# File 'lib/orocos/task_context_base.rb', line 627

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