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

[VT]: Add a way to track VT float attributes #482

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ad3154
Copy link
Member

@ad3154 ad3154 commented Jul 8, 2024

Describe your changes

This lets you use the VT state helper to deal with float attributes. Previously, float values were probably not handled correctly.
I was seeing that there were warnings in the seeder example about this:
image

How has this been tested?

  • Run Seeder Example and test variable scale factors

@ad3154 ad3154 added enhancement New feature or request iso: virtual terminal Related to the ISO-11783:7 standard labels Jul 8, 2024
@ad3154 ad3154 requested a review from GwnDaan July 8, 2024 23:58
@ad3154 ad3154 self-assigned this Jul 8, 2024
@ad3154 ad3154 force-pushed the adrian/vt-float-attributes branch from 351e3a4 to 38a6923 Compare July 9, 2024 00:01
This lets you use the VT state helper to deal with float attributes.
Previously, float values may not have been handled correctly.
@ad3154 ad3154 force-pushed the adrian/vt-float-attributes branch from 38a6923 to 4c83485 Compare July 9, 2024 00:18
Copy link

sonarqubecloud bot commented Jul 9, 2024

Comment on lines +77 to +87
/// @brief Sets the value of a float attribute of a tracked object.
/// @attention ONLY use this function for float attributes defined in ISO11783-6,
/// otherwise you will get incorrect results. Scale on output numbers, for example, is a float.
/// @note If the to be tracked working set consists of more than the master,
/// this function is incompatible with a VT prior to version 4. For working sets consisting
/// of only the master, this function is compatible with any VT version.
/// @param[in] objectId The object id of the attribute to set.
/// @param[in] attribute The attribute to set.
/// @param[in] value The value to set the attribute to.
/// @return True if the attribute was set successfully, false otherwise.
bool set_attribute(std::uint16_t objectId, std::uint8_t attribute, float value);
Copy link
Member

Choose a reason for hiding this comment

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

thought: hmm, seems a lot of duplication that we might be able to avoid? With your current implementation we leave the conversion from float value to uint32_t all the way up to the VT client. What if we instead do it in this function directly? And then call the neighbor helper set_attribute function instead

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm good idea I think, that does sound appealing. I can rework it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request iso: virtual terminal Related to the ISO-11783:7 standard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants