|
From: <mor...@us...> - 2008-07-03 08:59:36
|
Revision: 1246
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=1246&view=rev
Author: morgan_quigley
Date: 2008-07-03 01:23:55 -0700 (Thu, 03 Jul 2008)
Log Message:
-----------
ruby script hacking to slap together demos
Added Paths:
-----------
pkg/trunk/highlevel/
pkg/trunk/highlevel/readme
pkg/trunk/highlevel/rubot/
pkg/trunk/highlevel/rubot/manifest.xml
pkg/trunk/highlevel/rubot/ronsole
pkg/trunk/highlevel/rubot/rubot/
pkg/trunk/highlevel/rubot/rubot/rubot.rb
pkg/trunk/highlevel/rubot/rubot/stair1.rb
pkg/trunk/highlevel/rubot/test/
pkg/trunk/highlevel/rubot/test/assimilate
pkg/trunk/highlevel/rubot/test/platform_stage.xml
pkg/trunk/highlevel/rubot/test/simple
Added: pkg/trunk/highlevel/readme
===================================================================
--- pkg/trunk/highlevel/readme (rev 0)
+++ pkg/trunk/highlevel/readme 2008-07-03 08:23:55 UTC (rev 1246)
@@ -0,0 +1,3 @@
+this directory is meant to contain high-level stuff, i.e. software that views
+the robot in very abstract terms, like "drive to XY on a map" or
+"open the door in front of you" or "pick up the stapler in front of you"
Added: pkg/trunk/highlevel/rubot/manifest.xml
===================================================================
--- pkg/trunk/highlevel/rubot/manifest.xml (rev 0)
+++ pkg/trunk/highlevel/rubot/manifest.xml 2008-07-03 08:23:55 UTC (rev 1246)
@@ -0,0 +1,13 @@
+<package>
+ <description>
+ A rubot is a ruby-controlled abstract robot. The concept is just to have a
+ few dumb ruby files for scripting lower-level (not necessarily simple)
+ actions together to make demos. For example, "drive to XY, then open the door
+ in front of you, then drive to another XY." This is not trying to compete
+ with more sophisticated algorithsm like TR or whatever; it's just a way to
+ slap together a few actions to show them off for a demo.
+ </description>
+ <author>Morgan Quigley</author>
+ <license>BSD</license>
+</package>
+
Added: pkg/trunk/highlevel/rubot/ronsole
===================================================================
--- pkg/trunk/highlevel/rubot/ronsole (rev 0)
+++ pkg/trunk/highlevel/rubot/ronsole 2008-07-03 08:23:55 UTC (rev 1246)
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+$:.push(`rospack find rubot`.strip)
+require 'rubot/stair1.rb'
+puts "You are now operating a STAIR1 robot"
+r = Stair1.new
+r.console
+
Property changes on: pkg/trunk/highlevel/rubot/ronsole
___________________________________________________________________
Name: svn:executable
+ *
Added: pkg/trunk/highlevel/rubot/rubot/rubot.rb
===================================================================
--- pkg/trunk/highlevel/rubot/rubot/rubot.rb (rev 0)
+++ pkg/trunk/highlevel/rubot/rubot/rubot.rb 2008-07-03 08:23:55 UTC (rev 1246)
@@ -0,0 +1,41 @@
+require 'irb'
+require 'irb/completion'
+
+module IRB
+ def IRB.start_session(*args)
+ unless $irb
+ IRB.setup nil
+ end
+ workspace = WorkSpace.new(*args)
+ $irb = Irb.new(workspace)
+ @CONF[:MAIN_CONTEXT] = $irb.context
+ trap 'INT' do
+ $irb.signal_handle
+ end
+ catch :IRB_EXIT do
+ $irb.eval_input
+ end
+ end
+end
+
+class Rubot
+ attr_accessor :actions
+ def initialize
+ @actions = Array.new
+ end
+ def register_action name, help
+ @actions << [name, help]
+ end
+ def console
+ IRB.start_session(self)
+ end
+ def show_actions
+ puts
+ puts "Here are your actions:"
+ puts "----------------------"
+ actions.each {|a| puts a[1]}
+ puts "----------------------"
+ nil
+ end
+end
+
Added: pkg/trunk/highlevel/rubot/rubot/stair1.rb
===================================================================
--- pkg/trunk/highlevel/rubot/rubot/stair1.rb (rev 0)
+++ pkg/trunk/highlevel/rubot/rubot/stair1.rb 2008-07-03 08:23:55 UTC (rev 1246)
@@ -0,0 +1,32 @@
+require(`rospack find rubot`.strip + "/rubot/rubot.rb")
+
+class Stair1 < Rubot
+ def initialize
+ super
+ register_action('deadreckon', 'deadreckon RANGE BEARING FINALHEADING')
+ register_action('inventory', 'inventory')
+ end
+ def navigate(x, y, th)
+ puts "stair1 navigate to #{x}, #{y}, #{th}"
+ system "#{`rospack find mux`.strip}/switch mux:=velMux wavefrontVel"
+ system "#{`rospack find wavefront_player`.strip}/query_wavefront #{x} #{y} #{th}"
+ end
+ def deadreckon(range, bearing, final_heading)
+ puts "stair1 deadreckon to #{range}, #{bearing}, #{final_heading}"
+ system "#{`rospack find mux`.strip}/switch mux:=velMux deadReckonVel"
+ system "#{`rospack find deadreckon`.strip}/test_deadreckon_service #{range} #{bearing} #{final_heading}"
+ end
+ def inventory
+ puts ""
+ puts "You are carrying:"
+ puts "-----------------"
+ puts "segway"
+ puts "laser"
+ puts "manipulator"
+ puts "stereo camera"
+ puts "PTZ camera"
+ puts "mono camera"
+ puts "-----------------"
+ puts ""
+ end
+end
Added: pkg/trunk/highlevel/rubot/test/assimilate
===================================================================
--- pkg/trunk/highlevel/rubot/test/assimilate (rev 0)
+++ pkg/trunk/highlevel/rubot/test/assimilate 2008-07-03 08:23:55 UTC (rev 1246)
@@ -0,0 +1,8 @@
+#!/usr/bin/env ruby
+$:.push(`rospack find rubot`.strip)
+require 'rubot/stair1.rb'
+
+r = Stair1.new
+r.navigate(24, 19, 0.6)
+#r.deadreckon(1,2,3)
+#r.drive(4,5,6)
Property changes on: pkg/trunk/highlevel/rubot/test/assimilate
___________________________________________________________________
Name: svn:executable
+ *
Added: pkg/trunk/highlevel/rubot/test/platform_stage.xml
===================================================================
--- pkg/trunk/highlevel/rubot/test/platform_stage.xml (rev 0)
+++ pkg/trunk/highlevel/rubot/test/platform_stage.xml 2008-07-03 08:23:55 UTC (rev 1246)
@@ -0,0 +1,8 @@
+<launch>
+ <node pkg="rosstage" type="rosstage" args="$(find 2dnav-stage)/willow-erratic.world"/>
+ <node pkg="map_server" type="map_server" args="$(find 2dnav-stage)/willow-full.png 0.1"/>
+ <node pkg="amcl_player" type="amcl_player"/>
+ <node pkg="wavefront_player" type="wavefront_player cmd_vel:=wavefrontVel"/>
+ <node pkg="nav_view" type="nav_view"/>
+ <node pkg="mux" type="mux" args="cmd_vel velMux wavefrontVel deadReckonVel"/>
+</launch>
Added: pkg/trunk/highlevel/rubot/test/simple
===================================================================
--- pkg/trunk/highlevel/rubot/test/simple (rev 0)
+++ pkg/trunk/highlevel/rubot/test/simple 2008-07-03 08:23:55 UTC (rev 1246)
@@ -0,0 +1,7 @@
+#!/usr/bin/env ruby
+$:.push(`rospack find rubot`.strip)
+require 'rubot/stair1.rb'
+
+r = Stair1.new
+r.deadreckon(1,2,3)
+r.drive(4,5,6)
Property changes on: pkg/trunk/highlevel/rubot/test/simple
___________________________________________________________________
Name: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|