Institut de Robòtica i Informàtica Industrial

CS_DO_ObsModel

PURPOSE ^

CS_DO_ObsModel constructor.

SYNOPSIS ^

function OM=CS_DO_ObsModel(varargin)

DESCRIPTION ^

   CS_DO_ObsModel constructor.

   Defines an observation model (p(o|s))  on continuous state and discrete 
   observation spaces.

   Parameters
    S: Continuous state space.
    O: Discrete observation space.
    p: A cell array with one GMixture (in 's') for each observation.

CROSS-REFERENCE INFORMATION ^

This function calls:
  • size Returns the size of a policy.
  • rand Random state from a discrete belief.
  • rand Random state from a belief.
  • Value Evaluates a GMixture.
  • rand Generates random points on a GMixture.
  • Value Evaluation of a Gaussian.
  • rand Generates random ponts on a Gaussian.
  • ObsModel ObsModel constructor.
  • UniformProbability Uniform probability value on a continuous space.
  • dim Dimensionality of a continuous space.
  • rand Random state from a continuous space.
  • UniformProbability Uniform probability value on a discrete space.
  • dim Dimensionality of a discrete space.
  • rand Random state from a discrete space.
This function is called by:

SOURCE CODE ^

0001 function OM=CS_DO_ObsModel(varargin)
0002 %   CS_DO_ObsModel constructor.
0003 %
0004 %   Defines an observation model (p(o|s))  on continuous state and discrete
0005 %   observation spaces.
0006 %
0007 %   Parameters
0008 %    S: Continuous state space.
0009 %    O: Discrete observation space.
0010 %    p: A cell array with one GMixture (in 's') for each observation.
0011 
0012   switch nargin
0013     case 1
0014       if isa(varargin{1},'CS_DO_ObsModel')
0015         OM=varargin{1};
0016       else
0017         error('Wrong parameter type in CS_DO_ObsModel constructor');
0018       end
0019     case 3
0020       if isa(varargin{1},'CSpace')
0021         OM.S=varargin{1};
0022       else
0023         error('Wrong parameter type in CS_DO_ObsModel constructor');
0024       end
0025       if isa(varargin{2},'DSpace')
0026         OM.O=varargin{2};
0027       else
0028         error('Wrong parameter type in CS_DO_ObsModel constructor');
0029       end
0030       if isa(varargin{3},'cell')
0031         OM.p=varargin{3};
0032       else
0033         error('Wrong parameter type in CS_DO_ObsModel constructor');
0034       end
0035          
0036       no=dim(OM.O);
0037       if no~=size(OM.p,2) 
0038         error('Size missmatch in DS_CO_ObsModel constructor');
0039       end
0040       
0041       % p(s) should be uniform in 's'. We compute p(s) as
0042       %      p(s) = sum_o p(o,s)
0043       % and, assuming it is constant, we scale p(o,s) so that p(s) is
0044       % actually uniform.
0045       o=OM.p{1};
0046       for i=2:no
0047         o=o+OM.p{i};
0048       end
0049       % Scale factor to apply = What it should be (UniformProbability(OM.S))
0050       % vs. what actually is (Value(o,Center(OM.S)))
0051       % We estimate p(s) via sampling (small variations can occur)
0052       ps=0;
0053       for i=1:10
0054         ps=ps+Value(o,rand(OM.S));
0055       end
0056       ps=ps/10;
0057       scale=UniformProbability(OM.S)/ps;
0058       for i=1:no
0059         OM.p{i}=OM.p{i}*scale;
0060       end
0061       
0062       OMBase=ObsModel();
0063       
0064       OM=class(OM,'CS_DO_ObsModel',OMBase);
0065       
0066     otherwise
0067       error('Wrong number of parameters in CS_DO_ObsModel constructor');
0068   end
0069   
0070


Institut de Robòtica i Informàtica Industrial

Generated on Wed 05-Aug-2009 15:05:21 by m2html © 2003