[Orxonox-commit 7311] r11928 - in code/branches/ScriptableController_FS18: data/levels data/levels/scripts data/levels/templates src/orxonox/controllers src/orxonox/scriptablecontroller src/orxonox/worldentities src/orxonox/worldentities/pawns
adamc at orxonox.net
adamc at orxonox.net
Thu May 3 13:46:20 CEST 2018
Author: adamc
Date: 2018-05-03 13:46:20 +0200 (Thu, 03 May 2018)
New Revision: 11928
Added:
code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw
code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw
code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua
code/branches/ScriptableController_FS18/data/levels/scripts/BBBScriptableControllerTest.lua
code/branches/ScriptableController_FS18/data/levels/scripts/empty.lua
code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt
code/branches/ScriptableController_FS18/src/orxonox/controllers/AutonomousDroneController.cc
code/branches/ScriptableController_FS18/src/orxonox/controllers/AutonomousDroneController.h
code/branches/ScriptableController_FS18/src/orxonox/worldentities/AutonomousDrone.cc
code/branches/ScriptableController_FS18/src/orxonox/worldentities/AutonomousDrone.h
code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.cc
code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.h
Modified:
code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
Log:
Level & Script backup
Added: code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw (rev 0)
+++ code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw 2018-05-03 11:46:20 UTC (rev 11928)
@@ -0,0 +1,42 @@
+<LevelInfo
+ name = "AAAScriptableControllerTest"
+ description = "A level with absolutely nothing in it."
+ tags = "test"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+ include("templates/HeavyCruiser.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipEscort.oxt")
+ include("templates/endurancetest_template.oxt")
+?>
+
+<Level script="scripts/AAAScriptableControllerTest.lua">
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+
+ <ModularSpaceShip id="Station" velocity= "0,0,0" position="50000000,0,0" lookat= "0,0,0" health="500" maxhealth="500" initialhealth="500">
+ <templates>
+ <Template link=endurance />
+ </templates>
+ </ModularSpaceShip>
+
+ </Scene>
+</Level>
Added: code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw (rev 0)
+++ code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw 2018-05-03 11:46:20 UTC (rev 11928)
@@ -0,0 +1,45 @@
+<LevelInfo
+ name = "BBBScriptableControllerTest"
+ description = "Demonstrates moving and killing a drone by use of a script."
+ tags = "test"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+ include("templates/HeavyCruiser.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipEscort.oxt")
+ include("templates/endurancetest_template.oxt")
+?>
+
+<Level script="scripts/BBBScriptableControllerTest.lua">
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="100,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+
+ <AAAAutonomousDrone id="Dummy" position="0,0,0" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
+ <attached>
+ <Model scale="10" mesh="drone.mesh"/>
+ </attached>
+ </AAAAutonomousDrone>
+
+
+
+
+ </Scene>
+</Level>
Added: code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua (rev 0)
+++ code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua 2018-05-03 11:46:20 UTC (rev 11928)
@@ -0,0 +1,50 @@
+
+rotate_factor = 0
+station_loc = 200
+station_speed = 0
+
+function spawn_station(obj)
+ orxPrint("Spawning station")
+ setPosition("Station", 500, 0, 0)
+ setOrientation("Station", 0, -1, 0, 0)
+end
+
+function rotate_faster(obj1, obj2, health, shield)
+ orxPrint("Rotating station faster")
+
+ rotate_factor = rotate_factor + 0.02
+ setAngularVelocity("Station", rotate_factor, 0, 0)
+end
+
+
+function kill_player()
+ orxPrint("Killing player")
+ killPawn("Player")
+end
+
+function kill_player_after_timeout(pawn)
+ orxPrint("Killing player after 5s")
+
+ registerAfterTimeout(kill_player, 5)
+end
+
+function next_station_loc(obj1, obj2)
+ orxPrint("Moving station")
+
+ station_loc = station_loc + 500
+ setPosition("Station", station_loc, 0, 0)
+
+ station_speed = station_speed + 5
+ setVelocity("Station", -station_speed, 0, 0)
+
+ registerAtNearObject(next_station_loc, "Player", "Station", 200)
+end
+
+
+
+
+
+orxPrint("Script started! OMG ROFL LOL WTF")
+mytestfunction(3.0, 4.0)
+spawn("ModularSpaceShip","Station2")
+
Added: code/branches/ScriptableController_FS18/data/levels/scripts/BBBScriptableControllerTest.lua
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/scripts/BBBScriptableControllerTest.lua (rev 0)
+++ code/branches/ScriptableController_FS18/data/levels/scripts/BBBScriptableControllerTest.lua 2018-05-03 11:46:20 UTC (rev 11928)
@@ -0,0 +1,80 @@
+
+rotate_factor = 0
+station_loc = 200
+station_speed = 0
+
+id = "Dummy"
+
+function spawn_station(obj)
+ orxPrint("Spawning station")
+ setPosition("Station", 500, 0, 0)
+ setOrientation("Station", 0, -1, 0, 0)
+end
+
+function rotate_faster(obj1, obj2, health, shield)
+ orxPrint("Rotating station faster")
+
+ rotate_factor = rotate_factor + 0.02
+ setAngularVelocity("Station", rotate_factor, 0, 0)
+end
+
+
+function kill_player()
+ orxPrint("Killing player")
+ killPawn("Player")
+end
+
+
+function kill_dummy()
+ orxPrint("Killing dummy!")
+ killPawn(id)
+end
+
+
+function kill_player_after_timeout(pawn)
+ orxPrint("Killing player after 5s")
+
+ registerAfterTimeout(kill_player, 5)
+end
+
+function kill_dummy_after_timeout(seconds)
+ orxPrint("Killing dummy after " .. tostring(seconds))
+ registerAfterTimeout(kill_dummy, seconds)
+end
+
+
+function move_dummy()
+ orxPrint("Moving dummy!")
+ moveControllableEntity(id, 100.0, 0.0, 0.0)
+end
+
+function move_dummy_after_timeout(seconds)
+ orxPrint("Moving dummy after " .. tostring(seconds))
+
+ registerAfterTimeout(move_dummy, seconds)
+end
+
+
+function next_station_loc(obj1, obj2)
+ orxPrint("Moving station")
+
+ station_loc = station_loc + 500
+ setPosition("Station", station_loc, 0, 0)
+
+ station_speed = station_speed + 5
+ setVelocity("Station", -station_speed, 0, 0)
+
+ registerAtNearObject(next_station_loc, "Player", "Station", 200)
+end
+
+
+
+
+
+move_dummy_after_timeout(3)
+kill_dummy_after_timeout(6)
+
+orxPrint("Script started! OMG ROFL LOL WTF")
+mytestfunction(3.0, 4.0)
+
+
Added: code/branches/ScriptableController_FS18/data/levels/scripts/empty.lua
===================================================================
Added: code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt
===================================================================
Added: code/branches/ScriptableController_FS18/src/orxonox/controllers/AutonomousDroneController.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/controllers/AutonomousDroneController.cc (rev 0)
+++ code/branches/ScriptableController_FS18/src/orxonox/controllers/AutonomousDroneController.cc 2018-05-03 11:46:20 UTC (rev 11928)
@@ -0,0 +1,115 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#include "AutonomousDroneController.h"
+
+#include "worldentities/AutonomousDrone.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+ //TODO: Put your code in here:
+ // Create the factory for the drone controller.
+ RegisterClass(AutonomousDroneController);
+ /**
+ @brief
+ Constructor.
+ @param context
+ The context of this object.
+ */
+ AutonomousDroneController::AutonomousDroneController(Context* context) : Controller(context)
+ {
+ //TODO: Place your code here:
+ // Make sure to register the object and create the factory.
+ RegisterObject(AutonomousDroneController);
+ // This checks that our context really is a drone
+ // and saves the pointer to the drone for the controlling commands
+ /* NOTE from Sandro: This is currently broken */
+ //AutonomousDrone* drone = dynamic_cast<AutonomousDrone*>(context);
+ //assert(drone != nullptr);
+ //this->setControllableEntity(drone);
+ }
+
+ /**
+ @brief
+ Destructor.
+ */
+ AutonomousDroneController::~AutonomousDroneController()
+ {
+
+ }
+
+ /**
+ @brief
+ The controlling happens here. This method defines what the controller has to do each tick.
+ @param dt
+ The duration of the tick.
+ */
+ void AutonomousDroneController::tick(float dt)
+ {
+
+ static int i = 0;
+
+ /* NOTE: Ugly hack by Sandro to make the tutorial work for the moment.
+ * This will be reverted once the framework update is complete
+ */
+ //AutonomousDrone *myDrone = static_cast<AutonomousDrone*>(this->getControllableEntity());
+ ObjectList<AutonomousDrone> objectList;
+ ObjectList<AutonomousDrone>::iterator it = objectList.begin();
+ AutonomousDrone* myDrone = *it;
+
+ if (myDrone != nullptr)
+ {
+ //TODO: Place your code here:
+ // Steering commands
+ // You can use the commands provided by the AutonomousDrone to steer it:
+ // - moveFrontBack, moveRightLeft, moveUpDown
+ // - rotatePitch, rotateYaw, rotateRoll
+ // 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.
+ // Apply them to myDrone (e.g. myDrone->rotateYaw(..) )
+ // dt is the time passed since the last call of the tick function in seconds.
+ int iMax = 100;
+ double R = 250;
+
+ double x = R * cos(math::twoPi/iMax*i);
+ double y = R * sin(math::twoPi/iMax*i);
+
+
+ const Vector2 motion1 = Vector2(x,0);
+ const Vector2 motion2 = Vector2(y,0);
+
+
+ myDrone->moveRightLeft(motion1);
+ myDrone->moveUpDown(motion2);
+
+ i = (i+1)%iMax;
+
+
+ }
+ }
+}
Added: code/branches/ScriptableController_FS18/src/orxonox/controllers/AutonomousDroneController.h
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/controllers/AutonomousDroneController.h (rev 0)
+++ code/branches/ScriptableController_FS18/src/orxonox/controllers/AutonomousDroneController.h 2018-05-03 11:46:20 UTC (rev 11928)
@@ -0,0 +1,59 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#ifndef _AutonomousDroneController_H__
+#define _AutonomousDroneController_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Controller.h"
+#include "tools/interfaces/Tickable.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ Controller for the AutonomousDrone of the PPS tutorial.
+ @author
+ Oli Scheuss
+ */
+ class _OrxonoxExport AutonomousDroneController : public Controller, public Tickable
+ {
+ public:
+ AutonomousDroneController(Context* context);
+ virtual ~AutonomousDroneController();
+
+ virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick.
+
+ protected:
+
+ private:
+ };
+}
+
+#endif /* _AutonomousDroneController_H__ */
Modified: code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc 2018-04-29 12:07:18 UTC (rev 11927)
+++ code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc 2018-05-03 11:46:20 UTC (rev 11928)
@@ -151,6 +151,8 @@
WorldEntity *entity;
Identifiable *obj = identifier->fabricate(this->controller_->getWorldEntityByID("Player")->getContext());
+ orxout(user_error) << "First hit!" << std::endl;
+
if(obj->isA(ClassIdentifier<WorldEntity>::getIdentifier()))
{
entity = orxonox_cast<WorldEntity*>(obj);
@@ -172,6 +174,8 @@
return;
}
+ orxout(user_error) << "Second hit!" << std::endl;
+
if(entity->isA(ClassIdentifier<MobileEntity>::getIdentifier()))
this->controller_->registerMobileEntity(id, orxonox_cast<MobileEntity*>(entity));
@@ -179,6 +183,8 @@
this->controller_->registerPawn(id, orxonox_cast<Pawn*>(entity));
this->controller_->registerWorldEntity(id, orxonox_cast<WorldEntity*>(entity));
+
+ orxout(user_error) << "Third and final hit!" << std::endl;
}
void ScriptableControllerAPI::setPosition(std::string id, double x, double y, double z)
@@ -378,6 +384,10 @@
return z;
}
+
+
+
+
void ScriptableControllerAPI::moveControllableEntity(std::string id, double x, double y, double z)
{
MobileEntity *entity = this->controller_->getMobileEntityByID(id);
@@ -388,16 +398,17 @@
}
-
-
Identifier *identifier = ClassByString("ControllableEntity");
ControllableEntity *controllable_entity;
+
if(identifier->isA(ClassIdentifier<ControllableEntity>::getIdentifier()))
{
controllable_entity = orxonox_cast<ControllableEntity*>(entity);
+ orxout(user_warning) << "Accessed " << id << std::endl;
+
controllable_entity->moveFrontBack(x);
controllable_entity->moveRightLeft(y);
controllable_entity->moveUpDown(z);
Added: code/branches/ScriptableController_FS18/src/orxonox/worldentities/AutonomousDrone.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/worldentities/AutonomousDrone.cc (rev 0)
+++ code/branches/ScriptableController_FS18/src/orxonox/worldentities/AutonomousDrone.cc 2018-05-03 11:46:20 UTC (rev 11928)
@@ -0,0 +1,200 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#include "AutonomousDrone.h"
+
+#include "core/CoreIncludes.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+namespace orxonox
+{
+ //TODO: Put your code in here:
+ // Create the factory for the drone.
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes some default values.
+ @param creator
+ The creator of this object.
+ */
+
+ RegisterClass(AutonomousDrone);
+
+ AutonomousDrone::AutonomousDrone(Context* context) : ControllableEntity(context)
+ {
+ //TODO: Put your code in here:
+ // Register the drone class to the core.
+
+ RegisterObject(AutonomousDrone);
+
+ this->myController_ = NULL;
+
+ this->localLinearAcceleration_.setValue(0, 0, 0);
+ this->localAngularAcceleration_.setValue(0, 0, 0);
+ this->primaryThrust_ = 100;
+ this->auxiliaryThrust_ = 100;
+ this->rotationThrust_ = 10;
+ this->mass_ = 100;
+ this->linearDamping_ = 0.5;
+ this->angularDamping_ = 0.3;
+
+ this->setCollisionType(CollisionType::Dynamic);
+
+ //this->myController_ = new AutonomousDroneController(this); // Creates a new controller and passes our this pointer to it as creator.
+ }
+
+ /**
+ @brief
+ Destructor. Destroys controller, if present.
+ */
+ AutonomousDrone::~AutonomousDrone()
+ {
+ // Deletes the controller if the object was initialized and the pointer to the controller is not NULL.
+ if( this->isInitialized() && this->myController_ != NULL )
+ delete this->myController_;
+ }
+
+ /**
+ @brief
+ Method for creating a AutonomousDrone through XML.
+ */
+ void AutonomousDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ // This calls the XMLPort function of the parent class
+ SUPER(AutonomousDrone, XMLPort, xmlelement, mode);
+
+ XMLPortParam(AutonomousDrone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
+ //TODO: Put your code in here:
+ // Make sure you add the variables auxiliaryThrust_ and rotationThrust_ to XMLPort.
+ // Variables can be added by the following command
+ // XMLPortParam(Classname, "xml-attribute-name (i.e. variablename)", setFunctionName, getFunctionName, xmlelement, mode);
+ // Also make sure that you also create the get- and set-functions in AutonomousDrone.h. As you can see, the get- and set-functions for the variable primaryThrust_ has already been specified there, so you can get your inspiration from there.
+ XMLPortParam(AutonomousDrone, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);
+ XMLPortParam(AutonomousDrone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
+ XMLPortParam(AutonomousDrone, "mass", setMass, getMass, xmlelement, mode);
+ XMLPortParam(AutonomousDrone, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode);
+ XMLPortParam(AutonomousDrone, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode);
+
+
+
+
+
+ }
+
+ /**
+ @brief
+ Defines which actions the AutonomousDrone has to take in each tick.
+ @param dt
+ The length of the tick.
+ */
+ void AutonomousDrone::tick(float dt)
+ {
+ SUPER(AutonomousDrone, tick, dt);
+
+ this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxiliaryThrust_);
+ this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxiliaryThrust_);
+ if (this->localLinearAcceleration_.z() > 0)
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxiliaryThrust_);
+ else
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
+ this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
+ this->localLinearAcceleration_.setValue(0, 0, 0);
+
+ this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
+ this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
+ this->localAngularAcceleration_.setValue(0, 0, 0);
+ }
+
+ /**
+ @brief
+ Moves the AutonomousDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the movement.
+ */
+ void AutonomousDrone::moveFrontBack(const Vector2& value)
+ {
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
+ }
+
+ /**
+ @brief
+ Moves the AutonomousDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the movement.
+ */
+ void AutonomousDrone::moveRightLeft(const Vector2& value)
+ {
+ this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
+ }
+
+ /**
+ @brief
+ Moves the AutonomousDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the movement.
+ */
+ void AutonomousDrone::moveUpDown(const Vector2& value)
+ {
+ this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
+ }
+
+ /**
+ @brief
+ Rotates the AutonomousDrone around the y-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void AutonomousDrone::rotateYaw(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
+ }
+
+ /**
+ @brief
+ Rotates the AutonomousDrone around the x-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void AutonomousDrone::rotatePitch(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
+ }
+
+ /**
+ @brief
+ Rotates the AutonomousDrone around the z-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void AutonomousDrone::rotateRoll(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
+ }
+
+
+}
Added: code/branches/ScriptableController_FS18/src/orxonox/worldentities/AutonomousDrone.h
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/worldentities/AutonomousDrone.h (rev 0)
+++ code/branches/ScriptableController_FS18/src/orxonox/worldentities/AutonomousDrone.h 2018-05-03 11:46:20 UTC (rev 11928)
@@ -0,0 +1,212 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#ifndef _AutonomousDrone_H__
+#define _AutonomousDrone_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/XMLPort.h"
+#include "controllers/AutonomousDroneController.h"
+
+#include "ControllableEntity.h"
+
+namespace orxonox {
+
+ /**
+ @brief
+ Drone, that is made to move upon a specified pattern.
+ This class was constructed for the PPS tutorial.
+ @author
+ Oli Scheuss
+ */
+ class _OrxonoxExport AutonomousDrone : public ControllableEntity
+ {
+ public:
+ AutonomousDrone(Context* context);
+ virtual ~AutonomousDrone();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
+ virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
+
+ virtual void moveFrontBack(const Vector2& value);
+ virtual void moveRightLeft(const Vector2& value);
+ virtual void moveUpDown(const Vector2& value);
+
+ virtual void rotateYaw(const Vector2& value);
+ virtual void rotatePitch(const Vector2& value);
+ virtual void rotateRoll(const Vector2& value);
+
+ /**
+ @brief Moves the Drone in the Front/Back-direction by the specifed amount.
+ @param value The amount by which the drone is to be moved.
+ */
+
+
+ inline void moveFrontBack(float value)
+ { this->moveFrontBack(Vector2(value, 0)); }
+ /**
+ @brief Moves the Drone in the Right/Left-direction by the specifed amount.
+ @param value The amount by which the drone is to be moved.
+ */
+ inline void moveRightLeft(float value)
+ { this->moveRightLeft(Vector2(value, 0)); }
+ /**
+ @brief Moves the Drone in the Up/Down-direction by the specifed amount.
+ @param value The amount by which the drone is to be moved.
+ */
+ inline void moveUpDown(float value)
+ { this->moveUpDown(Vector2(value, 0)); }
+
+ /**
+ @brief Rotates the Drone around the y-axis by the specifed amount.
+ @param value The amount by which the drone is to be rotated.
+ */
+ inline void rotateYaw(float value)
+ { this->rotateYaw(Vector2(value, 0)); }
+ /**
+ @brief Rotates the Drone around the x-axis by the specifed amount.
+ @param value The amount by which the drone is to be rotated.
+ */
+ inline void rotatePitch(float value)
+ { this->rotatePitch(Vector2(value, 0)); }
+ /**
+ @brief Rotates the Drone around the z-axis by the specifed amount.
+ @param value The amount by which the drone is to be rotated.
+ */
+ inline void rotateRoll(float value)
+ { this->rotateRoll(Vector2(value, 0)); }
+
+ /**
+ @brief Sets the primary thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setPrimaryThrust( float thrust )
+ { this->primaryThrust_ = thrust; }
+ //TODO: Place your set-functions here.
+ // Hint: auxiliary thrust, rotation thrust.
+
+
+ /**
+ @brief Sets the auxiliary thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setAuxiliaryThrust( float thrust )
+ { this->auxiliaryThrust_ = thrust; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setRotationThrust( float thrust )
+ { this->rotationThrust_ = thrust; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setMass( float mass )
+ { this->mass_ = mass; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setLinearDamping( float damping )
+ { this->linearDamping_ = damping; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setAngularDamping( float damping )
+ { this->angularDamping_ = damping; }
+
+
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getPrimaryThrust()
+ { return this->primaryThrust_; }
+ //TODO: Place your get-functions here.
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getAuxiliaryThrust()
+ { return this->auxiliaryThrust_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getRotationThrust()
+ { return this->rotationThrust_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getMass()
+ { return this->mass_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getLinearDamping()
+ { return this->linearDamping_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getAngularDamping()
+ { return this->angularDamping_; }
+
+
+
+ private:
+ AutonomousDroneController *myController_; //!< The controller of the AutonomousDrone.
+
+ btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the AutonomousDrone the next tick.
+ btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the AutonomousDrone the next tick.
+ float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward.
+ float auxiliaryThrust_; //!< The amount of auxiliary thrust. Used for all other movements (except for rotations).
+ float rotationThrust_; //!< The amount of rotation thrust. Used for rotations only.s
+ float mass_;
+ float linearDamping_;
+ float angularDamping_;
+ };
+
+}
+
+#endif // _AutonomousDrone_H__
Added: code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.cc (rev 0)
+++ code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.cc 2018-05-03 11:46:20 UTC (rev 11928)
@@ -0,0 +1,204 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#include "AAAAutonomousDrone.h"
+
+#include "core/CoreIncludes.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+namespace orxonox
+{
+ //TODO: Put your code in here:
+ // Create the factory for the drone.
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes some default values.
+ @param creator
+ The creator of this object.
+ */
+
+ RegisterClass(AAAAutonomousDrone);
+
+ AAAAutonomousDrone::AAAAutonomousDrone(Context* context) : Pawn(context)
+ {
+ //TODO: Put your code in here:
+ // Register the drone class to the core.
+
+ RegisterObject(AAAAutonomousDrone);
+
+ //this->myController_ = NULL;
+
+ this->localLinearAcceleration_.setValue(0, 0, 0);
+ this->localAngularAcceleration_.setValue(0, 0, 0);
+ this->primaryThrust_ = 100;
+ this->auxiliaryThrust_ = 100;
+ this->rotationThrust_ = 10;
+ this->mass_ = 100;
+ this->linearDamping_ = 0.5;
+ this->angularDamping_ = 0.3;
+
+ this->setRadarVisibility(false);
+
+ this->setCollisionType(WorldEntity::CollisionType::Dynamic);
+
+ //this->setCollisionType(CollisionType::Dynamic);
+
+ //this->myController_ = new AAAAutonomousDroneController(this); // Creates a new controller and passes our this pointer to it as creator.
+ }
+
+ /**
+ @brief
+ Destructor. Destroys controller, if present.
+ */
+ AAAAutonomousDrone::~AAAAutonomousDrone()
+ {
+ // Deletes the controller if the object was initialized and the pointer to the controller is not NULL.
+ if( this->isInitialized()); //)&& this->myController_ != NULL )
+ //delete this->myController_;
+ }
+
+ /**
+ @brief
+ Method for creating a AAAAutonomousDrone through XML.
+ */
+ void AAAAutonomousDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ // This calls the XMLPort function of the parent class
+ SUPER(AAAAutonomousDrone, XMLPort, xmlelement, mode);
+
+ XMLPortParam(AAAAutonomousDrone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
+ //TODO: Put your code in here:
+ // Make sure you add the variables auxiliaryThrust_ and rotationThrust_ to XMLPort.
+ // Variables can be added by the following command
+ // XMLPortParam(Classname, "xml-attribute-name (i.e. variablename)", setFunctionName, getFunctionName, xmlelement, mode);
+ // Also make sure that you also create the get- and set-functions in AAAAutonomousDrone.h. As you can see, the get- and set-functions for the variable primaryThrust_ has already been specified there, so you can get your inspiration from there.
+ XMLPortParam(AAAAutonomousDrone, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);
+ XMLPortParam(AAAAutonomousDrone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
+ XMLPortParam(AAAAutonomousDrone, "mass", setMass, getMass, xmlelement, mode);
+ XMLPortParam(AAAAutonomousDrone, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode);
+ XMLPortParam(AAAAutonomousDrone, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode);
+
+
+
+
+
+ }
+
+ /**
+ @brief
+ Defines which actions the AAAAutonomousDrone has to take in each tick.
+ @param dt
+ The length of the tick.
+ */
+ void AAAAutonomousDrone::tick(float dt)
+ {
+ SUPER(AAAAutonomousDrone, tick, dt);
+
+ this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxiliaryThrust_);
+ this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxiliaryThrust_);
+ if (this->localLinearAcceleration_.z() > 0)
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxiliaryThrust_);
+ else
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
+ this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
+ this->localLinearAcceleration_.setValue(0, 0, 0);
+
+ this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
+ this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
+ this->localAngularAcceleration_.setValue(0, 0, 0);
+ }
+
+ /**
+ @brief
+ Moves the AAAAutonomousDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the movement.
+ */
+ void AAAAutonomousDrone::moveFrontBack(const Vector2& value)
+ {
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
+ }
+
+ /**
+ @brief
+ Moves the AAAAutonomousDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the movement.
+ */
+ void AAAAutonomousDrone::moveRightLeft(const Vector2& value)
+ {
+ this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
+ }
+
+ /**
+ @brief
+ Moves the AAAAutonomousDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the movement.
+ */
+ void AAAAutonomousDrone::moveUpDown(const Vector2& value)
+ {
+ this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
+ }
+
+ /**
+ @brief
+ Rotates the AAAAutonomousDrone around the y-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void AAAAutonomousDrone::rotateYaw(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
+ }
+
+ /**
+ @brief
+ Rotates the AAAAutonomousDrone around the x-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void AAAAutonomousDrone::rotatePitch(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
+ }
+
+ /**
+ @brief
+ Rotates the AAAAutonomousDrone around the z-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void AAAAutonomousDrone::rotateRoll(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
+ }
+
+
+}
Added: code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.h
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.h (rev 0)
+++ code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.h 2018-05-03 11:46:20 UTC (rev 11928)
@@ -0,0 +1,212 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#ifndef _AAAAutonomousDrone_H__
+#define _AAAAutonomousDrone_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/XMLPort.h"
+//#include "controllers/AutonomousDroneController.h"
+
+#include "Pawn.h"
+
+namespace orxonox {
+
+ /**
+ @brief
+ Drone, that is made to move upon a specified pattern.
+ This class was constructed for the PPS tutorial.
+ @author
+ Oli Scheuss
+ */
+ class _OrxonoxExport AAAAutonomousDrone : public Pawn
+ {
+ public:
+ AAAAutonomousDrone(Context* context);
+ virtual ~AAAAutonomousDrone();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
+ virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
+
+ virtual void moveFrontBack(const Vector2& value);
+ virtual void moveRightLeft(const Vector2& value);
+ virtual void moveUpDown(const Vector2& value);
+
+ virtual void rotateYaw(const Vector2& value);
+ virtual void rotatePitch(const Vector2& value);
+ virtual void rotateRoll(const Vector2& value);
+
+ /**
+ @brief Moves the Drone in the Front/Back-direction by the specifed amount.
+ @param value The amount by which the drone is to be moved.
+ */
+
+
+ inline void moveFrontBack(float value)
+ { this->moveFrontBack(Vector2(value, 0)); }
+ /**
+ @brief Moves the Drone in the Right/Left-direction by the specifed amount.
+ @param value The amount by which the drone is to be moved.
+ */
+ inline void moveRightLeft(float value)
+ { this->moveRightLeft(Vector2(value, 0)); }
+ /**
+ @brief Moves the Drone in the Up/Down-direction by the specifed amount.
+ @param value The amount by which the drone is to be moved.
+ */
+ inline void moveUpDown(float value)
+ { this->moveUpDown(Vector2(value, 0)); }
+
+ /**
+ @brief Rotates the Drone around the y-axis by the specifed amount.
+ @param value The amount by which the drone is to be rotated.
+ */
+ inline void rotateYaw(float value)
+ { this->rotateYaw(Vector2(value, 0)); }
+ /**
+ @brief Rotates the Drone around the x-axis by the specifed amount.
+ @param value The amount by which the drone is to be rotated.
+ */
+ inline void rotatePitch(float value)
+ { this->rotatePitch(Vector2(value, 0)); }
+ /**
+ @brief Rotates the Drone around the z-axis by the specifed amount.
+ @param value The amount by which the drone is to be rotated.
+ */
+ inline void rotateRoll(float value)
+ { this->rotateRoll(Vector2(value, 0)); }
+
+ /**
+ @brief Sets the primary thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setPrimaryThrust( float thrust )
+ { this->primaryThrust_ = thrust; }
+ //TODO: Place your set-functions here.
+ // Hint: auxiliary thrust, rotation thrust.
+
+
+ /**
+ @brief Sets the auxiliary thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setAuxiliaryThrust( float thrust )
+ { this->auxiliaryThrust_ = thrust; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setRotationThrust( float thrust )
+ { this->rotationThrust_ = thrust; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setMass( float mass )
+ { this->mass_ = mass; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setLinearDamping( float damping )
+ { this->linearDamping_ = damping; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setAngularDamping( float damping )
+ { this->angularDamping_ = damping; }
+
+
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getPrimaryThrust()
+ { return this->primaryThrust_; }
+ //TODO: Place your get-functions here.
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getAuxiliaryThrust()
+ { return this->auxiliaryThrust_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getRotationThrust()
+ { return this->rotationThrust_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getMass()
+ { return this->mass_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getLinearDamping()
+ { return this->linearDamping_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getAngularDamping()
+ { return this->angularDamping_; }
+
+
+
+ private:
+ //AutonomousDroneController *myController_; //!< The controller of the AutonomousDrone.
+
+ btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the AutonomousDrone the next tick.
+ btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the AutonomousDrone the next tick.
+ float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward.
+ float auxiliaryThrust_; //!< The amount of auxiliary thrust. Used for all other movements (except for rotations).
+ float rotationThrust_; //!< The amount of rotation thrust. Used for rotations only.s
+ float mass_;
+ float linearDamping_;
+ float angularDamping_;
+ };
+
+}
+
+#endif // _AutonomousDrone_H__
More information about the Orxonox-commit
mailing list