~robot3d-team/robot3d/trunk

« back to all changes in this revision

Viewing changes to inc/srRobot/robotSSSA.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_SSSA
 
24
#define ROBOT_SSSA
 
25
 
 
26
 
 
27
#include "../../basic/robotActorBase.h"
 
28
 
 
29
 
 
30
#include "../factories/bodyFactory.h"
 
31
#include "../factories/actuatorFactory.h"
 
32
#include "../bodies/led.h"
 
33
#include "../connectors/connectorUniKarl.h"
 
34
#include "../../basic/sensors/distanceSensor.h"
 
35
#include "../../basic/sensors/cameraSensor.h"
 
36
#include "../../basic/sensors/depthImageCamera.h"
 
37
#include "../../basic/sensors/lightSensor.h"
 
38
 
 
39
//TODO: When available model new SSSA robot
 
40
 
 
41
namespace srCore {
 
42
 
 
43
 
 
44
/**
 
45
 * This class is the actor that represents a robot.  It knows how to
 
46
 * respond to keyboard presses (I, J, K, L to steer). It also listens for
 
47
 * "SpeedBoost" GameEvent.  This actor correctly handles
 
48
 * TickLocal versus TickRemote.
 
49
 */
 
50
class ROBOT_EXPORT RobotSSSA : public RobotActorBase
 
51
// : public dtGame::GameActor
 
52
{
 
53
public:
 
54
        //! Constant identifier for our game event handler method.
 
55
        static const std::string EVENT_HANDLER_NAME;
 
56
 
 
57
        //! Constructs the robot actor.
 
58
        RobotSSSA(dtGame::GameActorProxy &proxy);
 
59
 
 
60
        void setColor(osg::Vec4 color);
 
61
 
 
62
        /**
 
63
         * This method is an invokable called when an object is local and
 
64
         * receives a tick.
 
65
         * @param tickMessage A message containing tick related information.
 
66
         */
 
67
        virtual void TickLocal(const dtGame::Message &tickMessage);
 
68
 
 
69
        /**
 
70
         * This method is an invokable called when an object is remote and
 
71
         * receives a tick.
 
72
         * @param tickMessage A message containing tick related information.
 
73
         */
 
74
//      virtual void TickRemote(const dtGame::Message &tickMessage);
 
75
 
 
76
        /**
 
77
         * Generic handler for messages. Overridden from base class.
 
78
         * This is the default invokable on GameActorProxy.
 
79
         */
 
80
        virtual void ProcessMessage(const dtGame::Message &message);
 
81
 
 
82
        /** Called when the actor has been added to the game manager.
 
83
         * You can respond to OnEnteredWorld on either the proxy or actor or both.
 
84
         */
 
85
        virtual void OnEnteredWorld();
 
86
 
 
87
 
 
88
 
 
89
 
 
90
protected:
 
91
 
 
92
        //! Destructor
 
93
        virtual ~RobotSSSA();
 
94
 
 
95
private:
 
96
 
 
97
 
 
98
 
 
99
        /**
 
100
         * build the robot from meshes and attach joints and physical features to it
 
101
         * you can set the starting position & heading with the normal proxy
 
102
         * SetTranslation & SetRotation method analogical (only the first value -
 
103
         * the heading in the x-y-plane is used)
 
104
         * this Method is called from OnEnteredWorld(), so you have to call
 
105
         * the SetTranslation & SetRotation methods before the AddActor call
 
106
         */
 
107
        void            Initialize();
 
108
 
 
109
        //! delta time between two simulation steps
 
110
        double deltaTime;
 
111
 
 
112
        //! switch between manual (keyboard and GUI control) and automat (Controller) control
 
113
        bool manual;
 
114
 
 
115
        osg::Vec4 myColor;
 
116
 
 
117
 
 
118
};
 
119
 
 
120
/**
 
121
 * Our proxy class for the robot actor.  The proxy contains properties,
 
122
 * invokables, and robot actor.
 
123
 */
 
124
class ROBOT_EXPORT RobotSSSAProxy : public RobotActorBaseProxy//dtGame::GameActorProxy
 
125
{
 
126
public:
 
127
 
 
128
        //! Constructs the proxy.
 
129
        RobotSSSAProxy();
 
130
 
 
131
        //! Creates the properties that are custom to the robot proxy.
 
132
        virtual void BuildPropertyMap();
 
133
 
 
134
protected:
 
135
        virtual ~RobotSSSAProxy();
 
136
 
 
137
        //! Creates an instance of our robot tank actor
 
138
        virtual void CreateActor();
 
139
 
 
140
        /** Called when this proxy is added to the game manager (ie, the "world")
 
141
         * You can respond to OnEnteredWorld on either the proxy or actor or both.
 
142
         */
 
143
        virtual void OnEnteredWorld();
 
144
};
 
145
 
 
146
}
 
147
 
 
148
#endif                  //ROBOT_UKA