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

[WIP] remove the use of param_find("") #13076

Closed

Conversation

BazookaJoe1900
Copy link
Member

param_find() does binary search every time any other parameter is beeing changed. which is extensive CPU process.
This commit doesn't compile, because of calling non existing parameters FW_MAN_R_SC, FW_MAN_P_SC, FW_MAN_Y_SC

Describe problem solved by the proposed pull request
described on: 'extensive on every parameter change #12992'

The current problem is that do_trim_calibration() can be called on systems that doesn't has FW_MAN_* parameters. and in the new method, that does not compile

param_find() does binary search every time any other parameter is beeeing changed. which is extensive  CPU proccess.
This commit doesn't compile, because of calling non existing parameters FW_MAN_R_SC, FW_MAN_P_SC, FW_MAN_Y_SC
param_t param_fw_man_p_sc = param_handle(px4::params::FW_MAN_P_SC);
param_t param_fw_man_y_sc = param_handle(px4::params::FW_MAN_Y_SC);

float roll_trim_active, pitch_trim_active, yaw_trim_active, roll_scale, pitch_scale, yaw_scale;
Copy link
Member

Choose a reason for hiding this comment

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

It's probably a bit pedantic here, but I think it's good practice to declare and initialize each of these on a separate line with a sane default value.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dagar the issue here is not mainly about the searching of the parameter, but about the problem that the rc_calibration search for parameter that doesn't exists, on some compilation

@dagar
Copy link
Member

dagar commented Oct 2, 2019

Cool, I forgot we had this now. Thanks for the reminder. #13081

@BazookaJoe1900 BazookaJoe1900 force-pushed the pr-remove_param_find_rc_cal branch 2 times, most recently from d26943c to 655cdbc Compare October 2, 2019 22:33
@dagar
Copy link
Member

dagar commented Oct 3, 2019

Nice work, this saves ~8.7KB of flash on px4_fmu-v5_default.

http://ci.px4.io:8080/blue/organizations/jenkins/PX4%2FFirmware/detail/PR-13076/4/pipeline/25#step-387-log-114

@@ -380,7 +381,7 @@ FixedwingAttitudeControl::vehicle_status_poll()

int32_t vt_type = -1;

if (param_get(param_find("VT_TYPE"), &vt_type) == PX4_OK) {
if (param_get(param_handle(px4::params::VT_TYPE), &vt_type) == PX4_OK) {
Copy link
Member

Choose a reason for hiding this comment

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

VTOL needs to be optional for FW & MC controllers.

Copy link
Member Author

Choose a reason for hiding this comment

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

there are many issues about mixing VTOL/Rover/Multicopter/Fixwing

@BazookaJoe1900 BazookaJoe1900 force-pushed the pr-remove_param_find_rc_cal branch from 655cdbc to bf0052a Compare October 3, 2019 05:23
@BazookaJoe1900 BazookaJoe1900 changed the title [WIP] remove the use of param_find("") on rc_calibration [WIP] remove the use of param_find("") Oct 3, 2019
@BazookaJoe1900 BazookaJoe1900 force-pushed the pr-remove_param_find_rc_cal branch 3 times, most recently from 778886c to 13d0f2a Compare October 3, 2019 07:36
@BazookaJoe1900
Copy link
Member Author

closed in favor to reduce the use of param_find("XXX") #13089

@BazookaJoe1900 BazookaJoe1900 deleted the pr-remove_param_find_rc_cal branch October 6, 2019 07:09
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

Successfully merging this pull request may close these issues.

2 participants