Page 3 of 6

Re: Tuning crazyflie for smooth, stable and responsive flight

Posted: Sat Jun 11, 2016 10:36 pm
by chad
nanobot9000 wrote:after I create the config.mk with the appropriate statement how do I know for sure that the build was correct aside from the behavior once I load it? Is there some number in this example that tells me it used my config.mk as part of enabling the experimental PID?
The config.mk file is in crazyflie-firmware/.gitignore, so it's ignored by git and won't show you that it's a modified build even if config.mk is present. If you wanted to make sure a flag has an effect on the binary you could remove (or rename) your config.mk file, build the binary clean, checksum it, put back the config.mk file, build clean again, checksum the binary again and see if the two checksums are different. If they are, your change had an effect. If not, it didn't.

e.g. (on the VM):

Code: Select all

cd ~/projects/crazyflie-firmware

mv tools/make/config.mk tools/make/config.mk.bak
make clean
make
md5 cf2.bin > md5.clean.txt # md5 hash for non-experimental PIDs

mv tools/make/config.mk.bak tools/make/config.mk
make clean
make
md5 cf2.bin > md5.experimental.txt # md5 hash for experimental PIDs

diff --brief md5.clean.txt md5.experimental.txt # Differences found? Flag worked.

rm md5.*.txt

Re: Tuning crazyflie for smooth, stable and responsive flight

Posted: Wed Jun 15, 2016 10:07 pm
by liwanggt
I did a simple comparison between the new and old PID parameters. The experiment set up is:
30s manual control using joystick
Optitrack motion capture system tracking the crazyflie2
ROS recording joystick command and Optitrack data

Here is the result. (yaw input is yawrate, ignored here)
1. Roll/Pitch response using old PID parameters. Average error is 2.92 degree for pitch, and 2.27 degree for roll. cmd is the joystick input, track is the Optitrack data.
Error_Old_PID.png
2. Roll/Pitch response using new PID parameters. Average error is 1.59 degree for pitch, and 2.22 degree for roll. cmd is the joystick input, track is the Optitrack data.
Error_New_PID.png
That's almost a 25% accuracy improvement. We can also see the crazyflie is now tracking large roll/pitch angle inputs very accurately. Very suitable for advanced flight. Great contribution indeed!

Li

Re: Tuning crazyflie for smooth, stable and responsive flight

Posted: Wed Jun 15, 2016 11:00 pm
by nanobot9000
chad wrote:
nanobot9000 wrote:after I create the config.mk with the appropriate statement how do I know for sure that the build was correct aside from the behavior once I load it? Is there some number in this example that tells me it used my config.mk as part of enabling the experimental PID?
The config.mk file is in crazyflie-firmware/.gitignore, so it's ignored by git and won't show you that it's a modified build even if config.mk is present. If you wanted to make sure a flag has an effect on the binary you could remove (or rename) your config.mk file, build the binary clean, checksum it, put back the config.mk file, build clean again, checksum the binary again and see if the two checksums are different. If they are, your change had an effect. If not, it didn't.

e.g. (on the VM):

Code: Select all

cd ~/projects/crazyflie-firmware

mv tools/make/config.mk tools/make/config.mk.bak
make clean
make
md5 cf2.bin > md5.clean.txt # md5 hash for non-experimental PIDs

mv tools/make/config.mk.bak tools/make/config.mk
make clean
make
md5 cf2.bin > md5.experimental.txt # md5 hash for experimental PIDs

diff --brief md5.clean.txt md5.experimental.txt # Differences found? Flag worked.

rm md5.*.txt
Thank you! Sorry for the late reply as I have been traveling. I will do what you said.

Re: Tuning crazyflie for smooth, stable and responsive flight

Posted: Thu Jun 16, 2016 11:26 pm
by theseankelly
Li, those graphs are super interesting to see. Thanks for sharing. Could you give a rough number for what the latency is? It's observable but too small to figure out what the value is from your graphs.

It's also really interesting to me that the roll error remained relatively constant between PID values as compared with pitch. I'd have expected them to be the same given the symmetrical design of the crazyflie.

Re: Tuning crazyflie for smooth, stable and responsive flight

Posted: Fri Jun 17, 2016 3:15 pm
by liwanggt
From what I observed during some autonomous flights, the latency is about 0.1s with logging frequency of 50Hz.

Yes, the Crazyflie is symmetric. But the tracking markers I attached to the Crazyflie is not symmetric. The markers I placed are slightly off the center in the roll direction. The motion capture system needs non-symmetric marker placement to identify correct heading direction and distinguish between multiple crazyflies.

Li
theseankelly wrote:Li, those graphs are super interesting to see. Thanks for sharing. Could you give a rough number for what the latency is? It's observable but too small to figure out what the value is from your graphs.

It's also really interesting to me that the roll error remained relatively constant between PID values as compared with pitch. I'd have expected them to be the same given the symmetrical design of the crazyflie.

Re: Tuning crazyflie for smooth, stable and responsive flight

Posted: Fri Jun 17, 2016 9:51 pm
by theseankelly
Are the markers heavy enough to alter the flight characteristics?

Re: Tuning crazyflie for smooth, stable and responsive flight

Posted: Mon Jun 20, 2016 8:13 pm
by liwanggt
My tracking markers weigh 1g each. I also have 3D printed frames hanging there. I assume they do influence the flight performance for a 27g crazyflie. But since current flight performance is rock solid, I didn't bother changing to lighter markers and frames.

Li
theseankelly wrote:Are the markers heavy enough to alter the flight characteristics?

Re: Tuning crazyflie for smooth, stable and responsive flight

Posted: Tue Jun 21, 2016 5:43 am
by jonschoning
Using rate mode (modifying commander.c to stabilizationModeRoll=RATE, stabilizationModePitch=RATE) and using new "experimental pid settings" (CFLAGS+=-DEXPERIMENTAL_ATTITUDE_PID) makes flight MUCH better, thank you!

with stabilizationModeRoll/stabilizationModePitch = ANGLE the crazyflie would flip over very easily... now it's much harder to flip when the crazyflie is moving at a decent clip.

Re: Tuning crazyflie for smooth, stable and responsive flight

Posted: Tue Jun 21, 2016 11:51 am
by chad
jonschoning wrote:with stabilizationModeRoll/stabilizationModePitch = ANGLE the crazyflie would flip over very easily... now it's much harder to flip when the crazyflie is moving at a decent clip.
I have the same experience WRT angle vs. rate and flipping.

Re: Tuning crazyflie for smooth, stable and responsive flight

Posted: Fri Jul 15, 2016 4:08 pm
by Yaro
I've recently tried new Experimental PID and it' very very smooth in movements that my previous settings(little vibrations on movements). I've just lowered values in proportion to have less agressive response when flying indoor(of course I think it's the same to lowering controller sensibility).
The problem is that I've too this 'slippery' feeling like being on ice. Maybe outdoor this is not a problem, but indoor it's quite hard to hover since I must constantly counter this 'slippery' after each movement.

Some kind of react control was implemented to null or reduce this effect?