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

Pid update #161

Merged
merged 7 commits into from
Nov 24, 2016
Merged

Pid update #161

merged 7 commits into from
Nov 24, 2016

Conversation

stephanbro
Copy link
Contributor

@stephanbro stephanbro commented Nov 11, 2016

  • Changes Z command to a float to allow negative values
  • Change errorMax to outputLimit in the PID module and does as the name implies
  • Smarter cap on the integral
  • Add roll, pitch, and yaw rate limits
  • Tweak the ordering of assignment in the commander module to make things more explicit
  • Properly set PID outputLimit so a parameter can change the value

Also see PSVL/lps-ros#1 and whoenig/crazyflie_ros#49

@whoenig
Copy link
Contributor

whoenig commented Nov 14, 2016

Hi,
I was wondering what the benefit of the float-thrust value is. I see that this allows negative values now, but this doesn't have any physical meaning as the rotors can not spin in opposite directions?
Thanks,
Wolfgang

@stephanbro
Copy link
Contributor Author

It's true that the thrust cannot go negative, but within the crazyflie-firmware the name thrust is somewhat of a misnomer, as it is used for direct/scaled thrust, z velocity, or z position. The value should be properly limited based on what the flight mode is within the crazyflie-firmware.

@ataffanel
Copy link
Member

Hi,
Thanks for the PR, the PID related things looks good!

For the commander packer: we will not change the current commander packet since too many client are currently dependent on it. CRTP has port and channels to route packets, the current plan is to create a new commander packet format on a new channel (see #113). The current usage of thrust as height setpoint is a hack made to work until we have the new commander packet, going forward we should go with well formed packets using SI units.

If you remove the commander part I can merge the PR and lets talk on #113 on how to go forward with the commander packet. I had grand plan to revamp the code but we can just add a new packet quickly to get the functionality in and clean the implementation later. Basically anything as long as we do not break the outside interface :).

@theseankelly
Copy link
Contributor

Huge +1 to not changing the current commander packet!!

@@ -37,7 +37,7 @@
#include "debug.h"
#include "ext_position.h"

#define MIN_THRUST 1000
#define MIN_THRUST 0
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why this was originally 1000

Copy link
Member

Choose a reason for hiding this comment

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

Yep good question. The brushed motors don't start spinning until ~3000 so I think it was initially intended so that power isn't consumed without any movement. When it spinns it can go lower so that is were 1000 comes from.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting. Is this a change you'd like me to keep @tobbeanton @ataffanel ?

@@ -174,10 +175,6 @@ static void commanderCrtpCB(CRTPPacket* pk)
crtpCache.targetVal[!crtpCache.activeSide] = *((struct CommanderCrtpValues*)pk->data);
crtpCache.activeSide = !crtpCache.activeSide;
crtpCache.timestamp = xTaskGetTickCount();

if (crtpCache.targetVal[crtpCache.activeSide].thrust == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to keep the thrust lock -- it's a good safety feature, especially when using transmitters with a non-spring loaded throttle that might not be at zero on power-on, and with BigQuad builds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understandable. I'll remove this along with the other commander changes I've made.

@stephanbro
Copy link
Contributor Author

That makes sense. I can remove the non-PID related changes and close the other pull requests.

@ataffanel ataffanel merged commit da5152d into bitcraze:master Nov 24, 2016
@ataffanel
Copy link
Member

Hi, Thanks! Tested and merged.

@krichardsson krichardsson added this to the Next version milestone Dec 5, 2016
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.

6 participants