Module: Robot
- Extended by:
- Logger::Forward
- Defined in:
- lib/roby/robot.rb,
lib/roby/interface.rb
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/roby/robot.rb', line 3 def logger @logger end |
Class Method Details
.method_missing(name, *args) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/roby/interface.rb', line 40 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 = args.first || {} task, planner = Robot.prepare_action(name, ) Roby.control.plan.insert(task) return task, planner end |
.prepare_action(name, arguments) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/roby/interface.rb', line 10 def self.prepare_action(name, arguments) control = Roby.control # Check if +name+ is a planner method, and in that case # add a planning method for it and plan it planner_model = control.planners.find do |planner_model| planner_model.has_method?(name) end if !planner_model raise ArgumentError, "no such planning method #{name}" end m = planner_model.model_of(name, arguments) # HACK: m.returns should not be nil, but it sometimes happen returns_model = (m.returns if m && m.returns) || Task if returns_model.kind_of?(Roby::TaskModelTag) task = Roby::Task.new task.extend returns_model else # Create an abstract task which will be planned task = returns_model.new end planner = Roby::PlanningTask.new(:planner_model => planner_model, :method_name => name, :method_options => arguments) task.planned_by planner return task, planner end |