📄 node21.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>Constructor (defining slots)</TITLE><META NAME="description" CONTENT="Constructor (defining slots)"><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="node22.html"><LINK REL="previous" HREF="node20.html"><LINK REL="up" HREF="node19.html"><LINK REL="next" HREF="node22.html"></HEAD><BODY ><DIV CLASS="navigation"><!--Navigation Panel--><A NAME="tex2html350" HREF="node22.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html346" HREF="node19.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html340" HREF="node20.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html348" 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="tex2html351" HREF="node22.html">getCurrentState()</A><B> Up:</B> <A NAME="tex2html347" HREF="node19.html">Implementing a behavior</A><B> Previous:</B> <A NAME="tex2html341" HREF="node20.html">Inherit Behavior</A> <B> <A NAME="tex2html349" HREF="node1.html">Contents</A></B> <BR><BR></DIV><!--End of Navigation Panel--><H3><A NAME="SECTION00651200000000000000">Constructor (defining slots)</A></H3><P>After making the base of your behavior you have to implement the constructor, where you define the structure of the behavior's sub behaviors by creating slots. The <TT>createbehavior.pl</TT> script makes a start by creating a tree that defines a sequence of 1 step with 1 slot:<P><BR><IMG WIDTH="567" HEIGHT="145" ALIGN="BOTTOM" BORDER="0" SRC="img13.png" ALT="\begin{program}\begin{verbatim}// Define the root, which is always a sequence......_tree->getChild(0)->addChild(new AST::Node(orType));\end{verbatim}\end{program}"><BR><P>If you need more steps in the sequence, you can add new conjunction nodes (<TT>andType</TT>) to the root, if you want to run sub behaviors in parallel in a step, you can add new disjunction nodes (<TT>orType</TT>). The following gives an example of a behavior with 3 sequence steps and 2 parallel slots in the second step:<P><BR><IMG WIDTH="567" HEIGHT="374" ALIGN="BOTTOM" BORDER="0" SRC="img14.png" ALT="\begin{program}\begin{verbatim}// Define the root, which is always a sequence......_tree->getChild(2)->addChild(new AST::Node(orType));\end{verbatim}\end{program}"><BR><P><BR><HR><ADDRESS>Bram2007-11-18</ADDRESS></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -