Module: Robot
- Defined in:
- lib/roby/robot.rb
Class Method Summary collapse
-
.action_from_model(model) ⇒ Object
deprecated
Deprecated.
use Roby.app.action_from_model instead
-
.action_from_name(name) ⇒ Object
deprecated
Deprecated.
use Roby.app.action_from_name instead
- .actions(&block) ⇒ Object
- .cleanup(&block) ⇒ Object
- .clear_models(&block) ⇒ Object
- .config(&block) ⇒ Object
- .controller(reset: false, &block) ⇒ Object
-
.find_action_from_name(name) ⇒ Object
deprecated
Deprecated.
use Roby.app.find_action_from_name instead
- .init(&block) ⇒ Object
- .log_formatter(severity, time, progname, msg) ⇒ Object
-
.method_missing(name, *args) ⇒ Object
Implements that one can call.
-
.prepare_action(plan, name, **arguments) ⇒ Object
deprecated
Deprecated.
use Roby.app.prepare_action instead
- .requires(&block) ⇒ Object
-
.robot_type(robot_type) ⇒ Object
Declare the robot type of the robot configuration being loaded.
- .setup(&block) ⇒ Object
- .shutdown(&block) ⇒ Object
Class Method Details
.action_from_model(model) ⇒ Object
Deprecated.
use Roby.app.action_from_model instead
13 14 15 |
# File 'lib/roby/robot.rb', line 13 def self.action_from_model(model) Roby.app.action_from_model(model) end |
.action_from_name(name) ⇒ Object
Deprecated.
use Roby.app.action_from_name instead
23 24 25 |
# File 'lib/roby/robot.rb', line 23 def self.action_from_name(name) Roby.app.action_from_name(name) end |
.actions(&block) ⇒ Object
101 102 103 |
# File 'lib/roby/robot.rb', line 101 def self.actions(&block) Roby.app.actions(user: true, &block) end |
.cleanup(&block) ⇒ Object
84 85 86 |
# File 'lib/roby/robot.rb', line 84 def self.cleanup(&block) Roby.app.on_cleanup(user: true, &block) end |
.clear_models(&block) ⇒ Object
80 81 82 |
# File 'lib/roby/robot.rb', line 80 def self.clear_models(&block) Roby.app.on_clear_models(user: true, &block) end |
.config(&block) ⇒ Object
88 89 90 91 |
# File 'lib/roby/robot.rb', line 88 def self.config(&block) Roby.warn_deprecated "Robot.config is deprecated, use Robot.setup instead" Roby.app.on_setup(user: true, &block) end |
.controller(reset: false, &block) ⇒ Object
93 94 95 |
# File 'lib/roby/robot.rb', line 93 def self.controller(reset: false, &block) Roby.app.controller(reset: reset, user: true, &block) end |
.find_action_from_name(name) ⇒ Object
Deprecated.
use Roby.app.find_action_from_name instead
18 19 20 |
# File 'lib/roby/robot.rb', line 18 def self.find_action_from_name(name) Roby.app.find_action_from_name(name) end |
.init(&block) ⇒ Object
68 69 70 |
# File 'lib/roby/robot.rb', line 68 def self.init(&block) Roby.app.on_init(user: true, &block) end |
.log_formatter(severity, time, progname, msg) ⇒ Object
6 7 8 9 |
# File 'lib/roby/robot.rb', line 6 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) ⇒ Object
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
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/roby/robot.rb', line 44 def self.method_missing(name, *args) return super unless (m = /!$/.match(name.to_s)) name = m.pre_match.to_sym if args.size > 1 raise ArgumentError, "wrong number of arguments (#{args.size} for 1) in #{name}!" end = args.first || {} task, planner = Roby.app.prepare_action(name, job_id: Roby::Interface::Job.allocate_job_id, **) task.plan.add_mission_task(task) [task, planner] end |
.prepare_action(plan, name, **arguments) ⇒ Object
Deprecated.
use Roby.app.prepare_action instead
28 29 30 31 32 33 34 |
# File 'lib/roby/robot.rb', line 28 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 Roby.app.prepare_action(name, **arguments) end |
.requires(&block) ⇒ Object
76 77 78 |
# File 'lib/roby/robot.rb', line 76 def self.requires(&block) Roby.app.on_require(user: true, &block) end |
.robot_type(robot_type) ⇒ Object
Declare the robot type of the robot configuration being loaded
Place this on top of the robot file in config/robots/
61 62 63 64 65 66 |
# 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 |