⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node24.html

📁 robocup3d littlegreenbats_howtorobocop-0.1.tar.gz
💻 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>Commitment</TITLE><META NAME="description" CONTENT="Commitment"><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="previous" HREF="node23.html"><LINK REL="up" HREF="node19.html"><LINK REL="next" HREF="node25.html"></HEAD><BODY ><DIV CLASS="navigation"><!--Navigation Panel--><A NAME="tex2html384"  HREF="node25.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html380"  HREF="node19.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html376"  HREF="node23.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html382"  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="tex2html385"  HREF="node25.html">Configuration XML setup</A><B> Up:</B> <A NAME="tex2html381"  HREF="node19.html">Implementing a behavior</A><B> Previous:</B> <A NAME="tex2html377"  HREF="node23.html">getCapability()</A> &nbsp; <B>  <A NAME="tex2html383"  HREF="node1.html">Contents</A></B> <BR><BR></DIV><!--End of Navigation Panel--><H3><A NAME="SECTION00651500000000000000">Commitment</A></H3><P>As explained earlier a behavior can commit to its goal when it is chosen. By doing so, it lets the super behavior know that it will take some time to reach the goal and that in intermediate steps it could not be good to switch between behaviors. Commitment is requested by setting the d_committed member variable, which should be done in the behavior's overloaded <TT>update</TT> method:<P><BR><IMG WIDTH="567" HEIGHT="297" ALIGN="BOTTOM" BORDER="0" SRC="img17.png" ALT="\begin{program}\begin{verbatim}void MyBehavior::update(){Behavior::update(......())d_committed = true;elsed_committed = false;\end{verbatim}\end{program}"><BR><P>The <TT>update</TT> method is called at the beginning of each time step if the behavior could be selected to run that timestep. First of all the <TT>Behavior::update</TT> should be called. This updates the child behaviors, checks if they are committed and commits the behavior if it should commit if children are committed <A NAME="tex2html2"  HREF="footnode.html#foot301"><SUP><SPAN CLASS="arabic">5</SPAN>.<SPAN CLASS="arabic">2</SPAN></SUP></A>. If this is the case you can choose to override this, but usually you just return.<P>Next you check whether the behavior should commit to its goal. Usually this is the case when the goal can still be reached. It is important to also reset the flag when a goal is no longer reachable, as shown in the example, to prevent a behavior to lock the agent in useless behavior. Note that the behavior's goal (<TT>d_goal</TT>) is the goal received in the previous timestep.<P><DIV CLASS="navigation"><HR><!--Navigation Panel--><A NAME="tex2html384"  HREF="node25.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html380"  HREF="node19.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html376"  HREF="node23.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html382"  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="tex2html385"  HREF="node25.html">Configuration XML setup</A><B> Up:</B> <A NAME="tex2html381"  HREF="node19.html">Implementing a behavior</A><B> Previous:</B> <A NAME="tex2html377"  HREF="node23.html">getCapability()</A> &nbsp; <B>  <A NAME="tex2html383"  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 + -