hybridgroup / artoo-crazyflie

Artoo adaptor for the Crazyflie quadcopter
http://artoo.io
Other
13 stars 2 forks source link

ERROR -- : undefined method `supports_hover=' #5

Open wadelazarus opened 10 years ago

wadelazarus commented 10 years ago

Details: VirtualBox using Bitcraze VM 0.4 OS: xubuntu 13.10 Crazyflie: 10DOF V0.4 Crazyradio: V0.52 Ruby: V2.1.0

****Code require 'artoo'

connection :crazyflie, :adaptor => :crazyflie, :supports_hover => true device :drone, :driver => :crazyflie, :connection => :crazyflie, :interval => 0.1

work do

end


*Terminal * bitcraze@bitcraze-vm:~$ ruby Test.rb I, [2014-01-08T20:11:32.668536 #2415] INFO -- : Registering connection 'crazyflie'... I, [2014-01-08T20:11:32.668950 #2415] INFO -- : Registering device 'drone'... I, [2014-01-08T20:11:32.669188 #2415] INFO -- : Preparing work... I, [2014-01-08T20:11:32.670432 #2415] INFO -- : Initializing connection crazyfleen wie... I, [2014-01-08T20:11:32.675541 #2415] INFO -- : Initializing device drone... I, [2014-01-08T20:11:32.683799 #2415] INFO -- : Starting work... I, [2014-01-08T20:11:32.684478 #2415] INFO -- : Connecting to 'crazyflie' on port 'none'... NOTE: Install rubysdl for joystick support E, [2014-01-08T20:11:37.385431 #2415] ERROR -- : undefined method supports_hover=' for #<Crubyflie::Crazyflie:0xb5b9cdf4> E, [2014-01-08T20:11:37.386043 #2415] ERROR -- : ["/home/bitcraze/.rvm/gems/ruby-2.1.0/gems/artoo-crazyflie-0.4.0/lib/artoo/adaptors/crazyflie.rb:23:inconnect'", "/home/bitcraze/.rvm/gems/ruby-2.1.0/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in public_send'", "/home/bitcraze/.rvm/gems/ruby-2.1.0/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:indispatch'", "/home/bitcraze/.rvm/gems/ruby- . . .


There appears to be a connection as the green led blinks once. I have been stuck with this issue and would appreciate any help.

deadprogram commented 10 years ago

The README is slightly out of date, thanks for pointing this out. I am going to update it shortly... thanks for pointing out this error!

deadprogram commented 10 years ago

I just updated the README please take a look, @wadelazarus it should work a lot better for you. Sorry about the mismatch!

wadelazarus commented 10 years ago

The firmware was updated with the .bin link provided and hover disabled as shown. I still revived the same error which I could get around by commenting out the line of code in question. I am new to ruby programming so have been relying on the examples provided to learn. Would it be possible to have the hover example updated as well for a better reference?

deadprogram commented 10 years ago

I just updated the examples, but do not have any batteries with me to test. Can you please retry, and if that helps?

wadelazarus commented 10 years ago

Running the crazy_hop.rb example I still get the following error: E, [2014-01-10T16:07:30.715098 #3598] ERROR -- : undefined method supports_hover=' for #<Crubyflie::Crazyflie:0xb5c98e24> E, [2014-01-10T16:07:30.715359 #3598] ERROR -- : ["/home/bitcraze/.rvm/gems/ruby-2.1.0/gems/artoo-crazyflie-0.4.0/lib/artoo/adaptors/crazyflie.rb:23:inconnect'"

If I comment out the line of code which provides the error (crazyflie.rb line 23) a connection occurs but then have the following error: E, [2014-01-10T16:12:41.164286 #3679] ERROR -- : Artoo::Drivers::Crazyflie crashed! ArgumentError: wrong number of arguments (6 for 4..5) /home/bitcraze/.rvm/gems/ruby-2.1.0/gems/hybridgroup-crubyflie-0.1.5/lib/crubyflie/crazyflie/commander.rb:39:in `send_setpoint'

Below is the line of ruby code which is giving me issues after I have commented out crazyflie.rb line 23: device :drone, :driver => :crazyflie, :connection => :crazyflie, :interval => 0.1

I will continue to read through the code to try and better understand the issue. Any suggestions?

deadprogram commented 10 years ago

FYI, you need both the connection and driver to control your crazyflie.

From your log file, looks like you are running the released version of the artoo-crazyflie gem. You need to be running the artoo-crazyflie gem source locally, since the currently released artoo-crazyflie gem does not yet support this functionality. We've been waiting for Bitcraze.se to release the hover firmware officially, before updating this gem.

wadelazarus commented 10 years ago

The hover firmware has been release in the VM 0.4 released as this is what I have been using and it works well with the controller. I am trying to fly without using the controller thus artoo has been very interesting.

The driver was the problem it turns out. I was able to get the crazy_hop.rb example working by doing the following changes to the provided code.

File: /home/bitcraze/.rvm/gems/ruby-2.1.0/gems/artoo-crazyflie-0.4.0/lib/artoo/adaptors/crazyflie.rb (Line 23) From: @crazyflie.supports_hover = additional_params[:supports_hover] || false Changed To: #Removed

File: /home/bitcraze/.rvm/gems/ruby-2.1.0/gems/artoo-crazyflie-0.4.0/lib/artoo/drivers/crazyflie.rb (Line 123) From: connection.commander.send_setpoint(roll, pitch, yaw, thrust, xmode, hover_mode) Changed To: connection.commander.send_setpoint(roll, pitch, yaw, thrust, xmode)

It appears that the hover mode has been disabled by doing these changes but at least I have movement. When I run the hover example there is no hovering just a constant low throttle which dose not provide enough lift.

deadprogram commented 10 years ago

Thanks for diving into this. Your diagnosis sounds exactly correct, would you like to submit a PR with that change?

Regarding the way hover works on the Crazyflie, it is a little different that you would expect. Hover in the firmware seems to mean "maintain your current altitude". So you need to fly manually to your desired height, and then trigger the hover by sending the param mentioned in the readme. The hover command in the ruby class could be modified to send this command to the Crazyflie... we have plans to tweak this command to make it operate more like the ARDrone's hover does, but have not gotten around to it as of yet.

wadelazarus commented 10 years ago

I would be happy to send a PR but assume this is a pull request which I am unsure how to do. Point me in the right direction and I will get it done. Normally I just read forms thus am unsure of how all this works. I plan to continue working with the code to enable parameters to be logged over a simple programmed flight path.

deadprogram commented 10 years ago

You seem to be doing pretty well so far to me! :grinning:

This link provides a good summary about using pull requests on Github https://help.github.com/articles/using-pull-requests

Seems to be that you are already most of the way there...

tatung commented 10 years ago

Hi, I have install artoo and artoo-crazyflie by gem install artoo gem install artoo-crazyflie

However, I still get the same error with the

supports_hover=' for #Crubyflie::Crazyflie:0xb5c98e24

Do I need to use the local artoo-crazyflie source code downloaded from github? If yes, could you please tell me how to do it?

Thanks

deadprogram commented 10 years ago

If you use bundler, you should be able to bundle install to install the needed dependencies, and then bundle exec ruby example/crazy_hop.rb to execute your local code, as long as you are in the directory for your local copy of the repository.

javier89 commented 10 years ago

some kind of simulator to handle crazyflie and can be installed on mac