Thread Tools
May 10, 2015, 05:00 AM
Registered User
zenman's Avatar
Quote:
Originally Posted by SplinterNL
Hi all,

I've been searching a lot, but can't seem to find a proper 'tutorial' on how to use (read) blackbox data to optimize PID tuning.

I understand oscillations in gyro and motors are to be minimized, but wouldn't know for sure if I should increase/decrease P, I or D. Also I'm confident I would find out experimentally in the end, but I guess lots have gone this path before.

For example, attached a log with 3 sessions, all using slightly different profiles. How to judge objectively which is the best? (yep, there's a crash in there).

Thanks for any help or links!!
Looking at the 3rd part of the log it looks like copter is continuing to rotate on roll after you center your sticks. You probably need more P.
Sign up now
to remove ads between posts
May 10, 2015, 05:09 AM
Registered User
zenman's Avatar
Quote:
Originally Posted by JohnOCFII
Greetings, I need to figure out how to overlay this on the video, and then trim it down, but I thought I'd upload a log file to start and see if I can get any advice right off the bat.

The frame is a Hoverthings H260
Sunnysky 2204 2300KV motors.
Velotech 12A ESCs.
2200 man battery.
MinimOSD
DragonFly 32 Pro (Naze clone)
6030 Gemfan props
GPS on a mast

LuxFloat PID Controller

My maiden flight was a week ago, and the ship moved like a drunken sailor. I balanced the props and yesterday was my next attempt at flight. It's very hard to control. Even in Level mode (which is what you see here, you'll see that I can't even hold a hover!

Looking at a few things in the log, I see lots of movement. One surprising thing to me is that the baro continues to fall unless I'm actively climbing. There are lots of other odd things too.

I attempted a flight in acro mode (not included in this log) and I don't get up more than 6 inches off the ground before I lose control.

The first part of the log with no activity is just me waiting for the GPS signal to lock in. My goal for the flight was to hover about 6 feet off the ground. You can see how well that worked (not very).

Any ideas where to start?

Thanks,

John
Looks like there might be a problem with the rear left motor as it is maxing out most of the time. It really looks like the motors are not responding correctly. Are you sure you have them connected in the right order?
Last edited by zenman; May 10, 2015 at 05:16 AM.
May 10, 2015, 07:30 AM
Build & Crash
Thanks Zenman, just back from the field trying to get a feel for the different profiles - onboard logging disabled btw. I will continue experimenting, so far so good
May 10, 2015, 08:10 AM
Registered User
Quote:
Originally Posted by joshuabardwell
Do you have a piece of foam over your baro? Is it shaded from sunlight?
Yes, there is a large piece of gray foam between the barometric sensor and the middle plate of the frame. This is a DragonFly32 Pro, with the sensor on the bottom of the FC.

Quote:
Baro based altitude hold requires a ton of careful tuning, and even at its best, it doesn't work terribly well. If you want proper altitude hold, you really need GPS. That's my experience, anyway.
Yes, I know it is not known to work all that well, but the decreasing "altitude" seems weird. I do also have a GPS on board.

Here's a photo of my rig.

Thanks,

John
May 10, 2015, 08:22 AM
Registered User
Quote:
Originally Posted by zenman
Looks like there might be a problem with the rear left motor as it is maxing out most of the time. It really looks like the motors are not responding correctly. Are you sure you have them connected in the right order?
I did see in the logs that the rear left motor did seem to be at full power much of the time. I just re-confirmed the motor connections visually, and using the motor tab in cleanflight.

Thanks for the pointer.

John
May 12, 2015, 04:33 PM
Registered User
thenickdude's Avatar
John, try recalibrating the ESCs, incorrect calibration could cause one motor to require much higher commands to spin at the same speed as the others.
May 12, 2015, 04:46 PM
Registered User
Quote:
Originally Posted by thenickdude
John, try recalibrating the ESCs, incorrect calibration could cause one motor to require much higher commands to spin at the same speed as the others.
I'll do that.

Just curious -- in what situations should you need to recalibrate? The motor-ESC-PDB-battery and flight controller haven't changed since the last time I calibrated. I can't say for sure if I calibrated prior to Cleanflight 1.8.1 or after moving to 1.8.1.

Any thoughts about the baro behavior? It drops pretty much continually once the system starts, even if sitting on the ground.

Thanks.

John
May 13, 2015, 01:43 AM
Registered User
thenickdude's Avatar
The calibration shouldn't drift significantly over time, but I think it's possible for some weird motor commands during startup to cause the ESC to inadvertently enter a programming mode and reset its own calibration.

You didn't accidentally mount a prop of the wrong direction onto that motor? That'd cause a severe loss of thrust from it.

That baro looks totally crazy, you can definitely forget about trying to fly in a GPS or altitude hold mode when it's behaving like that. Does it look like that in the Configurator's sensors tab too?

Can you do a "dump" on the CLI tab and paste the output here?
May 13, 2015, 11:51 AM
Registered User
FYI ESC Calibration Completed again.

Quote:
Originally Posted by thenickdude
The calibration shouldn't drift significantly over time, but I think it's possible for some weird motor commands during startup to cause the ESC to inadvertently enter a programming mode and reset its own calibration.
Thanks.

Quote:
You didn't accidentally mount a prop of the wrong direction onto that motor? That'd cause a severe loss of thrust from it.
I double checked. Blades were mounted correctly. The fact that the vendor shipped CCW as one color and CW as the other actually helped in this case.

Quote:
That baro looks totally crazy, you can definitely forget about trying to fly in a GPS or altitude hold mode when it's behaving like that. Does it look like that in the Configurator's sensors tab too?
Sigh -- yes, it is dropping in the Cleanflight Configurator as well. Can this be anything other than a board problem at this stage?

Quote:
Can you do a "dump" on the CLI tab and paste the output here?
Code:
2015-05-13 @ 11:05:46 -- Running - OS: MacOS, Chrome: 42.0.2311.135, Configurator: 0.63.1
2015-05-13 @ 11:06:26 -- Serial port successfully opened with ID: 1
2015-05-13 @ 11:06:26 -- MultiWii API version received - 1.8
2015-05-13 @ 11:06:27 -- Flight controller info, identifier: CLFL, version: 1.8.1
2015-05-13 @ 11:06:27 -- Running firmware released on: Apr 2 2015 17:06:11
2015-05-13 @ 11:06:27 -- Board: AFNA, version: 1
2015-05-13 @ 11:06:27 -- Unique device ID received - 0x671ff485755776767122317
2015-05-13 @ 11:06:58 -- Accelerometer calibration started
2015-05-13 @ 11:07:00 -- Accelerometer calibration finished
2015-05-13 @ 11:08:37 -- Magnetometer calibration started
2015-05-13 @ 11:09:07 -- Magnetometer calibration finished
2015-05-13 @ 11:11:57 -- Serial port successfully closed
2015-05-13 @ 11:39:08 -- Serial port successfully opened with ID: 2
2015-05-13 @ 11:39:08 -- MultiWii API version received - 1.8
2015-05-13 @ 11:39:08 -- Flight controller info, identifier: CLFL, version: 1.8.1
2015-05-13 @ 11:39:08 -- Running firmware released on: Apr 2 2015 17:06:11
2015-05-13 @ 11:39:08 -- Board: AFNA, version: 1
2015-05-13 @ 11:39:08 -- Unique device ID received - 0x671ff485755776767122317
2015-05-13 @ 11:39:54 -- Serial port successfully closed
2015-05-13 @ 11:40:18 -- Serial port successfully opened with ID: 3
2015-05-13 @ 11:40:18 -- MultiWii API version received - 1.8
2015-05-13 @ 11:40:18 -- Flight controller info, identifier: CLFL, version: 1.8.1
2015-05-13 @ 11:40:18 -- Running firmware released on: Apr 2 2015 17:06:11
2015-05-13 @ 11:40:18 -- Board: AFNA, version: 1
2015-05-13 @ 11:40:18 -- Unique device ID received - 0x671ff485755776767122317
Setup
Ports
Configuration
PID Tuning
Receiver
Modes
Adjustments
Servos
GPS
Motors
LED Strip
Sensors
Logging
Dataflash
CLI
Note: Leaving CLI tab or pressing Disconnect will automatically send "exit" to the board. With the latest firmware this will make the controller restart and unsaved changes will be lost.
Entering CLI Mode, type 'exit' to return, or 'help'

# dump

# version
Cleanflight/NAZE 1.8.1 Apr 2 2015 / 17:06:11 (988ae2d)
# dump master

# mixer
mixer QUADX


# feature
feature -RX_PPM
feature -VBAT
feature -INFLIGHT_ACC_CAL
feature -RX_SERIAL
feature -MOTOR_STOP
feature -SERVO_TILT
feature -SOFTSERIAL
feature -GPS
feature -FAILSAFE
feature -SONAR
feature -TELEMETRY
feature -CURRENT_METER
feature -3D
feature -RX_PARALLEL_PWM
feature -RX_MSP
feature -RSSI_ADC
feature -LED_STRIP
feature -DISPLAY
feature -ONESHOT125
feature -BLACKBOX
feature RX_PPM
feature VBAT
feature SOFTSERIAL
feature GPS
feature FAILSAFE
feature TELEMETRY
feature BLACKBOX


# map
map TAER1234


# led
led 0 15,15:ES:IA:0
led 1 15,8:E:WF:0
led 2 15,7:E:WF:0
led 3 15,0:NE:IA:0
led 4 8,0:N:F:0
led 5 7,0:N:F:0
led 6 0,0:NW:IA:0
led 7 0,7:W:WF:0
led 8 0,8:W:WF:0
led 9 0,15:SW:IA:0
led 10 7,15:S:WF:0
led 11 8,15:S:WF:0
led 12 7,7:U:WF:0
led 13 8,7:U:WF:0
led 14 7,8:D:WF:0
led 15 8,8:D:WF:0
led 16 8,9::R:3
led 17 9,10::R:3
led 18 10,11::R:3
led 19 10,12::R:3
led 20 9,13::R:3
led 21 8,14::R:3
led 22 7,14::R:3
led 23 6,13::R:3
led 24 5,12::R:3
led 25 5,11::R:3
led 26 6,10::R:3
led 27 7,9::R:3
led 28 0,0:::0
led 29 0,0:::0
led 30 0,0:::0
led 31 0,0:::0


# color
color 0 0,0,0
color 1 0,255,255
color 2 0,0,255
color 3 30,0,255
color 4 60,0,255
color 5 90,0,255
color 6 120,0,255
color 7 150,0,255
color 8 180,0,255
color 9 210,0,255
color 10 240,0,255
color 11 270,0,255
color 12 300,0,255
color 13 330,0,255
color 14 0,0,0
color 15 0,0,0

set looptime = 3500
set emf_avoidance = 0
set mid_rc = 1500
set min_check = 1100
set max_check = 1900
set rssi_channel = 7
set rssi_scale = 30
set input_filtering_mode = 0
set min_throttle = 1075
set max_throttle = 2000
set min_command = 1000
set servo_center_pulse = 1500
set 3d_deadband_low = 1406
set 3d_deadband_high = 1514
set 3d_neutral = 1460
set 3d_deadband_throttle = 50
set motor_pwm_rate = 400
set servo_pwm_rate = 50
set retarded_arm = 0
set disarm_kill_switch = 1
set auto_disarm_delay = 5
set small_angle = 25
set flaps_speed = 0
set fixedwing_althold_dir = 1
set serial_port_1_functions = 129
set serial_port_1_msp_baudrate = 5
set serial_port_1_telemetry_baudrate = 0
set serial_port_1_blackbox_baudrate = 7
set serial_port_1_gps_baudrate = 4
set serial_port_2_functions = 1
set serial_port_2_msp_baudrate = 5
set serial_port_2_telemetry_baudrate = 0
set serial_port_2_blackbox_baudrate = 5
set serial_port_2_gps_baudrate = 4
set serial_port_3_functions = 4
set serial_port_3_msp_baudrate = 5
set serial_port_3_telemetry_baudrate = 1
set serial_port_3_blackbox_baudrate = 5
set serial_port_3_gps_baudrate = 4
set serial_port_4_functions = 2
set serial_port_4_msp_baudrate = 5
set serial_port_4_telemetry_baudrate = 0
set serial_port_4_blackbox_baudrate = 5
set serial_port_4_gps_baudrate = 1
set reboot_character = 82
set gps_provider = 1
set gps_sbas_mode = 0
set gps_auto_config = 1
set gps_auto_baud = 0
set serialrx_provider = 0
set spektrum_sat_bind = 0
set telemetry_switch = 0
set telemetry_inversion = 1
set frsky_default_lattitude = 0.000
set frsky_default_longitude = 0.000
set frsky_coordinates_format = 0
set frsky_unit = 0
set frsky_vfas_precision = 1
set battery_capacity = 0
set vbat_scale = 110
set vbat_max_cell_voltage = 43
set vbat_min_cell_voltage = 33
set vbat_warning_cell_voltage = 35
set current_meter_scale = 400
set current_meter_offset = 0
set multiwii_current_meter_output = 0
set current_meter_type = 1
set align_gyro = 0
set align_acc = 0
set align_mag = 0
set align_board_roll = 0
set align_board_pitch = 0
set align_board_yaw = 90
set max_angle_inclination = 500
set gyro_lpf = 42
set moron_threshold = 32
set gyro_cmpf_factor = 600
set gyro_cmpfm_factor = 250
set yaw_control_direction = 1
set pid_at_min_throttle = 1
set acc_hardware = 0
set mag_hardware = 0
set blackbox_rate_num = 1
set blackbox_rate_denom = 1
set blackbox_device = 0

# dump profile

# profile
profile 0

# aux
aux 0 1 0 900 1250
aux 1 2 0 1250 1700
aux 2 12 1 1425 2100
aux 3 0 0 900 900
aux 4 0 0 900 900
aux 5 0 0 900 900
aux 6 0 0 900 900
aux 7 0 0 900 900
aux 8 0 0 900 900
aux 9 0 0 900 900
aux 10 0 0 900 900
aux 11 0 0 900 900
aux 12 0 0 900 900
aux 13 0 0 900 900
aux 14 0 0 900 900
aux 15 0 0 900 900
aux 16 0 0 900 900
aux 17 0 0 900 900
aux 18 0 0 900 900
aux 19 0 0 900 900
aux 20 0 0 900 900
aux 21 0 0 900 900
aux 22 0 0 900 900
aux 23 0 0 900 900
aux 24 0 0 900 900
aux 25 0 0 900 900
aux 26 0 0 900 900
aux 27 0 0 900 900
aux 28 0 0 900 900
aux 29 0 0 900 900
aux 30 0 0 900 900
aux 31 0 0 900 900
aux 32 0 0 900 900
aux 33 0 0 900 900
aux 34 0 0 900 900
aux 35 0 0 900 900
aux 36 0 0 900 900
aux 37 0 0 900 900
aux 38 0 0 900 900
aux 39 0 0 900 900

# adjrange
adjrange 0 0 0 900 900 0 0
adjrange 1 0 0 900 900 0 0
adjrange 2 0 0 900 900 0 0
adjrange 3 0 0 900 900 0 0
adjrange 4 0 0 900 900 0 0
adjrange 5 0 0 900 900 0 0
adjrange 6 0 0 900 900 0 0
adjrange 7 0 0 900 900 0 0
adjrange 8 0 0 900 900 0 0
adjrange 9 0 0 900 900 0 0
adjrange 10 0 0 900 900 0 0
adjrange 11 0 0 900 900 0 0

# servo
servo 0 1020 2000 1500 30 -1
servo 1 1020 2000 1500 30 -1
servo 2 1020 2000 1500 100 -1
servo 3 1020 2000 1500 100 -1
servo 4 1020 2000 1500 100 -1
servo 5 1020 2000 1500 100 -1
servo 6 1020 2000 1500 100 -1
servo 7 1020 2000 1500 100 -1

set gps_pos_p = 15
set gps_pos_i = 0
set gps_pos_d = 0
set gps_posr_p = 34
set gps_posr_i = 14
set gps_posr_d = 53
set gps_nav_p = 25
set gps_nav_i = 33
set gps_nav_d = 83
set gps_wp_radius = 200
set nav_controls_heading = 1
set nav_speed_min = 100
set nav_speed_max = 300
set nav_slew_rate = 30
set alt_hold_deadband = 40
set alt_hold_fast_change = 1
set deadband = 0
set yaw_deadband = 0
set throttle_correction_value = 0
set throttle_correction_angle = 800
set yaw_direction = 1
set tri_unarmed_servo = 1
set servo_lowpass_freq = 400
set servo_lowpass_enable = 0
set default_rate_profile = 0
set failsafe_delay = 10
set failsafe_off_delay = 200
set failsafe_throttle = 1000
set failsafe_min_usec = 985
set failsafe_max_usec = 2115
set gimbal_flags = 1
set acc_lpf_factor = 4
set accxy_deadband = 40
set accz_deadband = 40
set accz_lpf_cutoff = 5.000
set acc_unarmedcal = 1
set acc_trim_pitch = 0
set acc_trim_roll = 0
set baro_tab_size = 21
set baro_noise_lpf = 0.600
set baro_cf_vel = 0.985
set baro_cf_alt = 0.965
set mag_declination = 10
set pid_controller = 2
set p_pitch = 40
set i_pitch = 30
set d_pitch = 23
set p_roll = 40
set i_roll = 30
set d_roll = 23
set p_yaw = 85
set i_yaw = 45
set d_yaw = 0
set p_pitchf = 2.200
set i_pitchf = 0.500
set d_pitchf = 0.040
set p_rollf = 2.200
set i_rollf = 0.500
set d_rollf = 0.040
set p_yawf = 7.000
set i_yawf = 0.300
set d_yawf = 0.040
set level_horizon = 3.000
set level_angle = 5.000
set sensitivity_horizon = 75
set p_alt = 50
set i_alt = 0
set d_alt = 0
set p_level = 90
set i_level = 10
set d_level = 100
set p_vel = 120
set i_vel = 45
set d_vel = 1

# dump rates

# rateprofile
rateprofile 0

set rc_rate = 90
set rc_expo = 65
set thr_mid = 50
set thr_expo = 0
set roll_rate = 40
set pitch_rate = 40
set yaw_rate = 20
set tpa_rate = 0
set tpa_breakpoint = 1500

#
May 14, 2015, 04:11 AM
Registered User
thenickdude's Avatar
Yeah the baro sounds broken to me. Put baseflight back on it (if it shipped with baseflight), then report the broken baro to the reseller if it still does it there.

If you spin up each motor individually on the motors tab, do they all start spinning by your minthrottle value (1075) and deliver a smooth response all the way to max throttle? Best to remove props to test this one.
May 14, 2015, 08:19 AM
Registered User
Quote:
Originally Posted by thenickdude
Yeah the baro sounds broken to me. Put baseflight back on it (if it shipped with baseflight), then report the broken baro to the reseller if it still does it there.
That's a good idea to test with Baseflight. The board vendor (MultiRotorMania http://multirotormania.com/32-bit-/2...fly32-pro.html ) is actually shipping with Cleanflight by default now, but it'll be a good test.

If you spin up each motor individually on the motors tab, do they all start spinning by your minthrottle value (1075) and deliver a smooth response all the way to max throttle? Best to remove props to test this one.[/QUOTE]

Yes they do. They all start about 1065 and are smooth up to top of throttle and all the way back down.


Thanks.
May 16, 2015, 10:50 PM
Registered User
Quote:
Originally Posted by zenman
Looks like there might be a problem with the rear left motor as it is maxing out most of the time.
As mentioned earlier, I double-checked connections, recalibrated, but all seemed normal. I replaced the left rear prop today, as it had broken after the uploaded events. I made sure to tighten the blades tightly.

I also switched from CleanFlight PID Controller 2 (LuxFloat) to PID Controller 3 (MultiWii23), which, for me, seemed to be much easier to control, at least in Level mode. [I'm just a pup, so that is where I'm starting.] This is with CF 1.8.1.

Anyway -- I don't know if it was the new prop, tightening the props, or the change in PID Controllers, but things looked better today.

The barometer was still pretty messed up.

My next question is whether or not the mag compass is behaving or not. I don't want to try to enable an GPS altitude hold until I know if I can trust the other sensors too.

Logs from today's short attempts at (mostly) Hovering LOS attached. I've got the FPV camera video recorded to my DVR. I'll need to play with the decode and matching process.

It was quite gusty, with winds out of the southwest at 10 gusting to 18 knots.

Thanks,


John
May 17, 2015, 04:05 PM
Registered User
User Name Kanifee
FC: naze32, Cleanflight 1.81
PID Controller # 2(luxfloat ) (Cleanflight)
Name Proportional Integral Derivative
ROLL.......(0.9 )......(0.028 ).......(6 )
PITCH......(2.1)......(0.031 ).......(14 )
YAW........(6.3 )......(0.050 ).......(0 )
LEVEL......( 5.0)......(0.030 )...... (75 )
Roll & Pitch rate: 0.42-- 0.38
Yaw rate: 0.38
TPA:
RC Rate:1.20
RC Expo: 70
Looptime:1600

Esc: Flash:blheli 13.2
Frame: Zmr250
Motors: Emax 2206 1900kv
Canted Mounts: Yes/No: Degree of Cant--.no
Props (including model\brand):Gemfan 6045
LiPo:2200mah 4s 65c-130c
Flying Weight:740g
Flying Style: (Acro, race, photo, cruizin, avoiding the ground) Acro/proximity fpv
Special tuning notes: Tried traditional tuning but for the life of me I can not tune out the bounce after rolls and flips, this is the closest I have had it but now with these pids I notice oscillation in hard manoeuvres, fast turns into prop wash, I did have I & D for pitch and roll in the 40-60 and 50+ range respectively and had much better stability in prop wash scenarios but the bounce issue was far more severe. Also probably too windy really but its the first time it has been any where near flyable so I thought I would get out and try.
Blackbox tuning flight. (1 min 19 sec)


would love for someone to explain what exactly they are seeing in the vdeo and how that correlates to the state of the tune so I can learn how to read this data in a useful manner.
May 17, 2015, 04:30 PM
Registered User
Quote:
Originally Posted by kanifee
would love for someone to explain what exactly they are seeing in the vdeo and how that correlates to the state of the tune so I can learn how to read this data in a useful manner.
Can you post your Blackbox log file so people can pick through it? Stuff goes by pretty fast on the video. Also, it's hard to see some of the lines against the background.

I'm going to install the data logger on my quad this week and start learning to use it to tune. I'd love to pick through your example as a case study. I also fly Luxfloat on a similar quad, and have been spending a lot of time tuning it lately.

Have you tried leaving your I values where they are and increasing D? I have found it impossible to get rid of all the bounce on pitch, but my rolls are rock solid, with no bounce at all. So maybe start with the roll axis.
May 17, 2015, 04:40 PM
Registered User
I tried uploading the log but the website said it was to large at 5mb.


Quick Reply
Message:

Thread Tools