HowTo create a new skill ======================== $Id: CreateSkill.txt,v 1.5 2005/09/05 16:09:55 petan Exp $ Created 2000-09-16 by Fredrik Heintz Last updated 2005-09-05 by Peter Andersson The purpose of this HowTo is to describe how to create a new skill and add it to the RoboSoc distribution. I will use the FindBall skill as an example. All paths are relative to the RoboSoc directory. Hint: Copy this file and then search and replace FindBall with the name of the skill you want to create. Then you can copy the commands from this file without very many changes. -1. Make sure that the template directory is updated. &> cvs update -d Framework/template/ 0. Go to the RoboSoc directory. 1. Copy the files SkillStub.h SkillStub.icc SkillStub.cc from Framework/template to the directory where you want the skill. %> cp Framework/template/SkillStub.* myDir 2. Change the names of the files to the name of the skill. %> cd myDir %> mv SkillStub.h FindBall.h %> mv SkillStub.icc FindBall.icc %> mv SkillStub.cc FindBall.cc 3. Open the files and change the names inside. %> emacs FindBall.h FindBall.icc FindBall.cc & C-x b FindBall.cc (change buffers to FindBall.cc) M-< (goto the top of the file) M-% skillstub FindBall (search and replace) ! (replace all instances) C-x b FindBall.icc (change buffers to FindBall.icc) replace the names as above C-x b FindBall.h (change buffers to FindBall.h) replace the names as above 4. If the skill should use arguments then it should inherit from SkillWithArguments or one of its subclasses. C-x b FindBall.h (change buffers to FindBall.h) C-s #include "Skill.h" (search for #include "Skill.h") change it to #include "SkillWithArguments.h" (or another class) C-s public Skill (search for public skill) change it to public SkillWithArguments (or the other class) C-x b FindBall.cc (change buffers to FindBall.cc) C-s : Skill (search for : Skill) change it to : SkillWithArguments (or the other class) 5. Change the description of the files and the skill. C-x b FindBall.h (change buffers to FindBall.h) C-s Created by (search Created by) change the name and date C-s $Log (search for $Log) remove everything between $Log ...$ and */ C-s @class (search for @class) change the description of the skill, its preconditions and postconditions. C-x C-s (save the changes) C-x b FindBall.icc (change buffers to FindBall.icc) change name, date and remove old log information as above C-x b FindBall.cc (change buffers to FindBall.cc) change name, date and remove old log information as above 6. Add the skill dependecies to the implementation file. C-x b FindBall.cc (change buffers to FindBall.cc) C-s #include (search for #include) add #include "SkillName.h" to make a dependency C-x C-s (save the changes) 7. If you don't use an inline methods then the .icc file should be empty. If it is, delete it. Also remove the section as instructed at the end of the .h and .cc files. %> rm FindBall.icc C-x b FindBall.cc (change buffers to FindBall.cc) C-s // Remove (search for // Remove) remove the section C-x C-s (save the changes) C-x b FindBall.h (change buffers to FindBall.h) remove as above 8. Add the files to Makefile.am C-x C-f Makefile.am (open myDir/Makefile.am) add FindBall.h and FindBall.icc to SKILL_HEADER only FindBall.h if no inline methods are used add FindBall.cc to SKILL_SOURCE If add the files on a new line don't forget the backslash at the end of the previous line! 9. Try to compile the skill %> make