module Robot

Public Class Methods

action_from_model(model) click to toggle source

@deprecated use Roby.app.action_from_model instead

# File lib/roby/robot.rb, line 11
def self.action_from_model(model)
    return Roby.app.action_from_model(model)
end
action_from_name(name) click to toggle source

@deprecated use Roby.app.action_from_name instead

# File lib/roby/robot.rb, line 21
def self.action_from_name(name)
    return Roby.app.action_from_name(name)
end
actions(&block) click to toggle source
# File lib/roby/robot.rb, line 96
def self.actions(&block)
    Roby.app.actions(&block)
end
cleanup(&block) click to toggle source
# File lib/roby/robot.rb, line 84
def self.cleanup(&block)
    Roby.app.on_cleanup(&block)
end
clear_models(&block) click to toggle source
# File lib/roby/robot.rb, line 80
def self.clear_models(&block)
    Roby.app.on_clear_models(&block)
end
config(&block) click to toggle source
# File lib/roby/robot.rb, line 88
def self.config(&block)
    Roby.app.on_config(&block)
end
controller(&block) click to toggle source
# File lib/roby/robot.rb, line 92
def self.controller(&block)
    Roby.app.controller(&block)
end
find_action_from_name(name) click to toggle source

@deprecated use Roby.app.find_action_from_name instead

# File lib/roby/robot.rb, line 16
def self.find_action_from_name(name)
    return Roby.app.find_action_from_name(name)
end
init(&block) click to toggle source
# File lib/roby/robot.rb, line 68
def self.init(&block)
    Roby.app.on_init(&block)
end
log_formatter(severity, time, progname, msg) click to toggle source
# File lib/roby/robot.rb, line 4
def self.log_formatter(severity, time, progname, msg)
    Roby.app.notify(progname, severity.to_s, msg)
    Roby.logger.formatter.call(severity, time, progname, msg)
end
method_missing(name, *args) click to toggle source

Implements that one can call

Robot.action_name! arg0: value0, arg1: value1

To inject a given action in Roby.plan. The added action is added as a mission.

See also Robot.prepare_action

Calls superclass method
# File lib/roby/robot.rb, line 41
def self.method_missing(name, *args)
    if name.to_s =~ /!$/
        name = $`.to_sym
    else
        super
    end

    if args.size > 1
        raise ArgumentError, "wrong number of arguments (#{args.size} for 1) in #{name}!"
    end

    options = args.first || {}
    task, planner = Roby.app.prepare_action(name, job_id: Roby::Interface::Job.allocate_job_id, **options)
    task.plan.add_mission_task(task)
    return task, planner
end
prepare_action(plan, name, **arguments) click to toggle source

@deprecated use Roby.app.prepare_action instead

# File lib/roby/robot.rb, line 26
def self.prepare_action(plan, name, **arguments)
    if plan != Roby.app.plan
        raise ArgumentError, "cannot call prepare_action with any other plan than Roby.app.plan"
    end
    return Roby.app.prepare_action(name, **arguments)
end
requires(&block) click to toggle source
# File lib/roby/robot.rb, line 76
def self.requires(&block)
    Roby.app.on_require(&block)
end
robot_type(robot_type) click to toggle source

Declare the robot type of the robot configuration being loaded

Place this on top of the robot file in config/robots/

# File lib/roby/robot.rb, line 61
def self.robot_type(robot_type)
    # Declare it first
    Roby.app.robots.declare_robot_type(Roby.app.robot_name, robot_type)
    # And then set it up
    Roby.app.robot(Roby.app.robot_name, robot_type)
end
setup(&block) click to toggle source
# File lib/roby/robot.rb, line 72
def self.setup(&block)
    Roby.app.on_setup(&block)
end