class Syskit::Robot::ComBus

This class represents a communication bus on the robot, i.e. a device that multiplexes and demultiplexes I/O for device modules

Attributes

attached_devices[R]

Public Class Methods

new(robot, name, device_model, options, driver_model, task_arguments) click to toggle source
Calls superclass method
# File lib/syskit/robot/communication_bus.rb, line 8
def initialize(robot, name, device_model, options,
               driver_model, task_arguments)
    super
    @attached_devices = Set.new
end

Public Instance Methods

device(type_name, options = Hash.new) click to toggle source

Used by the through call to override com_bus specification.

# File lib/syskit/robot/communication_bus.rb, line 48
def device(type_name, options = Hash.new)
    device = robot.device(type_name, options)
    device.attach_to(self)
    device
end
each_attached_device() { |dev| ... } click to toggle source
# File lib/syskit/robot/communication_bus.rb, line 43
def each_attached_device
    attached_devices.each { |dev| yield(dev) }
end
instanciate(plan, context = DependencyInjectionContext.new, **options) click to toggle source
Calls superclass method
# File lib/syskit/robot/communication_bus.rb, line 14
def instanciate(plan, context = DependencyInjectionContext.new, **options)
    service = super
    task = service.to_task
    if !device_model.lazy_dispatch?
        each_attached_device do |dev|
            require_dynamic_service_for_device(task, dev)
        end
    end
    service
end
require_dynamic_service_for_device(combus_task, device) click to toggle source

Create the dynamic service on the combus driver task that is necessary to connect to the given device

@param [Component] combus_task the driver task for self @param [Device] device the device that should be interfaced

through the service

@return [BoundDataService] the created service

# File lib/syskit/robot/communication_bus.rb, line 33
def require_dynamic_service_for_device(combus_task, device)
    combus_task.require_dynamic_service(
        device_model.dynamic_service_name,
        as: device.name, bus_to_client: device.bus_to_client?, client_to_bus: device.client_to_bus?)
end
through(&block) click to toggle source
# File lib/syskit/robot/communication_bus.rb, line 39
def through(&block)
    instance_eval(&block)
end