~robot3d-team/robot3d/trunk

« back to all changes in this revision

Viewing changes to inc/srRobot/robotUniKarl.h

  • Committer: Anne van Rossum
  • Date: 2010-08-10 15:58:55 UTC
  • Revision ID: anne@gamix-20100810155855-kve7x2vwouagdij9
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* Delta3D Open Source Game and Simulation Engine
 
3
* Copyright (C) 2006, Alion Science and Technology, BMH Operation
 
4
*
 
5
* This library is free software; you can redistribute it and/or modify it under
 
6
* the terms of the GNU Lesser General Public License as published by the Free
 
7
* Software Foundation; either version 2.1 of the License, or (at your option)
 
8
* any later version.
 
9
*
 
10
* This library is distributed in the hope that it will be useful, but WITHOUT
 
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
12
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 
13
* details.
 
14
*
 
15
* You should have received a copy of the GNU Lesser General Public License
 
16
* along with this library; if not, write to the Free Software Foundation, Inc.,
 
17
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
18
*
 
19
* @author Matthew W. Campbell
 
20
* @editor Allen M. Danklefsen
 
21
* @editor Curtiss Murphy
 
22
*/
 
23
#ifndef ROBOT_UKA
 
24
#define ROBOT_UKA
 
25
 
 
26
 
 
27
#include "../../basic/robotActorBase.h"
 
28
 
 
29
#include "../factories/bodyFactory.h"
 
30
#include "../factories/actuatorFactory.h"
 
31
#include "../factories/sensorFactory.h"
 
32
#include "../bodies/led.h"
 
33
#include "../connectors/connectorUniKarl.h"
 
34
 
 
35
//#include "../actuators/screwDrive.h"
 
36
 
 
37
namespace srCore {
 
38
 
 
39
 
 
40
 
 
41
/**
 
42
 * This class is the actor that represents a robot.  It knows how to
 
43
 * respond to keyboard presses (I, J, K, L to steer). It also listens for
 
44
 * "SpeedBoost" GameEvent.  This actor correctly handles
 
45
 * TickLocal versus TickRemote.
 
46
 */
 
47
class ROBOT_EXPORT RobotUniKarl : public RobotActorBase
 
48
// : public dtGame::GameActor
 
49
{
 
50
public:
 
51
        //! Constant identifier for our game event handler method.
 
52
        static const std::string EVENT_HANDLER_NAME;
 
53
 
 
54
        //! Constructs the robot actor.
 
55
        RobotUniKarl(dtGame::GameActorProxy &proxy);
 
56
 
 
57
        /**
 
58
         * This method is an invokable called when an object is local and
 
59
         * receives a tick.
 
60
         * @param tickMessage A message containing tick related information.
 
61
         */
 
62
        virtual void TickLocal(const dtGame::Message &tickMessage);
 
63
 
 
64
        /**
 
65
         * This method is an invokable called when an object is remote and
 
66
         * receives a tick.
 
67
         * @param tickMessage A message containing tick related information.
 
68
         */
 
69
//      virtual void TickRemote(const dtGame::Message &tickMessage);
 
70
 
 
71
        /**
 
72
         * Generic handler for messages. Overridden from base class.
 
73
         * This is the default invokable on GameActorProxy.
 
74
         */
 
75
        virtual void ProcessMessage(const dtGame::Message &message);
 
76
 
 
77
        /** Called when the actor has been added to the game manager.
 
78
         * You can respond to OnEnteredWorld on either the proxy or actor or both.
 
79
         */
 
80
        virtual void OnEnteredWorld();
 
81
 
 
82
 
 
83
 
 
84
 
 
85
protected:
 
86
        virtual ~RobotUniKarl();
 
87
        
 
88
        /**
 
89
         * build the robot from meshes and attach joints and physical features to it
 
90
         * you can set the starting position & heading with the normal proxy
 
91
         * SetTranslation & SetRotation method analogical (only the first value -
 
92
         * the heading in the x-y-plane is used)
 
93
         * this Method is called from OnEnteredWorld(), so you have to call
 
94
         * the SetTranslation & SetRotation methods before the AddActor call
 
95
         */
 
96
        void            Initialize();
 
97
 
 
98
private:
 
99
        //! delta time between two simulation steps
 
100
        double deltaTime;
 
101
 
 
102
        //! switch between manual (keyboard and GUI control) and automat (Controller) control
 
103
        bool manual;
 
104
 
 
105
 
 
106
};
 
107
 
 
108
/**
 
109
 * Our proxy class for the robot actor.  The proxy contains properties,
 
110
 * invokables, and robot actor.
 
111
 */
 
112
class ROBOT_EXPORT RobotUniKarlProxy : public RobotActorBaseProxy//dtGame::GameActorProxy
 
113
{
 
114
public:
 
115
 
 
116
        //! Constructs the proxy.
 
117
        RobotUniKarlProxy();
 
118
 
 
119
        //! Creates the properties that are custom to the robot proxy.
 
120
        virtual void BuildPropertyMap();
 
121
 
 
122
protected:
 
123
        virtual ~RobotUniKarlProxy();
 
124
 
 
125
        //! Creates an instance of our robot tank actor
 
126
        virtual void CreateActor();
 
127
 
 
128
        /** Called when this proxy is added to the game manager (ie, the "world")
 
129
         * You can respond to OnEnteredWorld on either the proxy or actor or both.
 
130
         */
 
131
        virtual void OnEnteredWorld();
 
132
};
 
133
 
 
134
}
 
135
 
 
136
#endif                  //ROBOT_UKA