Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 14 and Version 15 of pps/tutorial


Ignore:
Timestamp:
Sep 13, 2010, 3:16:35 PM (14 years ago)
Author:
dafrick
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • pps/tutorial

    v14 v15  
    2929 6. Additionally you can use [wiki:KDevelop3] as IDE to develop (if you don't want to use the console ;))
    3030'''Start the game for the first time'''
    31  7. Enter to the appropriate folder and start the game. You will see a menu popping up, just press the ''Standalone'' button.
     31 7. Enter to the appropriate folder and start the game. You will see a menu popping up, just press the ''Quickstart'' button.
    3232{{{
    3333cd ~/orxonox/tutorial/build
     
    4343<p style="text-align: left; color: red">Note: Do not just copy & paste! Most commands / codelines need to be edited.</p> Otherwise you'll get tons of compiler errors ;)
    4444}}}
    45 We created for you the skeleton of an autonomous drone. You can find the code in the files 'src/orxonox/worldentities/AutonomousDrone.{cc|h}' and 'src/orxonox/controllers/AutonomousDroneController.{cc|h}'.
     45We created for you the skeleton of an autonomous drone. You can find the code in the files ''src/orxonox/worldentities/AutonomousDrone.{cc|h}'' and ''src/orxonox/controllers/AutonomousDroneController.{cc|h}''.
    4646
    47  1. Open the file AutonomousDrone.cc and have a look at the code.
    48  2. In order to be able to create an AutonomousDrone object from the XML file or somewhere else just by the class name, you need to add a call of CreateFactory(Classname) somewhere inside the .cc file (global, inside the namespace).
     47 1. Open the file ''AutonomousDrone.cc'' and have a look at the code.
     48 2. In order to be able to create an AutonomousDrone object from the XML file or somewhere else just by the class name, you need to add a call of ''CreateFactory(Classname)'' somewhere inside the ''.cc'' (global, inside the namespace).
    4949{{{
    5050CreateFactory(ClassX)
    5151}}}
    52  3. Make sure the each drone object gets registered to the core by adding a call of RegisterObject(Classname) inside the constructor
     52 3. Make sure that each drone object gets registered to the core by adding a call of ''RegisterObject(Classname)'' inside the constructor.
    5353{{{
    5454RegisterObject(ClassXY)
    5555}}}
    56  4. Now go to the XMLPort function and add the calls for the two variables auxiliaryThrust_ and rotationThrust_. As you can see, the XMLPort function for the variable 'primaryThurst_' has already been specified.
     56 4. Now go to the XMLPort function and add the calls for the two variables ''auxiliaryThrust_'' and ''rotationThrust_''. As you can see, the XMLPort function for the variable ''primaryThurst_'' has already been specified.
    5757{{{
    5858XMLPortParam(Classname, "xml-attribute-name (i.e. variablename)", setFunction, getFunction, xmlelement, mode)
    5959}}}
    60  '''Note: You need to add set- and get-functions for auxiliaryThrust_ and rotationThrust_ inside the AutonomousDrone.h file (have a look at {get/set}PrimaryThrust).'''
    61  5. Now you need to add the AutonomousDrone to the build system. Open the file src/orxonox/worldentities/CMakeLists.txt and add AutonomousDrone.cc to the ORXONOX_SRC_FILES. This makes cmake consider the AutonomousDrone.cc file for further builds.
     60 '''Note: You need to add set- and get-functions for ''auxiliaryThrust_'' and ''rotationThrust_'' inside the ''AutonomousDrone.h'' file (have a look at {get/set}PrimaryThrust).'''
     61 5. Now you need to add the AutonomousDrone to the build system. Open the file ''src/orxonox/worldentities/CMakeLists.txt'' and add ''AutonomousDrone.cc'' to the ORXONOX_SRC_FILES. This makes ''cmake'' consider the ''AutonomousDrone.cc'' file for further builds.
    6262
    6363That's it for the AutonomousDrone class.
     
    6565== The AutonomousDroneController ==
    6666Now you will finish the AutonomousDroneController which gets called each tick and steers the drone.
    67  1. Open the file AutonomousDroneController.cc and look at it.
     67 1. Open the file ''AutonomousDroneController.cc'' and look at it.
    6868 2. Have a look at the constructor and make sure nothing is missing (think of the core).
    6969 3. now look at the tick function. it gets called each time before a new frame is drawn. you can put in some steering code here. if you want you can use some functions provided by Math.h:
     
    7777== The XML Part ==
    7878Now that you finished the classes you can recompile the project. Afterwards open the level file:
    79  1. Open tutorial/data/levels/tutorial.oxw
     79 1. Open ''tutorial/data/levels/tutorial.oxw''
    8080 2. We want to add a drone to the level now, so put in an entry for it (below the comment that tells you to do so). look at this example:
    8181{{{
     
    8383</ClassX>
    8484}}}
    85  3. Now add the appropriate entries for the variables you defined in AutonomousDrone/4. (Have a look at data/levels/templates/spaceship_assff.oxt for example values)
     85 3. Now add the appropriate entries for the variables you defined in AutonomousDrone/4. (Have a look at ''data/levels/templates/spaceship_assff.oxt'' for example values)
    8686 4. As we want our drone to be visible we have to attach a model to it. Add the following code between the above 2 lines:
    8787{{{
     
    122122~/orxonox/tutorial$ svn up
    123123}}}
    124  2. In order to avoid conflicts copy your file (AutonomousDroneController.cc)
     124 2. In order to avoid conflicts copy your file (''AutonomousDroneController.cc'')
    125125{{{
    126126~/orxonox/tutorial$ svn cp src/orxonox/objects/controllers/AutonomousDroneController.cc src/orxonox/objects/controllers/AutonomousDroneController_myUserName.cc
     
    130130~/orxonox/tutorial$ svn revert src/orxonox/objects/controllers/AutonomousDroneController.cc
    131131}}}
    132  4. Now commit
     132 4. Now commit.
    133133{{{
    134 ~/orxonox/tutorial$ svn ci -m "this is my version of the Drone steering function" src/orxonox/controllers/AutonomousDroneController_myUserName.cc
     134~/orxonox/tutorial$ svn ci -m "This is my version of the AutonomousDrone steering function" src/orxonox/controllers/AutonomousDroneController_myUserName.cc
    135135}}}