Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tutorial/src/orxonox/controllers/AutonomousDroneController.cc @ 8740

Last change on this file since 8740 was 8219, checked in by dafrick, 14 years ago

Minor changes in documentation.

File size: 2.6 KB
RevLine 
[8011]1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Oli Scheuss
24 *   Co-authors:
25 *      Damian 'Mozork' Frick
26 *
27 */
28
29#include "AutonomousDroneController.h"
30
31#include "worldentities/AutonomousDrone.h"
32#include "util/Math.h"
33
34namespace orxonox
35{
36
37    /**
38    @brief
39        Constructor.
40    @param creator
41        The creator of this object.
42    */
43    AutonomousDroneController::AutonomousDroneController(BaseObject* creator) : Controller(creator)
44    {
45        //TODO: Place your code here:
[8219]46        // Make sure to register the object and create the factory.
[8011]47
48        // This checks that our creator really is a drone
49        // and saves the pointer to the drone for the controlling commands
50        AutonomousDrone* drone = dynamic_cast<AutonomousDrone*>(creator);
51        assert(drone != NULL);
52        this->setControllableEntity(drone);
53    }
54
55    /**
56    @brief
57        Destructor.
58    */
59    AutonomousDroneController::~AutonomousDroneController()
60    {
61
62    }
63
64    /**
65    @brief
66        The controlling happens here. This method defines what the controller has to do each tick.
67    @param dt
68        The duration of the tick.
69    */
70    void AutonomousDroneController::tick(float dt)
71    {
72        AutonomousDrone *myDrone = static_cast<AutonomousDrone*>(this->getControllableEntity());
73        //TODO: Place your code here:
74        // Steering commands
[8050]75        // You can use the commands provided by the AutonomousDrone to steer it:
[8011]76        // - moveFrontBack, moveRightLeft, moveUpDown
77        // - rotatePitch, rotateYaw, rotateRoll
[8219]78        // You will see, that the AutonomousDrone has two variants for each of these commands, one with a vector as input and one with just a float. Use the one with just the float as input.
[8050]79        // Apply them to myDrone (e.g. myDrone->rotateYaw(..) )
[8011]80
81    }
82}
Note: See TracBrowser for help on using the repository browser.