📄 node15.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!--Converted with LaTeX2HTML 2002-2-1 (1.71)original version by: Nikos Drakos, CBLU, University of Leeds* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>WorldModel</TITLE><META NAME="description" CONTENT="WorldModel"><META NAME="keywords" CONTENT="howtorobocop"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="howtorobocop.css"><LINK REL="next" HREF="node16.html"><LINK REL="previous" HREF="node14.html"><LINK REL="up" HREF="node13.html"><LINK REL="next" HREF="node16.html"></HEAD><BODY ><DIV CLASS="navigation"><!--Navigation Panel--><A NAME="tex2html260" HREF="node16.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html256" HREF="node13.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html250" HREF="node14.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html258" HREF="node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="/usr/share/latex2html/icons/contents.png"></A> <BR><B> Next:</B> <A NAME="tex2html261" HREF="node16.html">Cerebellum</A><B> Up:</B> <A NAME="tex2html257" HREF="node13.html">Tutorial</A><B> Previous:</B> <A NAME="tex2html251" HREF="node14.html">SocketComm</A> <B> <A NAME="tex2html259" HREF="node1.html">Contents</A></B> <BR><BR></DIV><!--End of Navigation Panel--><H1><A NAME="SECTION00620000000000000000"></A><A NAME="secWorldModel"></A><BR>WorldModel</H1><P>The SocketComm parses the S-expressions that the agent receives from the server into our Predicate structure. However, to extract useful data and keep a model of the world you still have to dig through these messages. In our architecture, WorldModel does exactly this, helping you avoid handling S-expressions/predicates completely on the input side. The WorldModel is a singleton object that encapsulates the SocketComm and provides a large number of methods to determine the world state.<P>Before the WorldModel can be used, it has to be initialized by supplying a SocketComm that is connected to the server. To use the WorldModel, you have to get a reference to the singleton object:<P><BR><IMG WIDTH="567" HEIGHT="69" ALIGN="BOTTOM" BORDER="0" SRC="img6.png" ALT="\begin{program}\begin{verbatim}WorldModel::initialize(comm);WorldModel& wm = WorldModel::getInstance();\end{verbatim}\end{program}"><BR><P>The <TT>WorldModel</TT> should be updated at the beginning of every time step. This updates the <TT>SocketComm</TT> (so you don't have to call <TT>SocketComm::update()</TT> yourself anymore), reads all messages from them and updates the internal model according to them:<P><BR><IMG WIDTH="567" HEIGHT="50" ALIGN="BOTTOM" BORDER="0" SRC="img7.png" ALT="\begin{program}\begin{verbatim}wm.update();\end{verbatim}\end{program}"><BR><P>After this you can request the states of the game, the world and the agent itself by calling WorldModel's methods. For a description of these, please look at the documentation of the source code.<P><DIV CLASS="navigation"><HR><!--Navigation Panel--><A NAME="tex2html260" HREF="node16.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html256" HREF="node13.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html250" HREF="node14.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html258" HREF="node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="/usr/share/latex2html/icons/contents.png"></A> <BR><B> Next:</B> <A NAME="tex2html261" HREF="node16.html">Cerebellum</A><B> Up:</B> <A NAME="tex2html257" HREF="node13.html">Tutorial</A><B> Previous:</B> <A NAME="tex2html251" HREF="node14.html">SocketComm</A> <B> <A NAME="tex2html259" HREF="node1.html">Contents</A></B> </DIV><!--End of Navigation Panel--><ADDRESS>Bram2007-11-18</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -