-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated axis limit computation and added other common trajectories. #1
base: master
Are you sure you want to change the base?
Conversation
I just added an LQR Controller. Its design was based on a linearization of the system dynamics. Right now it is tuned for output performance rather than input energy performance, so it is a bit crazy. |
Hi, looks like you have done a lot of work, well done! I have a quick run locally and realize the drone flies off track in a second, is that what you seen on your side? I will need to have a closer look later on when I get time. |
Hi, thank you for creating this simulator. The behaviour you describe is what I see. However this behaviour is dependent on both the trajectory and the control_frequency variable. Also it is not limited to my LQR controller but also to the PID controller already present in the repository shows this behaviour. I would like to mention that I have not yet fully analyzed your code. Since this behaviour is dependent on the trajectory and control_frequency, I would like to first understand how your code works and then try to identify this behaviour as related to the simulator or the controller. |
Em...looks like it is broken somehow, a few people report it before as
well. I will look into it this weekend. I actually have a single threaded
faster version in bitbucket, which I think does not have this issue. It
removes scheduler which has problem.It does speed up help control loop. I
will migrate those changes onto within this weekend, and could you retest
and adapt your pull request once done? I will let you know when it is done.
I really appreciate your effort, and hope we can work something out
together.
Regards
Peter
…On Fri., 18 Jan. 2019, 7:01 pm Juan, ***@***.***> wrote:
Hi, thank you for creating this simulator. The behaviour you describe is
what I see. However this behaviour is dependent on both the trajectory and
the control_frequency variable. Also it is not limited to my LQR controller
but also to the PID controller already present in the repository.
I would like to mention that I have not yet fully analyzed your code.
Since this behaviour is dependent on the trajectory and control_frequency,
I would like to first understand how your code works and then try to
identify this behaviour as related to the simulator or the controller.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHd0qQKpcfTRsZnimHreOa45bKjStNMXks5vEX9PgaJpZM4aE3Da>
.
|
Yes, for sure. It would be nice your implementation of the thread. I found your small simulator flexible enough to make superficial and deep changes with ease, it has a nice graphical interface and the code easy to understand.. I would like to keep collaborating on it while keeping this characteristics. |
Hi Juan, I have push my threading change to master, and created a branch for you dev/lqr-controller, do you want to adapt your changes on that branch. Do you want me to add you as a contributor? Let me know your email. |
@@ -0,0 +1,6 @@ | |||
*.pyc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this now, I already add .gitignore
des_x_dot, des_y_dot, des_z_dot = des_state.vel | ||
des_x_ddot, des_y_ddot, des_z_ddot = des_state.acc | ||
des_psi = des_state.yaw | ||
des_psi_dot = des_state.yawdot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does not look like these are used, please review the input parameters, and only takes the one that is used.
return F, M | ||
|
||
def run_LQR(quad, des_state): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can, could you refactor this controller.py file a bit so it only includes control algoriuthm, and seperate out calibration parameters.
- pid() - move pid specific parameters into a seperate file.
- lqr() - could you refactor a bit so lqr specific matrix constant goes into a seperate file similar to model.params
we should create a folder called "control" and only includes controller.py and params for now.
# | ||
# In general u = Nu*r - K(x -Nx*r) = -K*x + (Nu + K*Nx)*r | ||
# where K are the LQR gains, Nu and Nx are reference input matrices. | ||
# See more at p.493 "Feedback Control of Dynamic Systems, Franklink G, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good summery, could you write some simple description on how you tune and design lqr matrix, and their effect on the control in general?
@@ -24,26 +24,34 @@ def render(quad): | |||
|
|||
def attitudeControl(quad, time, waypoints, coeff_x, coeff_y, coeff_z): | |||
desired_state = trajGen3D.generate_trajectory(time[0], 1.2, waypoints, coeff_x, coeff_y, coeff_z) | |||
F, M = controller.run(quad, desired_state) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename original run to run_pid() as mentioned above
@@ -15,15 +15,18 @@ | |||
history = np.zeros((500,3)) | |||
count = 0 | |||
|
|||
def plot_quad_3d(waypoints, args=()): | |||
def plot_quad_3d(waypoints, init_pos, args=()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see if you can adapt your change to my thread-less part, I will review this part later on. I suggest you seperate this review into two, one is general clean up and quadPlot related change, the other is lqr controller. You can do this in your branch now and submit incremental change, which it is easy for me to review.
|
||
return np.stack((x, y, z), axis=-1) | ||
|
||
def get_poly_waypoints(t,n): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since your get_leminiscata_waypoints does not seem to be used yet, I think we should create a folder call trajectories, and move all trajectories generation files into it and create a new one for your work and submit that change as a review.
Make sure you write some unit test in the test folder :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work so far and hope you can see my comment and continue your work as suggested.
Hi Juan,
Are you still interested in working on your pull request? I am quite happy
to work together and hope that your change can get in.
Regards
Peter
…On Sat, 19 Jan 2019 at 00:00, Juan ***@***.***> wrote:
Yes, for sure. It would be nice your implementation of the thread. I found
your small simulator flexible enough to make superficial and deep changes
with ease, it has a nice graphical interface and the code easy to
understand.. I would like to keep collaborating on it while keeping this
characteristics.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHd0qaJPYq5YAbIKU2m3kGBAZ4ctX-aQks5vEcWFgaJpZM4aE3Da>
.
|
Hey! Yes of course. I have been busy with other stuff so I have not been able to update the branch. Actually I have been working on a differential flatness based controller. As time allows I will update both the LQR controller and try to merge the differential flatness based controller. By the way, I was wondering if it is possible for you to add some comments in your code. For example, adding the euler convention used and other details. I think it might make your code easier to undertand. Thanks for updating the repository! |
Hi Juan,
How are you! I recently receive a few email queries about my simulator,
people are seeing quadcopter flying away, which never happen to me before
until recently I download it myself and have a look.
I can no longer get it fly like it did before on another PC, please see
here https://www.youtube.com/watch?v=jlmXEo9Jmxc.
The quad-rotor does fly away now... I vaguely remember you also encountered
this issue before, and I saw your fork, and you did pretty good job on
extending my work. I think you are a expert now :)
I am wondering if you have a fix for yaw control for helix trajectory. If
you do have, could you please share so it could help other people as well.
Best Regards
Peter
…On Fri, 9 Aug 2019 at 22:32, Peter Huang ***@***.***> wrote:
Hi Juan,
How are you! I recently receive a few email queries about my simulator,
people are seeing quadcopter flying away, which never happen to me before
until recently I download it myself and have a look.
I can no longer get it fly like it did before on another PC, please see
the attachment.
The quad-rotor does fly away... I vaguely remember you also encountered
this issue before, and I saw your fork, and you did pretty good job on
extending my work, you are a expert now :)
I am wondering if you have a fix for yaw control for helix trajectory. If
you do have, could you please share so it could help other people as well.
Best Regards
Peter
On Tue, 22 Jan 2019 at 22:20, Juan ***@***.***> wrote:
> Hey! Yes of course. I have been busy with other stuff so I have not been
> able to update the branch. Actually I have been working on a differential
> flatness based controller. As time allows I will update both the LQR
> controller and try to merge the differential flatness based controller.
>
> By the way, I was wondering if it is possible for you to add some
> comments in your code. For example, adding the euler convention used and
> other details. I think it might make your code easier to undertand.
>
> Thanks for updating the repository!
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#1 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AHd0qc53v7G_bA2bcaREZTaaf571KnWNks5vFvPygaJpZM4aE3Da>
> .
>
|
Hey Peter, Thanks for your message. You can find my changes regarding heading here on the trajGen3D.py file. But I cannot guarantee that these changes will not make the drone to fly away since I did not directly tried to solve that. However I should mention that this fix plus update you pushed from bitbucked helped. I did not see the drone fly away anymore (of course, if the control inputs are correct). |
Hi. These are not big changes: