Copter: Add an element of NAV_CONTROLLER_OUTPUT to ZIGZAG mode

This commit is contained in:
murata 2021-05-16 14:21:47 +09:00 committed by Peter Barker
parent 8c7fc012d4
commit 8c1e2546d8
2 changed files with 28 additions and 0 deletions

View File

@ -1794,6 +1794,9 @@ protected:
const char *name() const override { return "ZIGZAG"; }
const char *name4() const override { return "ZIGZ"; }
uint32_t wp_distance() const override;
int32_t wp_bearing() const override;
float crosstrack_error() const override;
private:

View File

@ -583,4 +583,29 @@ void ModeZigZag::spray(bool b)
#endif
}
uint32_t ModeZigZag::wp_distance() const
{
if (is_auto) {
return wp_nav->get_wp_distance_to_destination();
} else {
return 0;
}
}
int32_t ModeZigZag::wp_bearing() const
{
if (is_auto) {
return wp_nav->get_wp_bearing_to_destination();
} else {
return 0;
}
}
float ModeZigZag::crosstrack_error() const
{
if (is_auto) {
return wp_nav->crosstrack_error();
} else {
return 0;
}
}
#endif // MODE_ZIGZAG_ENABLED == ENABLED