Git Product home page Git Product logo

inavflight / inav Goto Github PK

View Code? Open in Web Editor NEW
3.0K 157.0 1.4K 270.63 MB

INAV: Navigation-enabled flight control software

Home Page: https://inavflight.github.io

License: GNU General Public License v3.0

C 96.60% C++ 0.11% Assembly 2.61% HTML 0.47% Shell 0.01% Batchfile 0.01% Perl 0.01% Ruby 0.05% Python 0.02% Dockerfile 0.01% CMake 0.11% Emacs Lisp 0.01% Vim Script 0.01%
inav autopilot fpv rc quadcopter airplane hacktoberfest

inav's People

Contributors

avsaase avatar bkleiner avatar borisbstyle avatar breadoven avatar digitalentity avatar dzikuvx avatar fiam avatar giacomo892 avatar hydra avatar juliocesarmatias avatar ledvinap avatar martinbudden avatar mj666 avatar mluessi avatar mmosca avatar mrd-rc avatar nmaggioni avatar optimusti avatar pulsar256 avatar romanlut avatar sambas avatar scavanger avatar sensei-hacker avatar shellixyz avatar shota3527 avatar stronnag avatar teckel12 avatar thenickdude avatar treymarc avatar trollcop avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

inav's Issues

NAV - Move zero XYZ coordinates to launch point

GPS produces LAT/LON data in degrees, NAV operates in centimeters. This complicates code and reduces code clarity. I.e. calculatePositionError takes currentPos and destinationPos in GPS points, but error is output in centimeters. Or this code:

newVelX = posError.coordinates[LAT] * posControl.pids.pos[X].param.kP;

LAT and X are all mixed up and one have to think what the heck this line does.

A good way would be to remap the beginning of coordinate system to launch point, convert sperical GPS coordinates to centimeter measurements and do flat calculations through the rest of the code. It would also simplify fusing GPS altitude, sonar altitude and baro altitude together. Adding optical flow in future would be simplified as well.

NAV - Code review & flight tests

Ok, seems that I'm done with major code changes. From now on most code changes will be bugfixes. A code review is now necessary to find bugs I've missed while developing this. Also latest commits intended to solve #31 introduced some major changes and I've might have broken something in process.
@dkisselev, @csurf I would appreciate your help with this 😏

NAV - Make sure dead reckoning and GPS work together

Given two conditions:

  1. Flying with dead reckoning
  2. Not having a valid GPS fix

We can end up getting a GPS fix after position estimator is inialised by ded-reckoning. This can (and probably will) result is a jump in estimated position and cause the machine to drift fast.

nav_rth_altitude variable type too small

nav_rth_altitude variable is defined as UINT8, which is too small to accommodate practical altitude values in centimeters. Eg., a height value of 20m would be '2000cm', which obviously won't fit into an unsigned char. Changing the definition to UINT16 solves the problem.

NAV - Improve altitude calculations

  1. Use GPS + Baro + Sonar together as altitude sources.
  2. Keep track of relative altitude (relative to home) for NAV purposes. If craft is on the ground, unARMed, altitude for NAV purposes will always be zero and gps/baro offset it constantly adjusted.
  3. Fuse Baro and GPS together to get the actual climb rate. Combine that with IMU.

ALThold mode not working on my 180 quad

Tested your latest naze hex form your dropbox today. Tried the ALThold mode on my 180 quad. Board: naze32 Full. When I put the quad in ALTHOLD it stays for a while but then starts slowly sinking to the ground. Could be the PIDs. The strange thing though is that the quad don't respond to throttle input while in althold mode. I could't raise the quad by increasing the throttle.

mwosd compatibility

I tested your 0710 build today. It would be extremely helpful to show current flightmode in mwosd like it already works in cleanflight master.

β€’ when I activate ALTHOLD the OSD does not sho baro sensor active
β€’ in POSHOLD we should see the "Position hold" message like in master
β€’ in RTH we should see the "return to home" message like in master

Maybe you could integrate this functionality or simulate the master behavior.

GPS - Increase automatically configured update rate for UBLOX modules

@digitalentity I've noticed that ublox from main streamline uses 5Hz update rate, even if you set manually the gps settings to 10Hz whenever you start back the FC it will automatically reset it to 5Hz,
I've noticed that the incriminated lines are inside ..\io\gps.c, changing the line 150 with
this "0xB5, 0x62, 0x06, 0x08, 0x06, 0x00, 0x64, 0x00, 0x01, 0x00, 0x01, 0x00, 0x7A, 0x12," will make the trick

Flight - Issues with AIRPLANE mixer on CC3D boards

I have opened issues #1323 & #1324 in main CF code, so I found that sensors stops readings when reseting the CC3D.

I opened here because if anybody could test a CC3D board and reproduce the problems/solve them, I think here could be more people interested in fixed wings than in main CF code forums (everybody seems to play only with quadcopters :-))..

Docs - Write documentation for new features and parameters

Seems like NAV PID controller code is stable enough and won't be changing much. NAV uses ALT, VEL, POS and POSR PIDs. We need to update docs with description what these PIDs do and how changed PID values will alter copter behaviour.

NAV - Remove NavR PID

Both PosR and NavR PIDs are built to achieve the same goal - convert velocity error to attitude. There is no need to have 2 PIDs as they both take the same input and provide (in theory) the same output.

Flight - Offload wind compensation from navigation PIDs

Given:

  1. Main goal of PH PIDs is to counteract position drift.
  2. Main source of drift is wind.
  3. Wind is mostly constant in speed and direction with occasionally gusts

Copter can use its velocity estimator to estimate tilt angles required to compensate wind the same way automatic throttle tilt compensation works. When wind compensation is uninitialised or not yet locked on required tilt angles common PosR PID will do it's job, but after wind compensation initialises, PosR PID will be required to only compensate for gusts, GPS drift, miscalibrated accelerometer and other minor causes of position drift. This will speed up the response or PosR PID and improve poshold stability.

NAV - Althold problems

Setup: use_midrc_for_althold=1, throttle input=1500, altitude drifts. Possible cause - insufficent I-term to compensate for thermals, algorithm flaw, barometer problems.

I2C Nav board not working

@digitalentity I've received the i2c GPS nav-board, I've flashed with 2.2 version from EOSBAND, i2c nav board reads the data from the GPS but I can't see anything it on cleanflight configurator, is there any particular setting do I have to activate to make it work or am I using the wrong firmware?

Feedback 0710 build

I tested your 0710 build today with my 350 class quad. naze32 full (mag removed), neo-8m GPS and external compass. Average satellite count: 12. AUW 1.2 kg. Hovering point: 63% throttle.

β€’ ALTOHOLD works like a charm. I love it!

β€’ POSHOLD works for me ok…ish. The quad starts to fly in circles after a short while. The radius increases over time. Calibrated my compass three times but the behavior didn't change. It was little windy - 12 km/h.

β€’ I little confused about RTH mode: Does it should keep the height by itself? When I activate RTH the quad starts immediately sinking until is hits the ground. It should come back to me and then attempt to land, right? nav_rth_alt_mode is set to 2, nav_rth_altitude is set to default 1000 (is this in cm or mm?). When I activate RTH and ALHOLD the quad is flying back in my direction but drifts to the right. It worked pretty precise in CF 1.9. I maybe have to check my compass, but I didn't explain the sinking to the ground in RTH. Tested all modes in 5-10m height and 20-40 m radius.

version

Cleanflight/NAZE 1.11.0 Oct 7 2015 / 07:05:31 (ba11933)

pflags

Persistent config flags: 0x00000001

dump master

mixer

mixer QUADX
mmix reset
smix reset

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 -CHANNEL_FORWARDING
feature RX_PPM
feature VBAT
feature MOTOR_STOP
feature GPS
feature FAILSAFE
feature TELEMETRY
feature LED_STRIP

map

map AETR1234

serial

serial 0 1 115200 57600 0 115200
serial 1 2 115200 115200 0 115200

led

led 0 3,2::C:6
led 1 2,1::WC:6
led 2 1,0::C:6
led 3 3,5::C:2
led 4 2,6::WC:2
led 5 1,7::C:2
led 6 5,5::WA:0
led 7 6,5::WA:0
led 8 8,5::C:2
led 9 9,6::WC:2
led 10 10,7::C:2
led 11 8,2::C:6
led 12 9,1::WC:6
led 13 10,0::C:6
led 14 0,0:::0
led 15 0,0:::0
led 16 0,0:::0
led 17 0,0:::0
led 18 0,0:::0
led 19 0,0:::0
led 20 0,0:::0
led 21 0,0:::0
led 22 0,0:::0
led 23 0,0:::0
led 24 0,0:::0
led 25 0,0:::0
led 26 0,0:::0
led 27 0,0:::0
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 = 0
set rssi_scale = 30
set rssi_ppm_invert = 0
set rc_smoothing = 1
set input_filtering_mode = 0
set min_throttle = 1050
set max_throttle = 1900
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 = 0
set auto_disarm_delay = 10
set small_angle = 25
set reboot_character = 82
set gps_provider = 1
set gps_sbas_mode = 1
set gps_auto_config = 1
set gps_auto_baud = 0
set inav_dead_reckoning = 0
set inav_gps_delay = 200
set inav_w_z_baro_p = 1.000
set inav_w_z_baro_v = 0.500
set inav_w_z_sonar_p = 2.000
set inav_w_z_sonar_v = 1.000
set inav_w_z_gps_p = 0.300
set inav_w_z_gps_v = 0.300
set inav_w_xy_gps_p = 1.000
set inav_w_xy_gps_v = 2.000
set inav_w_xy_dr_p = 0.050
set inav_w_xy_dr_v = 0.050
set inav_w_z_res_v = 0.500
set inav_w_xy_res_v = 0.500
set inav_max_eph_epv = 1000.000
set inav_sonar_epv = 20.000
set inav_baro_epv = 100.000
set nav_use_midrc_for_althold = 1
set nav_throttle_tilt_comp = 1
set nav_lock_until_takeoff = 0
set nav_user_control_mode = 0
set nav_pterm_cut_hz = 20
set nav_dterm_cut_hz = 15
set nav_wp_radius = 200
set nav_max_speed = 500
set nav_manual_speed = 500
set nav_manual_climb_rate = 200
set pos_hold_deadband = 20
set alt_hold_deadband = 40
set nav_min_rth_distance = 500
set nav_rth_alt_mode = 2
set nav_rth_altitude = 1000
set serialrx_provider = 1
set spektrum_sat_bind = 0
set telemetry_switch = 0
set telemetry_inversion = 0
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 = 0
set hott_alarm_sound_interval = 5
set battery_capacity = 0
set vbat_scale = 110
set vbat_max_cell_voltage = 43
set vbat_min_cell_voltage = 34
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 = 2
set align_board_roll = 0
set align_board_pitch = 0
set align_board_yaw = 0
set max_angle_inclination = 350
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 yaw_motor_direction = 1
set yaw_jump_prevention_limit = 200
set tri_unarmed_servo = 1
set servo_lowpass_freq = 400
set servo_lowpass_enable = 0
set failsafe_delay = 10
set failsafe_off_delay = 200
set failsafe_throttle = 1400
set failsafe_kill_switch = 0
set failsafe_throttle_low_delay = 100
set rx_min_usec = 985
set rx_max_usec = 2115
set acc_hardware = 0
set baro_hardware = 0
set mag_hardware = 0
set blackbox_rate_num = 1
set blackbox_rate_denom = 1
set blackbox_device = 1
set magzero_x = -18
set magzero_y = -281
set magzero_z = 22

rxfail

rxfail 0 a
rxfail 1 a
rxfail 2 a
rxfail 3 a
rxfail 4 h
rxfail 5 h
rxfail 6 h
rxfail 7 h
rxfail 8 h
rxfail 9 h
rxfail 10 h
rxfail 11 h
rxfail 12 h
rxfail 13 h
rxfail 14 h
rxfail 15 h
rxfail 16 h
rxfail 17 h

dump profile

profile

profile 0

aux

aux 0 1 0 900 2100
aux 1 23 0 1500 2100
aux 2 24 1 1350 1475
aux 3 25 1 1850 2100
aux 4 9 1 1850 2100
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

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

rxrange

rxrange 0 1000 2000
rxrange 1 1000 2000
rxrange 2 1000 2000
rxrange 3 1000 2000

servo

servo 0 1000 2000 1500 90 90 100 -1
servo 1 1000 2000 1500 90 90 100 -1
servo 2 1000 2000 1500 90 90 100 -1
servo 3 1000 2000 1500 90 90 100 -1
servo 4 1000 2000 1500 90 90 100 -1
servo 5 1000 2000 1500 90 90 100 -1
servo 6 1000 2000 1500 90 90 100 -1
servo 7 1000 2000 1500 90 90 100 -1

set gps_pos_p = 15
set gps_pos_i = 0
set gps_pos_d = 0
set gps_posr_p = 90
set gps_posr_i = 15
set gps_posr_d = 1
set gps_nav_p = 0
set gps_nav_i = 0
set gps_nav_d = 0
set deadband = 0
set yaw_deadband = 5
set throttle_correction_value = 0
set throttle_correction_angle = 800
set default_rate_profile = 0
set gimbal_mode = 0
set acc_lpf_factor = 4
set acc_unarmedcal = 1
set acc_trim_pitch = -8
set acc_trim_roll = -6
set baro_tab_size = 7
set baro_noise_lpf = 0.350
set mag_declination = 200
set pid_controller = 3
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 = 1.600
set i_pitchf = 0.300
set d_pitchf = 0.030
set p_rollf = 1.600
set i_rollf = 0.300
set d_rollf = 0.030
set p_yawf = 5.500
set i_yawf = 0.150
set d_yawf = 0.050
set level_horizon = 3.000
set level_angle = 5.000
set sensitivity_horizon = 75
set p_alt = 30
set i_alt = 150
set d_alt = 0
set p_level = 90
set i_level = 10
set d_level = 100
set p_vel = 80
set i_vel = 50
set d_vel = 50
set yaw_p_limit = 500
set dterm_cut_hz = 0
set pterm_cut_hz = 0
set gyro_cut_hz = 0
set pid5_oldyw = 0

dump rates

rateprofile

rateprofile 0

set rc_rate = 90
set rc_expo = 50
set rc_yaw_expo = 0
set thr_mid = 55
set thr_expo = 10
set roll_rate = 0
set pitch_rate = 0
set yaw_rate = 25
set tpa_rate = 0
set tpa_breakpoint = 1500

IMU - Migrate to a better attitude calculation algorythm

NAV code is now very sensitive to direction of gravity and magnetic field vector in aircraft frame - for controlling accelerations and heading. Estimating attitude as fast and precise as possible is a must. Current complementary filter is doing well, but there are better algorythms available, i.e. Robert Mayhony's DCM filter or Sebastian Madgwick's IMU fusion.

Flight - NAV_POSHOLD erratic behaviour

During flight testing today I switched to NAV_POSHOLD mode and copter began to change pitch/roll randomly. Possible causes:

  • wrong alignment or flawed calibration of magnetometer
  • code error
  • unhealthy default PIDs

IMU/NAV - Refactor velocity calculation code

Currently IMU is sampled and updated in many places accross the NAV code. It is logical to keep all velocity-related updates in one place, that would be imu.c
NAV would only be responsible to calculating reference velocities and giving them to IMU to keep estimated velocities sane.

Flight - Unexpected behaviour of NAV_ALTHOLD during takeoff

If NAV_ALTHOLD is enabled when craft is disarmed and on the ground, altholdInitialThrottle gets initialised to 1000. When we are trying to take off with this, actual throttle is raised slowly and that leads to a possible crash. This needs to be fixed.

GPS going on and off on ublox 6m

I've got a ublox 6m connected on main port at 57600 bps and gps keeps going on and off even with 8 satellites anybody issuing the same problem?, my setting on ublox are 100ms the standard one set on GPS.md

NAV - Waypoint mode

Hi everybody! I'm thinking about waypoint support and I wonder how the firmware should work when there is no waypoints on the list or all waypoints were successfully visited. I have two options:

  1. Hold last position
  2. Execure RTH

GPS - Use HDOP and VDOP for navigation, expose in blackbox and MSP

Currently cleanflight users the number of satellites as an indicator of 'GPS health'. HDOP is a better measure of this and has been adopted by other FC platforms.

Cleanflight already has HDOP in the GPS struct (https://github.com/cleanflight/cleanflight/blob/27db9ad0fe9a4d8abc05c59db201b8944324eea4/src/main/io/gps.h#L104) but it doesn't seemed to be used or exposed.

Ticket is two things -

  • expose HDOP in MSP so it is able to be shown in the cleanflight configurator
  • log HDOP in blackbox logging

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.