-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Correct platform defaults #1069
Conversation
Including this indeed helps with my issue - defining the PID gains in the platform_defualts.h instead of pid.h 👍 But I feel the behavior is still a bit strange... E.g. this define already worked even without autoconf.h included... In some cases, it would be nice to have a default value in the code, but to be able to override that e.g. in platform_defaults_[specificPlatform].h E.g. for IMU angles this works well with And But using the same structure for PID gains in pid.h (e.g. |
I¨m not sure why (or where) it worked.
You could have the default values defined in In #define MY_SPECIAL_PARAM 17 and in #pragma once
#include "autoconf.h"
#define __INCLUDED_FROM_PLATFORM_DEFAULTS__
#ifdef CONFIG_PLATFORM_CF2
#include "platform_defaults_cf2.h"
#endif
#ifdef CONFIG_PLATFORM_BOLT
#include "platform_defaults_bolt.h"
#endif
#ifdef CONFIG_PLATFORM_TAG
#include "platform_defaults_tag.h"
#endif
#ifndef MY_SPECIAL_PARAM
#define MY_SPECIAL_PARAM 4711
#endif I'm not sure it is that much clearer though, I guess it has to be decided from case to case.
Remove the define from pid.h and move it to the platform defaults. The question might be if it should only be in the My thinking when it comes to the values in the platform defaults module, is that they should be safe rather than optimal. Let's use the Bolt as an example. The most important thing is that if someone flashes a Bolt and tries to fly it, is to make it reasonably safe. Optimal settings must be defined based on the configuration anyway and should (in my opinion) be set using persistent parameters. If values are pretty optimal as well, even better :-) It is possible that we should add functionality to write a set of parameters from file to persistent memory to make it easy to configure a swarm for instance, but that is another story. |
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.
Looks good!
This is defined only in
Yes, this works well. I am Just wondering, why keeping the #ifndef, #define structure in the code sometimes works (e.g. IMU angles) and sometimes not (PID gains).
Agree!
Yes, this could be handy... |
In |
Ah, ok :) Thanks... |
The autoconfig.h was not included in platform_defaults.h which cased no platform specific defines to not being included.