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

ins_ekf2 is incompatible with fixedwing firmware #2865

Open
matteobarbera opened this issue Apr 20, 2022 · 2 comments
Open

ins_ekf2 is incompatible with fixedwing firmware #2865

matteobarbera opened this issue Apr 20, 2022 · 2 comments

Comments

@matteobarbera
Copy link
Contributor

Currently including the module ins_ekf2 will only compile for a rotorcraft airframe, due to a couple of conflicts:

Waypoints

I'm not 100% that nav.h is included for all fixedwing airframes, but when it is it will also include nav_common.h, which has a number of conflicting defines with waypoints.h

struct Waypoint {
uint8_t flags; ///< bitmask encoding valid representations and if local or global
struct EnuCoor_i enu_i; ///< with #INT32_POS_FRAC
struct EnuCoor_f enu_f;
struct LlaCoor_i lla;
};

extern struct Waypoint waypoints[];

struct point {
float x;
float y;
float a;
};

extern struct point waypoints[];

The definition of the variable waypoints as well as a number of macros that perform operations on waypoints are both double and use a different structure. I think it would make sense to move all waypoints and functions on waypoints to waypoints.h and include this file in common_nav.h.

Rotocraft guidance functions

Certain variables that are used in ekf2 seem to only be defined in rotorcraft stabilization and guidance files, stab_att_sp, nav_heading, guidance_h_read_rc, stabilization_attitude_enter

@fvantienen
Copy link
Member

fvantienen commented Apr 20, 2022

The waypoints are only included for the waypoints_localize_all() function so not sure what the problem is there, but should be easily fixable.

The second part of rotorcraft guidance functions is there when the EKF2 decides to reset it's heading. You can disable it with NO_RESET_UPDATE_SETPOINT_HEADING, ideally we should implement something like an ABI call such that the controllers can be notified if the heading gets reset.

@gautierhattenberger
Copy link
Member

The structure for the waypoints of fixedwing and rotorcraft is completely different and not not compatible (and of course, not easy to merge, that would be too simple). Even the "nav_common" is not common at all.
I think the problem is that a INS filter should not depend on navigation, although we can't always avoid that, for the init point for instance. If needed, you can use the defines FIXEDWING_FIRMWARE, ROTORCRAFT_FIRMWARE and ROVER_FIRMWARE to make conditional compilation.

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

No branches or pull requests

3 participants