fairlight1337 / libcflie

Crazyflie Nano C++ Client Library
http://fairlight1337.github.io/libcflie.html
48 stars 68 forks source link

thrust command not working #10

Open rshum19 opened 9 years ago

rshum19 commented 9 years ago

Hi,

1st of all great job with the library!

I have been trying to use your library but I can't seem to get the ex-gui example to work properly. When I run ex-gui it connects fine to to the crazyflie and I can see the gui animation move according to the movement of the crazyflie. However, no thrust command are send to crazyflie.

I think its an issue with the new crazyflie firmware that needs to send a thrust = 0 command to unlock the motors. I tried this and it didn't seem to work. Wondering if you have the same issue

gustavokcouto commented 9 years ago

Hello, I'm having the same problem as you, but I didn't find yet a document where it's explaned the difference in the protocol between the crazyflie 2.0 and the original.

fairlight1337 commented 9 years ago

Hi there,

Thanks for the feedback! I remember having had that kind of problem a couple of times, but it eventually went away after re-flashing the firmware. It might have been that I flashed an older firmware that didn't have that problem/feature, and was not aware of the thrust=0 signal to start the motors. Are you using the Crazyflie 1 or 2?

The library was developed and tested only on the first version, with rather old firmware. As I don't have the hardware anymore and sadly lack the time to port it to the needs of the newer versions, I'm afraid that's all I can tell you.

@gustavokcouto, reverse-engineering the protocol was a pretty painful process (a mixture of looking at the Python library supplied by Bitcraze, the contents of their Wiki, and using a USB sniffer to figure out what's actually being transferred, plus lots of trial and error). So to be frank, I would be surprised if they have a thorough documentation of the protocol by now (not to speak of a comparison chart between version 1 and 2).

If you think version 1 and 2 are compatible (or at least should be), I'm more than happy to incorporate pull requests into the driver library that introduce support for the new features.

Cheers

rshum19 commented 9 years ago

Hi,

I'm using Crazyflie 2.0 with the latest firmware from their git repository. I have now managed to get it working by modifying their firmware and removing the thrust lock. In the file modules/src/commander.c for all instances of the variable "thrustLocked" set it to false. Then your ex-gui examples runs smoothly.

fairlight1337 commented 9 years ago

Great you figured that out!

And the way to enable that via control commands is to set thrust to 0 initially before trying to control the motors? Maybe a setup routine when sending the first set point package with thrust values from the library would do the job.

rshum19 commented 9 years ago

Tried that and it didn't seem to unlock the motors. Have to look more into, if I find a solution I'll posted here.

fairlight1337 commented 9 years ago

Great, thanks.

lkdo commented 8 years ago

I had a similar issue using a libcflie modified for windows. After putting the newest firmware on a Crazyflie 2 (i.e. cf2-2015.08.1 and cf2-nrf-2015.08.1), the thrust became locked. Sending a zero-thrust command in the beginning did however solve the problem - maybe because the following bugfix https://github.com/nesl/crazyflie-decawave/commit/d8c3d8f6effc8cd5117648105f3146d0be1f3ee9 is included in the new firmware.

fairlight1337 commented 8 years ago

Maybe it's a suitable measure to include a dummy zero-thrust command when starting the copter. I'll see after adding it. Thanks for confirming the bug and its workaround.

On 25.11.2015, at 16:33, Luminita Totu notifications@github.com wrote:

I had a similar issue using a libcflie modified for windows. After putting the newest firmware on a Crazyflie 2 (i.e. cf2-2015.08.1 and cf2-nrf-2015.08.1), the thrust became locked. Sending a zero-thrust command in the beginning did however solve the problem - maybe because the following bugfix nesl/crazyflie-decawave@d8c3d8f is included in the new firmware.

— Reply to this email directly or view it on GitHub.

nurp commented 8 years ago

Hi, I upgraded also to cf2-2015.08.1 and thrusters are not working. There is already a line in gui.cpp's main function as: cflieCopter->setThrust(0);

Is there something else I should do? This is my console output:

Opening radio 0/80/250K Got device version 0.83 pci id for fd 13: 80ee:beef, driver (null) libGL error: core dri or dri2 extension not found libGL error: failed to load driver: vboxvideo Running, exit with 'ESC'. Console text: SYS: ------------------------- Console text: ---

Console text: SYS: Crazyflie 2.0 is up and r Console text: SYS: Build 0:61e23e51d7d3 (201

Console text: 5.08.1) CLEAN � Console text: SYS: I am 0x313238323133470D31 Console text: 0018 and I have 1024KB of flas

Console text: h!

Console text: CFGBLK: v1, verification [OK]

Console text: IMU: MPU9250 I2C connection [O Console text: K].

Console text: IMU: AK8963 I2C connection [OK Console text: ].

Console text: IMU: LPS25H I2C connection [OK1 Console text: ].

Console text: DECK_DRIVERS: Found 4 drivers

Console text: DECK_INFO: Found 0 deck memory

Console text: .

Console text: DECK_CORE: 0 deck enumerated

Console text: EEPROM: I2C connection [OK].

Console text: AK8963: Self test [OK]. 7 Console text: LPS25H: Self test [OK]. 7 Console text: SYS: Free heap: 3048 bytes  Registered logging block stabilizer' Registered logging blockgyroscope' Registered logging block accelerometer' Registered logging blockbattery' Registered logging block magnetometer' Registered logging blockaltimeter'