-
Notifications
You must be signed in to change notification settings - Fork 18.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
Plane: added systemID as an aux function #29237
base: master
Are you sure you want to change the base?
Conversation
ac21f5a
to
1a23f2d
Compare
I'm struggling to understand why this is called "System ID". It doesn't seem to have anything to do with identifying the system - which is what we have SYSID_THISMAV for no? |
"system identification" is a control systems term that refers to characterising the dynamics of a system (a vehicle in this case). In copter it is a flight mode called SYSTEMID flight mode. |
1a23f2d
to
322c3f1
Compare
// @DisplayName: System identification axis | ||
// @Description: Controls which axis are being excited. Set to non-zero to see more parameters | ||
// @User: Standard | ||
// @Values: 0:None, 1:Input Roll Angle, 2:Input Pitch Angle, 3:Input Yaw Angle, 4:Recovery Roll Angle, 5:Recovery Pitch Angle, 6:Recovery Yaw Angle, 7:Rate Roll, 8:Rate Pitch, 9:Rate Yaw, 10:Mixer Roll, 11:Mixer Pitch, 12:Mixer Yaw, 13:Mixer Thrust, 14:Measured Lateral Position, 15:Measured Longitudinal Position, 16:Measured Lateral Velocity, 17:Measured Longitudinal Velocity, 18:Input Lateral Velocity, 19:Input Longitudinal Velocity |
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.
Should add "VTOL" to these, would be good to support in FW flight in the future.
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.
I was planning to re-use the same axes (where relevant, can't do lateral vel and pos).
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.
remove values 14-19. I did not implement them in my version of sysid. it doesn't look like you did either. Lets keep it to the attitude controller. We can expand to the position controller later.
gcs().send_text(MAV_SEVERITY_WARNING, "SystemID: must be armed"); | ||
return; | ||
} | ||
if (!plane.quadplane.enabled()) { |
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.
This case should be handled by plane.control_mode->supports_systemid()
I'm aware of this problem hence bringing it up. I've found it helps to provide some way to differentiate overloaded terms. Could the new (user facing) name be something like "Dynamic System Identification" or "System Model Identification" or DSMI (Dynamic System Model Identification)? |
a8fd6ec
to
d9853b6
Compare
|
||
auto *attitude_control = plane.quadplane.attitude_control; | ||
attitude_control->bf_feedforward(restore.att_bf_feedforward); | ||
attitude_control->rate_bf_roll_sysid(0); |
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.
Setting these to zero is not necessary. These are set to zero in the attitude controller at the end of every loop.
https://github.com/ArduPilot/ardupilot/blob/master/ArduPlane/quadplane.cpp#L1948
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.
this was paranoia to ensure that even a single loop is not incorrect
// @Field: Az: Delta velocity, Z-Axis | ||
|
||
// log system id | ||
void AP_SystemID::log_data() const |
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.
I see you removed the logging of RATE and ANG from this function. It is imperative that these all be logged at the same rate. Why don't you use the same technique as copter to allow logging at multiples of the fast loop rate. this is important to allow users to choose an appropriate rate for their use case.
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 is imperative that these all be logged at the same rate.
unlike copter, the default setup in plane is to log all these at the full loop rate, so they are all logged at the same rate. We could force the LOG_BITMASK in case a user has changed that, or we could just document that the defaults should be used.
Why don't you use the same technique as copter to allow logging at multiples of the fast loop rate. this is important to allow users to choose an appropriate rate for their use case.
it would be good to discuss why this is needed. Is it to make logs smaller? The sysid runs for a short time (usually) and the extra complexity to support down sampling didn't seem worthwhile, but let's discuss when you have a chance
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.
The data logging for system ID is extreemly important if we intend to make this a reliable system. Leaving logging to other parts of the code invites crashed aircraft after small logging problems result in unstable tunes that look great in the too. This is why logging perfection is so important in system ID.
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.
@tridge
I agree with @lthall that the logging is extremely important. Any time difference between signals can cause issues when either using it to develop a model or tune the aircraft. In most cases, I use the gyro rates from SIDD because they haven't been filtered by the INS filters and I use the motors inputs from RATE. Having these signals logged at the same time is very important. Keeping them all in the SystemID log function also provides higher confidence that future developers won't change how things are logged for System ID.
As for the various rates that copter allows, I am not as bothered by this. I think it can be an issue for users if their flight controllers have issues logging at the fast rate. I know my F7s were unable to keep up at 400hz logging rate. Thus it was very useful to be able to use 100hz so that I could allow the F7 to keep up with the logging.
d9853b6
to
5699218
Compare
allows for systemID to reduce XY gains in pos controlled modes
enable as an AUX switch
5699218
to
6c272da
Compare
@@ -679,6 +679,10 @@ void AC_PosControl::update_xy_controller() | |||
// add velocity feed-forward scaled to compensate for optical flow measurement induced EKF noise | |||
vel_target *= ahrsControlScaleXY; | |||
|
|||
if (_xy_control_scale_factor > 0) { |
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.
Why was this added?
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.
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.
Cool.
We should change this to match the pattern in Attitude Control where we set it to 1.0 by default.
If this is a "Control" scale factor we should also update the accel_target like we do with the ahrsControlScaleXY.
accel_target *= ahrsControlScaleXY;
This adds VTOL systemID as an AUX function to quadplanes. It works in QSTABILIZE, QHOVER and QLOITER modes.
In QLOITER it multiplies the XY position and velocity gains by SID_XY_CTRL_MUL to reduce the impact of the XY controller on the systemID result
The AP_SystemID class is structured in a way to make it fairly easy to move this to a common library in the future if copter wants to adopt the same approach