Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Add altitude-hold PID method #181

Open
wants to merge 3 commits into
base: PID_Tuning
Choose a base branch
from
Open

Add altitude-hold PID method #181

wants to merge 3 commits into from

Conversation

antholuo
Copy link
Member

@antholuo antholuo commented Apr 28, 2022

Description

Patch to add PID modes for holding altitude and hovering in place.

This operates on the principle that when a switch is toggled or command otherwise set, the drone will hover in at the altitude / state that it is in when the toggle occurs.

Altitude Hold

  • On Toggle, the current altitude is saved and the drone will attempt to maintain that altitude.
  • Throttle stick is de-activated and there is currently no way to adjust the height of the drone in this state. Looking for ideas.
  • Uses current roll/pitch corrections to maintain position.
  • Will maintain yawRate of 0, which should be equal to minimal change in yaw.

Position Hold

  • On toggle, current position is saved and drone will attempt to maintain current latitude, longitude, altitude, and heading.
  • Do we want to re-map controls inputs to move the position around? Perhaps just with slew control so that fine adjustments in positioning are easier?
  • Currently does not interface with any gps data, subject to imu drift.
  • Uses same yaw, altitude PID as altitude hold.
  • Uses 2 new PID's for latitude and longitude. Each PID is driven off a difference in location from current and target, and will compensate the 2 sets of motors in opposite directions to return to the position.

Include the Asana link, or relevant issue.
Best thing I can do is link to the discord, was a quick patch.

https://discord.com/channels/776618956638388305/895818568065757184/969037598871937054

Testing

Safety builds. Will need to be tested on drone.

Builds of existing PID tuned code.

Documentation

Merge Checklist:

  • The changes have been well commented, particularly in hard-to-understand areas.
  • The code has been tested on hardware, either by me or somone else.
  • Comprehensive unit tests have been made for this change
  • Corresponding changes to documentation have been created and links to this documentation are provided within the pull request.
  • The changes generate no new warnings and compile and run; A screenshot of a successful compile message is attached to the bottom of this PR.

Screenshot:

image

Basic mode to hold-attitude with untuned PID
Please do not use this without extensive testing
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant