Skip to content

Instantly share code, notes, and snippets.

@AurelianTactics
Created January 26, 2022 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AurelianTactics/6d53c08e14c9c0cf2e617673280d53db to your computer and use it in GitHub Desktop.
Save AurelianTactics/6d53c08e14c9c0cf2e617673280d53db to your computer and use it in GitHub Desktop.
AgentSession snipped
// create world request initializes the environment
if( rqo.requestType == DmEnvRpc.V1.EnvironmentRequest.CreateWorldFieldNumber){
// CreateWorld comes in with config settings
// in this case just the reset position of the agent
int startPosition = 10;
// unpack the Tensor format sent in from the grpc
if (rqo.unpackedTensorDict.ContainsKey("start_position") ){
if(rqo.unpackedTensorDict["start_position"] != null && rqo.unpackedTensorDict["start_position"].Count > 0)
startPosition = rqo.unpackedTensorDict["start_position"][0];
}
// tell the enviroment to start with these config settings
var startMessage = await StartEnv(startPosition);
// generate a response object to send to the communication layer
var erObject = MakeEnvironmentResponseObject(rqo.requestType);
eroList.Add(erObject);
}
// later on in the function send the eroList (the list of responses) to the communication layer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment