Skip to content

Add enum for sensor implementations, send in analytics #4871

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

Merged
merged 5 commits into from
Jan 28, 2021

Conversation

chriselion
Copy link
Contributor

@chriselion chriselion commented Jan 20, 2021

Proposed change(s)

Followup from the other analytics PRs. This tags ObservationSpecs in the events if we know that the sensor involved is one that we provided. Future sensor implementations should also inherit from the interface and add to the enum.

Useful links (Github issues, JIRA tickets, ML-Agents forum threads etc.)

#4780

Types of change(s)

  • New feature

Checklist

  • Added tests that prove my fix is effective or that my feature works

@@ -20,6 +20,7 @@ internal class InferenceAnalytics
{
const string k_VendorKey = "unity.ml-agents";
const string k_EventName = "ml_agents_inferencemodelset";
const int k_EventVersion = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we'll need to use version 2 here, waiting to hear back from analytics team.

Unknown = 0,
VectorSensor = 1,
// Note that StackingSensor actually returns the wrapped sensor's type
StackingSensor = 2,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can omit this if you don't like it here (since it's not actually used).

CameraSensor = 5,
RenderTextureSensor = 6,
BufferSensor = 7,
PhysicsBodySensor = 8,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ordering doesn't actually matter here, but I could make the extensions implementations start at some offset, say 1000.

public BuiltInSensorType GetBuiltInSensorType()
{
IBuiltInSensor wrappedBuiltInSensor = m_WrappedSensor as IBuiltInSensor;
return wrappedBuiltInSensor?.GetBuiltInSensorType() ?? BuiltInSensorType.Unknown;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO add unit test that checks this explicitly.

Copy link
Contributor

@surfnerd surfnerd left a comment

Choose a reason for hiding this comment

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

LGTM

@chriselion chriselion merged commit 56898ab into master Jan 28, 2021
@delete-merged-branch delete-merged-branch bot deleted the MLA-1709-sensor-type-events branch January 28, 2021 01:37
@chriselion chriselion mentioned this pull request Feb 17, 2021
10 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants