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

fw_att_control move to ModuleBase #8899

Merged
merged 14 commits into from
Feb 22, 2018
Merged

fw_att_control move to ModuleBase #8899

merged 14 commits into from
Feb 22, 2018

Conversation

dagar
Copy link
Member

@dagar dagar commented Feb 16, 2018

No description provided.

LorenzMeier
LorenzMeier previously approved these changes Feb 16, 2018
@tstastny
Copy link

Cool, this does fix the subscription problem. But still does not fix the subtraction of the unsigned integers in L889.

E.g. see below a debug print (where "diff=airsp ts - time now"):
WARN [fw_att_control] airsp ts 15448699
WARN [fw_att_control] time now 15455263
WARN [fw_att_control] diff 18446744073709544825
WARN [fw_att_control] telapsed 7183
WARN [fw_att_control] valid? 0

However, using the hrt_elapsed_time you recommended in #8898 works.
WARN [fw_att_control] airsp ts 22961674
WARN [fw_att_control] time now 22969602
WARN [fw_att_control] diff 18446744073709543405
WARN [fw_att_control] telapsed 8560
WARN [fw_att_control] valid? 1

This amounts only to this change:

const bool airspeed_valid = PX4_ISFINITE(_sub_airspeed.get().indicated_airspeed_m_s) && (hrt_elapsed_time(&_sub_airspeed.get().timestamp) < 1e6);

@dagar can you do this? Then I think this PR is good to merge -- I just tested on hardware and it works out.

@dagar
Copy link
Member Author

dagar commented Feb 17, 2018

@tstastny I fixed the time check and also slipped in some trivial cleanup I've wanted to do for readability. I've tested on the bench and in SITL.

@dagar
Copy link
Member Author

dagar commented Feb 17, 2018

08b4d89 fixes attitude setpoint logging & display on flight review for stabilized mode.

@dagar
Copy link
Member Author

dagar commented Feb 17, 2018

@dagar
Copy link
Member Author

dagar commented Feb 17, 2018

@RomanBapst quick review? Nothing too interesting here should be different, I'm mainly trying to get this module organized.

@RomanBapst
Copy link
Contributor

@dagar Sure, first thing in the morning.

@RomanBapst
Copy link
Contributor

@dagar Something unrelated to your changes: Do we really need these checks here ?
Just wondering during which case we would not want to publish actuator outputs.

Copy link
Contributor

@RomanBapst RomanBapst left a comment

Choose a reason for hiding this comment

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

@dagar Looks pretty good. We could a second pass and update some of the comments in the module.


_sub_airspeed(ORB_ID(airspeed), 0, 0, nullptr),
SuperBlock(nullptr, "FW_ATT"),
_sub_airspeed(ORB_ID(airspeed), 0, 0, &getSubscriptions()),
Copy link
Contributor

Choose a reason for hiding this comment

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

@dagar Any reason why the airspeed subscription is handled using the subscription class and not the others?

Copy link
Member

Choose a reason for hiding this comment

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

I would say that within a module we should only use one type of subscription. So we either use the subscription class also for all other inputs of the fixed-wing attitude control module or use the same syntax for the airspeed as for the other subscribers.

Copy link
Member Author

Choose a reason for hiding this comment

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

In general I agree, but I'd like to strongly encourage moving away from the old C APIs for both params and orb. There's no type safety and most common usage throughout the code base doesn't check any errors.


using uORB::Subscription;

class FixedwingAttitudeControl final : public control::SuperBlock, public ModuleBase<FixedwingAttitudeControl>
Copy link
Contributor

Choose a reason for hiding this comment

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

@dagar What does "final" mean?

Copy link
Member Author

Choose a reason for hiding this comment

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

That this class can't be derived from. In some cases it allows the compiler to devirtualize calls, but it's otherwise harmless.

@RomanBapst
Copy link
Contributor

@dagar I guess the next thing would be a couple of flight tests in all possible modes?

@dagar dagar requested a review from a team February 19, 2018 14:04
@dagar
Copy link
Member Author

dagar commented Feb 19, 2018

@dagar Something unrelated to your changes: Do we really need these checks here ?Just wondering during which case we would not want to publish actuator outputs.

No, but I was going to do another pass later that continued splitting out the main loop into separate functions for attitude control and rate control (partially to enable rate setpoint subscriptions). We can continue removing all the extraneous checks as we go.

I was also tempted to completely pull out manual handling and finally create stick_mapper, but the rattitude mode is problematic.

@r0gelion
Copy link
Contributor

@dagar we plan to go to the flying field tomorrow and test this PR if the weather allows it.

Regards.

@dannyfpv
Copy link

@dagar
Copy link
Member Author

dagar commented Feb 22, 2018

Thanks, looks good.

@dannyfpv @r0gelion You should reset FW_R_RMAX to default.

image

It's the reason why roll is spiking to max like this.
image

@dagar
Copy link
Member Author

dagar commented Feb 22, 2018

I made one minor change to fix the vehicle_attitude_setpoint publication (which is also wrong in master). https://logs.px4.io/plot_app?log=cee40f51-3e92-4700-ba6e-1bd2ad0de2da

image

@dagar dagar merged commit 19e706f into master Feb 22, 2018
@dagar dagar deleted the pr-fw_att_control_module branch February 22, 2018 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants