Skip to content

Add enum for sensor implementations, send in analytics#4871

Merged
chriselion merged 5 commits into
masterfrom
MLA-1709-sensor-type-events
Jan 28, 2021
Merged

Add enum for sensor implementations, send in analytics#4871
chriselion merged 5 commits into
masterfrom
MLA-1709-sensor-type-events

Conversation

@chriselion

@chriselion chriselion commented Jan 20, 2021

Copy link
Copy Markdown
Contributor

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

{
const string k_VendorKey = "unity.ml-agents";
const string k_EventName = "ml_agents_inferencemodelset";
const int k_EventVersion = 1;

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@surfnerd surfnerd left a comment

Copy link
Copy Markdown
Contributor

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