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

[glass] Add math expression input for NetworkTables numerical values #6530

Conversation

rmheuer
Copy link
Contributor

@rmheuer rmheuer commented Apr 22, 2024

This is for easier adjustment of NetworkTables values when tuning values. For example, you can increase an angle by 5 degrees easily by adding +5 to the value instead of doing the addition yourself. We implemented a similar feature in our custom dashboard program, which we found very convenient during the build season.

@rmheuer rmheuer requested a review from a team as a code owner April 22, 2024 21:05
@rmheuer
Copy link
Contributor Author

rmheuer commented Apr 22, 2024

/format

@rmheuer rmheuer changed the title Add math expression input for NetworkTables numerical values [glass] Add math expression input for NetworkTables numerical values Apr 22, 2024
@PeterJohnson
Copy link
Member

This is amazing work! It will take me a bit of time to fully review the expression parsing code.

Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

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

Overall, looks pretty good! Just have a few relatively minor comments.

glass/src/lib/native/cpp/support/ExpressionParser.cpp Outdated Show resolved Hide resolved
glass/src/lib/native/cpp/support/ExpressionParser.cpp Outdated Show resolved Hide resolved
glass/src/lib/native/cpp/support/ExpressionParser.cpp Outdated Show resolved Hide resolved
@rmheuer
Copy link
Contributor Author

rmheuer commented Apr 25, 2024

I think this is pretty much done now, do you have any other comments?

@rmheuer rmheuer requested a review from PeterJohnson April 25, 2024 18:42
Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

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

Might be worth it for Token to store std::string_view instead of const char* and int, but it doesn't matter much.

glass/src/lib/native/cpp/support/ExpressionParser.cpp Outdated Show resolved Hide resolved
glass/src/lib/native/cpp/support/ExpressionParser.cpp Outdated Show resolved Hide resolved
glass/src/lib/native/cpp/support/ExpressionParser.cpp Outdated Show resolved Hide resolved
glass/src/lib/native/cpp/support/ExtraGuiWidgets.cpp Outdated Show resolved Hide resolved
glass/src/lib/native/cpp/support/ExtraGuiWidgets.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

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

It would be really nice to have unit tests of the expression parser (e.g. does 1 + 2 ** 5 * 3 evaluate to 97), but glass doesn't have tests setup so it might not be worth it or be outside the scope of this PR.
Great work, though!

@PeterJohnson PeterJohnson merged commit ac32f92 into wpilibsuite:main Apr 28, 2024
25 checks passed
@rmheuer rmheuer deleted the glass-nt-expression-input branch October 15, 2024 23:24
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.

3 participants