Page 3 of 4

Re: Self stabilizing using the 3-axis accelerometer?

Posted: Wed May 22, 2013 7:24 pm
by TheFrog4u
I tried it also a few days ago, but I its not working for me very well. First of all I got several warnings in the console (used phiamos cfclient)

Code: Select all

Warning:cflib.crazyflie.toc: Unable to find variable [hover.mode]
Warning:cflib.crazyflie.param: Cannot set value for [hover.mode], its not in the TOC!
After connecting the cf seems to go to full thrust qickly once I activate the hover moder and I can switch it off again, but than I can not control the thrust mannually any more. Additional I got a lot of other warnigs:

Code: Select all

Warning: cflib.crazyflie:ExpectAnswer: ERROR! Older timer whas running while sheduling new one on [2]
What did I do wrong?

Re: Self stabilizing using the 3-axis accelerometer?

Posted: Wed May 22, 2013 8:10 pm
by rmirwin2
I see those warnings also. If you do a search on " Older timer " you'll find a post about those arising from logging, which I seem to recall is busted right now. The messages seem to be a nuisance but I'm just ignoring them at the moment.

I've also seen the "to the ceiling" behavior until I got ALL of Matt Collin's modifications into the Crazyflie firmware. The b3f0802 commit, the last one, seemed to make a big difference. Until that last one was installed in the firmware, it went abruptly up and I once fought it back down to the ground.

Hope that helps!
Rich

Re: Self stabilizing using the 3-axis accelerometer?

Posted: Thu May 23, 2013 1:06 am
by TheFrog4u
I just tried the newest version from phiamo and it hovers quite.. ok.. still not very stable, but at least I got something for a couple of seconds :)
So I started to dig into the code a little bit and I like pretty much that the hover code is a own module now. My first study was to find out what the noise level of the pressure sensor and accelerometer is and by how much my ctrl value changes just randomly. So I just put *actuatorThrust = 0; and leafe the cf on a flat table. Then I tried to print out my pressure values:

Code: Select all

float pressureDifference = currentPressure - desiredPressure;
DEBUG_PRINT("%f   %f   %f\n",currentPressure, desiredPressure, pressureDifference);
and the result is

Code: Select all

HOV: 1006.966613   1006.951477   0.15136
HOV: 1006.956237   1006.951477   0.4760
HOV: 1006.948120   1006.951477   0.3356
HOV: 1006.964599   1006.951477   0.13122
HOV: 1006.935119   1006.951477   0.16357
-> So why is pressureDifference ALWAYS positiv?? If I try to print float test=-123.456; it perfectly shows as negativ value in the console. What am I doing wrog here?

Re: Self stabilizing using the 3-axis accelerometer?

Posted: Thu May 23, 2013 5:08 am
by DesTinY
TheFrog4u wrote:I just tried the newest version from phiamo and it hovers quite.. ok.. still not very stable, but at least I got something for a couple of seconds :)
So I started to dig into the code a little bit and I like pretty much that the hover code is a own module now. My first study was to find out what the noise level of the pressure sensor and accelerometer is and by how much my ctrl value changes just randomly. So I just put *actuatorThrust = 0; and leafe the cf on a flat table. Then I tried to print out my pressure values:

Code: Select all

float pressureDifference = currentPressure - desiredPressure;
DEBUG_PRINT("%f   %f   %f\n",currentPressure, desiredPressure, pressureDifference);
and the result is

Code: Select all

HOV: 1006.966613   1006.951477   0.15136
HOV: 1006.956237   1006.951477   0.4760
HOV: 1006.948120   1006.951477   0.3356
HOV: 1006.964599   1006.951477   0.13122
HOV: 1006.935119   1006.951477   0.16357
-> So why is pressureDifference ALWAYS positiv?? If I try to print float test=-123.456; it perfectly shows as negativ value in the console. What am I doing wrog here?
I have also problems with the DEBUG_PRINT() function. For long Strings the offline puffer is not big enough (reported). But i also found that float formatting like %2.3f is not implemented jet (not reported jet).
There is a BUG with the negative sign. It is a cast problem with the itoa() function (int)-0.456 = 0 (not reported jet).
But the bigger problem is that 1006.948120-1006.951477 not equal to 0.3356 is. Real value is 0.003356 a cast problem, too (see quote)
I will do a pull-request.

Re: Self stabilizing using the 3-axis accelerometer?

Posted: Thu May 23, 2013 11:33 am
by DesTinY
That should solve your problems: BitBucket Repo

Re: Self stabilizing using the 3-axis accelerometer?

Posted: Fri May 24, 2013 3:44 am
by rmirwin2
Hey Phillip,
Can't get any hover tonight after following your commits tonight in client and firmware, not sure what I'm missing.
In the client I notice "Hover" now requires a separate axis but when connected, I can't see what the Hover value does. I'm not sure why, but I couldn't figure out how to make the combination affect the hardware. Perhaps it was a symptom!
Just some feedback!
Rich

Re: Self stabilizing using the 3-axis accelerometer?

Posted: Mon May 27, 2013 4:59 pm
by simgaudas
Hi,
I have just started flying CF and wanted ti try self stabilization.
I am trying to build https://bitbucket.org/mjc506/crazyflie-firmware firmware and receive:
bitcraze@bitcraze-ubuntu:~$ cd ~/projects/mjc506
bitcraze@bitcraze-ubuntu:~/projects/mjc506$ make CLOUD=1 DEBUG=0
CLEAN_VERSION
VTMPL version.c
abort: there is no Mercurial repository here (.hg not found)
Traceback (most recent call last):
File "scripts/versionTemplate.py", line 20, in <module>
identify = subprocess.check_output(["hg", "identify", "-nitb"])
File "/usr/lib/python2.7/subprocess.py", line 544, in check_output
raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['hg', 'identify', '-nitb']' returned non-zero exit status 255
make: *** [version.c] Error 1
bitcraze@bitcraze-ubuntu:~/projects/mjc506$


What i am doing wrong?
Or can someone share .bin file?
any beginners guide link and tips would be more than welcome.

Re: Self stabilizing using the 3-axis accelerometer?

Posted: Tue May 28, 2013 4:26 am
by rmirwin2
Hello simgaudas,

Seems from your messages that no files are downloaded yet from the repositories to your local system.

I've found TortoiseHg Workbench, provided in the virtual machine, very useful for managing my local files. I hadn't used it before so I also saw some messages like those when I first got started. There is a learning curve, but it's well worth the time. Try the Help menu there. Path, Synchronize, Update, and Graph interpretation are the really critical to keep your local code updated and add new code from the repositories. It's a snap once you see how it works!

One you've used "Update" to get your code up to the Revision you want, then you want to use Eclipse, particularly if you're working the firmware, to Clean and then Build Project. Both TortoiseHg and Eclipse are provided pre-configured, so you can use them straight away on the Bitcraze repositories.

Naturally, there are many things you can do without using these tools, but you'll need depth in using the Hg (Mercurial) command line options directly.

I'm just a noob at using these excellent tools and I"m sure others here are more capable of writing a better tutorial!

Still, I hope this helps point you in the right direction!

Rich

Re: Self stabilizing using the 3-axis accelerometer?

Posted: Wed May 29, 2013 11:16 pm
by jtang613
I'd love to get this running here. My trouble is that after flashing Phiamo's latest firmware and running his PC client, my CF's motors won't spin at all.

I've mapped my xbox360 controller with RB as Hover Enable and RT as Hover Adjust, and the client correctly reads these and receives telemetry, but alas, no flight.

Flashing back to stock FW lets it fly manually, even with Phiamo's client.

Is there something I'm missing?

Re: Self stabilizing using the 3-axis accelerometer?

Posted: Thu May 30, 2013 1:03 am
by rmirwin2
To get your motors going, be sure and set debug=0 in the Parameter Tab!
It's defaulted to 1 in Philip's newer versions for safety reasons!
Rich