Skip to content
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

[WIP] Controller #60

Merged
merged 8 commits into from
Aug 2, 2016
Merged

[WIP] Controller #60

merged 8 commits into from
Aug 2, 2016

Conversation

superjax
Copy link
Contributor

The controller is working on hardware. There is a little bit of cleanup left, some that I was hoping you could help me with @dpkoch.

Both the attitude and rate loops are working from RC commands, however, I can't remember how to do integrator anti-windup. I was wondering if you had ideas on that. After the anti-windup is incorporated, then this branch is ready.

@dpkoch
Copy link
Contributor

dpkoch commented Jul 22, 2016

Flight test (video) looked awesome!! Which mode were you flying that in?

Yep @superjax, I can get anti-windup going. One approach we could use is given by the code listing in section 6.5 of the UAV book.

@superjax
Copy link
Contributor Author

That was in angle mode. I didn't have time to really tune the rate mode, so it's still a little hairy, but it is flyable. I wouldn't recommend using it for offboard control quite yet. Angle mode seems to be pretty robust.

This was referenced Jul 25, 2016
@superjax
Copy link
Contributor Author

What if we merged this as-is, and instead made integrator anti-windup another pull request? It works as it currently stands, and it will require more testing to ensure that the anti-windup scheme is working as desired.

_offboard_control.y.value = mavlink_offboard_control.y/2.0f;
_offboard_control.z.value = mavlink_offboard_control.z/2.0f;
_offboard_control.F.value = mavlink_offboard_control.F;
_offboard_control.x.value = mavlink_offboard_control.x*500.0f;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think it'd be good at some point to move the mixer to floating point as well just so that everything can get passed through in normalized units to keep things consistent rather than carrying things around in PWM units (to me it seems like the PWM units probably shouldn't show up until as close to the actual hardware as possible). But let's make that a separate issue and not worry about it yet here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@dpkoch
Copy link
Contributor

dpkoch commented Aug 1, 2016

It's sweet that this is working! I think that there is definitely some cleanup to do, but for the most part I'm good with merging as-is and cleaning up later. In addition to my line comments above, it also seems like we've got a fair amount of code duplication with all the PID loops. Maybe it'd be possible to have a pid_t struct or something for each loop, then a generic PID function that runs an arbitrary loop on the values in that struct?

But yeah, maybe let's just take care of a couple of the minor fixes (spelling, parameter names) that could get lost easily, then worry about the more complicated changes in separate issues/pull requests?

@superjax
Copy link
Contributor Author

superjax commented Aug 2, 2016

Sounds good to me!

I would totally be in favor of a pid_t or something like that. I was trying to figure out a way to do it cleanly without a bunch of pointers, which is the only way I could think of to not have the code redundancy. I figured that it would be easier to read in it's current form as opposed to a more complicated, but less redundant form. You're better at that sort of coding than I am, so I am totally in favor of a refractor that uses less redundancy.

Let's make all of our improvements into issues and deal with them severally, rather than making some massive pull request that takes weeks to merge.

@superjax superjax merged commit fdce569 into master Aug 2, 2016
@superjax superjax deleted the controller branch August 2, 2016 01:39
@superjax superjax restored the controller branch August 2, 2016 01:42
@superjax superjax mentioned this pull request Aug 2, 2016
@superjax
Copy link
Contributor Author

superjax commented Aug 2, 2016

Sorry, I accidentally merged this. master has been reverted, but since this pull request is closed, I'll have to open a new one. #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants