Main Content

getObservationInfo

Obtain observation data specifications from reinforcement learning environment or agent

Description

example

obsInfo= getObservationInfo(env)extracts observation information from reinforcement learning environmentenv.

obsInfo= getObservationInfo(agent)extracts observation information from reinforcement learning agentagent.

Examples

collapse all

Extract action and observation information that you can use to create other environments or agents.

The reinforcement learning environment for this example is the simple longitudinal dynamics for ego car and lead car. The training goal is to make the ego car travel at a set velocity while maintaining a safe distance from lead car by controlling longitudinal acceleration (and braking). This example uses the same vehicle model as theAdaptive Cruise Control System Using Model Predictive Control(Model Predictive Control Toolbox)example.

Open the model and create the reinforcement learning environment.

mdl ='rlACCMdl'; open_system(mdl); agentblk = [mdl'/RL Agent'];% create the observation infoobsInfo = rlNumericSpec([3 1],'LowerLimit',-inf*ones(3,1),'UpperLimit',inf*ones(3,1)); obsInfo.Name ='observations'; obsInfo.Description ='information on velocity error and ego velocity';% action InfoactInfo = rlNumericSpec([1 1],'LowerLimit',-3,'UpperLimit',2); actInfo.Name =“加速”;% define environmentenv = rlSimulinkEnv(mdl,agentblk,obsInfo,actInfo)
env = SimulinkEnvWithAgent with properties: Model : rlACCMdl AgentBlock : rlACCMdl/RL Agent ResetFcn : [] UseFastRestart : on

The reinforcement learning environmentenvis aSimulinkWithAgentobject with the above properties.

Extract the action and observation information from the reinforcement learning environmentenv.

actInfoExt = getActionInfo(env)
actInfoExt = rlNumericSpec with properties: LowerLimit: -3 UpperLimit: 2 Name: "acceleration" Description: [0x0 string] Dimension: [1 1] DataType: "double"
obsInfoExt = getObservationInfo(env)
obsInfoExt = rlNumericSpec with properties: LowerLimit: [3x1 double] UpperLimit: [3x1 double] Name: "observations" Description: "information on velocity error and ego velocity" Dimension: [3 1] DataType: "double"

操作正ormation contains acceleration values while the observation information contains the velocity and velocity error values of the ego vehicle.

Input Arguments

collapse all

Reinforcement learning environment from which the observation information has to be extracted, specified as aSimulinkEnvWithAgentobject.

For more information on reinforcement learning environments, seeCreate Simulink Environments for Reinforcement Learning.

强化学习代理observ的ation information has to be extracted, specified as one of the following objects:

For more information on reinforcement learning agents, seeReinforcement Learning Agents.

Output Arguments

collapse all

Observation data specifications extracted from the reinforcement learning environment, returned as an array of one of the following:

Introduced in R2019a