hybridgroup / artoo-sphero

Artoo adaptor for the Sphero robot.
http://artoo.io
Other
24 stars 11 forks source link

How do we orient the Sphero? #24

Closed zachfeldman closed 10 years ago

zachfeldman commented 10 years ago

In the iPhone app, there's an option to orient the Sphero to where you're currently standing. How do we know which direction it's going in?

deadprogram commented 10 years ago

As I recall from having used it, that option requires you look and use a widget on the iphone to cause the Sphero to turn till the tail light is pointed towards you.

zachfeldman commented 10 years ago

Yeah, that's definitely how you do it on the iPhone - the only problem is that you'd have to:

  1. Pair with your iphone
  2. Orient the sphero
  3. unpair with your iphone
  4. pair with your laptop/let Artoo do so
  5. run program

Rather than, perhaps:

  1. Run program with command that shows where sphero is oriented, turn sphero to orient, you have x seconds to orient
  2. run rest of program

Do you think the second one is possible in your research thus far? Happy to look into it myself too! Thanks @deadprogram .

deadprogram commented 10 years ago

We have some code to help orient Sphero in Cylon.js located here: https://github.com/hybridgroup/cylon-sphero/blob/master/lib/driver.js#L86-L101

Someone just needs to port this to artoo-sphero... ;)

solojavier commented 10 years ago

We already have it in dev branch: https://github.com/hybridgroup/artoo-sphero/blob/dev/lib/artoo/drivers/sphero.rb#L129 @deadprogram

deadprogram commented 10 years ago

Perfect!

solojavier commented 10 years ago

So @zachfeldman you could try that command...

zachfeldman commented 10 years ago

Thanks @solojavier and @deadprogram ! I checked out the dev branch and just tried it out. I get:

, [2014-08-14T17:20:02.979809 #16177] INFO -- : Starting driver 'Artoo::Drivers::Sphero'... E, [2014-08-14T17:20:02.980884 #16177] ERROR -- : undefined methodstart_calibration' for #<Device @id=2169422560, @name='name', @driver='Artoo::Drivers::Sphero'> E, [2014-08-14T17:20:02.980998 #16177] ERROR -- : ["/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/calls.rb:30:in check'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/calls.rb:24:indispatch'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/calls.rb:63:in dispatch'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/cell.rb:60:inblock in invoke'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/cell.rb:71:in block in task'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/actor.rb:357:inblock in task'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/tasks.rb:57:in block in initialize'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/tasks/task_fiber.rb:15:inblock in create'", "(celluloid):0:in remote procedure call'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/calls.rb:92:invalue'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/proxies/sync_proxy.rb:33:in method_missing'", "sphero.rb:12:inblock in

'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/artoo-1.8.0/lib/artoo/robot.rb:214:in instance_eval'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/artoo-1.8.0/lib/artoo/robot.rb:214:inexecute_working_code'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/artoo-1.8.0/lib/artoo/robot.rb:71:in work'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/calls.rb:26:inpublic_send'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/calls.rb:26:in dispatch'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/calls.rb:122:indispatch'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/cell.rb:60:in block in invoke'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/cell.rb:71:inblock in task'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/actor.rb:357:in block in task'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/tasks.rb:57:inblock in initialize'", "/Users/zachfeldman/.rvm/gems/ruby-2.1.0/gems/celluloid-0.16.0.pre3/lib/celluloid/tasks/task_fiber.rb:15:in block in create'"]

solojavier commented 10 years ago

We have just pushed version 1.5.0 of artoo-sphero gem which includes that capability... could you try updating and trying again?