Skip to content

write observations directly to protobuf #3229

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 2 commits into from
Jan 15, 2020
Merged

Conversation

chriselion
Copy link
Contributor

@vincentpierre This doesn't account for your recent change; let's talk about how to bring them together.

@@ -592,7 +571,7 @@ void UpdateSensors()
/// <param name="buffer"> A float array that will be used as buffer when generating the observations. Must
/// be at least the same length as the total number of uncompressed floats in the observations</param>
/// <param name="adapter"> The WriteAdapter that will be used to write the ISensor data to the observations</param>
/// <param name="observations"> A list of observations outputs. This argument will be modified by this method.</param>//
/// <param name="observations"> A list of observations outputs. This argument will be modified by this method.</param>//
public static void GenerateSensorData(List<ISensor> sensors, float[] buffer, WriteAdapter adapter, List<Observation> observations)
Copy link
Contributor Author

@chriselion chriselion Jan 15, 2020

Choose a reason for hiding this comment

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

Not removed here because the other PR needs it, but this gets rid of the calls to GenerateSensorData

{
var numFloats = sensor.ObservationSize();
var floatDataProto = new ObservationProto.Types.FloatData();
// Resize the float array
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, doesn't seem to be a way to set the Capacity on this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, there is, but only in newer versions of the library: protocolbuffers/protobuf@da57400

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added code comment on this too.

@chriselion chriselion marked this pull request as ready for review January 15, 2020 22:23
@chriselion chriselion changed the title [WIP] write observations directly to protobuf write observations directly to protobuf Jan 15, 2020
@@ -197,5 +189,40 @@ public static ObservationProto ToProto(this Observation obs)
obsProto.Shape.AddRange(obs.Shape);
return obsProto;
}

public static ObservationProto GetObservationProto(this ISensor sensor, WriteAdapter writeAdapter)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a docstring on this ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@chriselion chriselion merged commit c049976 into master Jan 15, 2020
@delete-merged-branch delete-merged-branch bot deleted the develop-MLA-531-no-buffer branch January 15, 2020 23:34
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2021
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