-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Conversation
@@ -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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@@ -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) |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@vincentpierre This doesn't account for your recent change; let's talk about how to bring them together.