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

AP_Scripting: Add user accessable script parameters #14787

Merged
merged 1 commit into from Jul 19, 2020

Conversation

Hwurzburg
Copy link
Collaborator

@Hwurzburg Hwurzburg commented Jul 9, 2020

complementing #14777 which I had suggested and @IamPete1 quickly,, and generously, coded to get user re-configurations into a script without the user having to actually edit a script (simple, but which may be daunting to some), I think this is also needed.

  • it allows analog variable input by user param into the script
    flagging both with DEVCALL for discussion

@WickedShell
Copy link
Contributor

I'm not really a fan of this approach. It's going to lead to accidental script collision on the indexing. There was discussion about how to have a script actually declare a parameter dynamically without requiring an array like this. I think the question may be to @tridge if this is actually reasonable.

The alternate way that may be worth considering is if you don't need to change it on the fly then writing to the SD card may be reasonable.

@Hwurzburg
Copy link
Collaborator Author

being ignorant, I'm not sure how this is different than having the scripts be able to read other parameters, which they already can...are there collisions there also?if there is concern about two scripts trying to read or use the same param for different purposes, that would the responsibility of the user who is loading the scripts, wouldn't it?

libraries/AP_Scripting/AP_Scripting.h Outdated Show resolved Hide resolved
libraries/AP_Scripting/AP_Scripting.cpp Outdated Show resolved Hide resolved
@@ -77,6 +77,30 @@ const AP_Param::GroupInfo AP_Scripting::var_info[] = {
// @User: Advanced
AP_GROUPINFO("DEBUG_LVL", 4, AP_Scripting, _debug_level, 0),

// @Param: PARAM1
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// @Param: PARAM1
// @Param: USER1

// @User: Standard
AP_GROUPINFO("USER1", 5, AP_Scripting, _user[0], 0.0),

// @Param: PARAM2
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// @Param: PARAM2
// @Param: USER2

// @User: Standard
AP_GROUPINFO("USER2", 6, AP_Scripting, _user[1], 0.0),

// @Param: PARAM3
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// @Param: PARAM3
// @Param: USER3

// @User: Standard
AP_GROUPINFO("USER3", 7, AP_Scripting, _user[2], 0.0),

// @Param: PARAM4
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// @Param: PARAM4
// @Param: USER4

@peterbarker peterbarker merged commit 8bfda97 into ArduPilot:master Jul 19, 2020
@peterbarker
Copy link
Contributor

Merged, thanks!

@Hwurzburg Hwurzburg deleted the scriptparam branch July 19, 2020 07:15
@Hwurzburg Hwurzburg removed the WikiNeeded needs wiki update label Aug 21, 2020
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.

None yet

5 participants