[Orxonox-commit 7160] r11777 - in code/branches/Presentation_HS17_merge: data/levels src/orxonox/controllers src/orxonox/worldentities

landauf at orxonox.net landauf at orxonox.net
Mon Feb 19 22:32:12 CET 2018


Author: landauf
Date: 2018-02-19 22:32:12 +0100 (Mon, 19 Feb 2018)
New Revision: 11777

Modified:
   code/branches/Presentation_HS17_merge/data/levels/ArrowLevel.oxw
   code/branches/Presentation_HS17_merge/src/orxonox/controllers/ArrowController.cc
   code/branches/Presentation_HS17_merge/src/orxonox/controllers/ArrowController.h
   code/branches/Presentation_HS17_merge/src/orxonox/worldentities/Arrow.cc
   code/branches/Presentation_HS17_merge/src/orxonox/worldentities/Arrow.h
Log:
[Waypoints_HS17] removed lots of copy-paste- and otherwise unnecessary code

Modified: code/branches/Presentation_HS17_merge/data/levels/ArrowLevel.oxw
===================================================================
--- code/branches/Presentation_HS17_merge/data/levels/ArrowLevel.oxw	2018-02-18 23:34:42 UTC (rev 11776)
+++ code/branches/Presentation_HS17_merge/data/levels/ArrowLevel.oxw	2018-02-19 21:32:12 UTC (rev 11777)
@@ -59,16 +59,18 @@
       <attached>
        <Model scale="10" mesh="arrow.mesh"/>
       </attached>
+      <controller>
+        <ArrowController accuracy = 2000>
+          <gpspoints>
+            <Model mesh="cube.mesh" scale=8 position="100,100,100"/>
+            <Model mesh="cube.mesh" scale=8 position="400,200,187"/>
+            <Model mesh="cube.mesh" scale=8 position="-200,-500,615"/>
+            <Model mesh="cube.mesh" scale=8 position="0,0,0"/>      
+          </gpspoints>
+        </ArrowController>
+      </controller>
     </Arrow>
 
-<ArrowController accuracy = 2000>
-      <gpspoints>
-        <Model mesh="cube.mesh" scale=8 position="100,100,100"/>
-        <Model mesh="cube.mesh" scale=8 position="400,200,187"/>
-        <Model mesh="cube.mesh" scale=8 position="-200,-500,615"/>
-        <Model mesh="cube.mesh" scale=8 position="0,0,0"/>      
-      </gpspoints>
-        </ArrowController>
 
 
 

Modified: code/branches/Presentation_HS17_merge/src/orxonox/controllers/ArrowController.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/controllers/ArrowController.cc	2018-02-18 23:34:42 UTC (rev 11776)
+++ code/branches/Presentation_HS17_merge/src/orxonox/controllers/ArrowController.cc	2018-02-19 21:32:12 UTC (rev 11777)
@@ -20,17 +20,17 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Oli Scheuss
+ *      jostoffe
  *   Co-authors:
- *      Damian 'Mozork' Frick
+ *      ...
  *
  */
 
 #include "ArrowController.h"
 #include "HumanController.h"
-#include "worldentities/WorldEntity.h"
-    
-#include "worldentities/Arrow.h"
+#include "worldentities/ControllableEntity.h"
+
+#include "core/CoreIncludes.h"
 #include "util/Math.h"
 
 namespace orxonox
@@ -38,12 +38,6 @@
 
     RegisterClass(ArrowController);
 
-
-
-    /**
-    @brief
-        Constructor.
-    */
     ArrowController::ArrowController(Context* context) : Controller(context)
     {
 
@@ -51,18 +45,18 @@
 
         this->currentGPSPoint_ = 0;
         this->accuracy_ = 1000.0f;
+    }
 
-        arrow = nullptr;
+    ArrowController::~ArrowController()
+    {
+      for (WorldEntity* gpspoint : this->gpspoints_)
+        {
+            if(gpspoint)
+                gpspoint->destroy();
+        }
 
-        for(Arrow* a: ObjectList<Arrow>())
-            arrow = a;
+    }
 
-        assert(arrow != nullptr);
-        this->setControllableEntity(arrow);
-
-        orxout() << "constructor aufgerufen" << endl;
-    }
-    
     //Set the distance you need to reach before the next waypoint will be selected
     void ArrowController::setAccuracy(float accuracy){
       this->accuracy_ = accuracy;
@@ -84,22 +78,7 @@
         else
             return nullptr;
     }
-    /**
-    @brief
-        Destructor.
-    */
 
-    ArrowController::~ArrowController()
-    {
-      for (WorldEntity* gpspoint : this->gpspoints_)
-        {
-            if(gpspoint)
-                gpspoint->destroy();
-        } 
-
-    }
-
-
     void ArrowController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     {
         SUPER(ArrowController, XMLPort, xmlelement, mode);

Modified: code/branches/Presentation_HS17_merge/src/orxonox/controllers/ArrowController.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/controllers/ArrowController.h	2018-02-18 23:34:42 UTC (rev 11776)
+++ code/branches/Presentation_HS17_merge/src/orxonox/controllers/ArrowController.h	2018-02-19 21:32:12 UTC (rev 11777)
@@ -20,9 +20,9 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Oli Scheuss
+ *      jostoffe
  *   Co-authors:
- *      Damian 'Mozork' Frick
+ *      ...
  *
  */
 
@@ -37,12 +37,6 @@
 
 namespace orxonox
 {
-    /**
-    @brief
-        Controller for the Arrow of the PPS tutorial.
-    @author
-        Oli Scheuss
-    */
     class _OrxonoxExport ArrowController : public Controller, public Tickable
     {
         public:
@@ -58,15 +52,10 @@
 
             virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick.
 
-        protected:
-
+        private:
             std::vector<WeakPtr<WorldEntity>> gpspoints_;
             size_t currentGPSPoint_;
             float accuracy_;
-            WorldEntity* defaultGPSpoint_;
-
-        private:
-            Arrow *arrow;
     };
 }
 

Modified: code/branches/Presentation_HS17_merge/src/orxonox/worldentities/Arrow.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/worldentities/Arrow.cc	2018-02-18 23:34:42 UTC (rev 11776)
+++ code/branches/Presentation_HS17_merge/src/orxonox/worldentities/Arrow.cc	2018-02-19 21:32:12 UTC (rev 11777)
@@ -20,9 +20,9 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Oli Scheuss
+ *      jostoffe
  *   Co-authors:
- *      Damian 'Mozork' Frick
+ *      ...
  *
  */
 
@@ -29,146 +29,14 @@
 #include "Arrow.h"
 
 #include "core/CoreIncludes.h"
-#include "BulletDynamics/Dynamics/btRigidBody.h"
 
 namespace orxonox
 {
 
     RegisterClass(Arrow);
-    /**
-    @brief
-        Constructor. Registers the object and initializes some default values.
-    @param creator
-        The creator of this object.
-    */
+
     Arrow::Arrow(Context* context) : ControllableEntity(context)
     {
         RegisterObject(Arrow);
-
-        this->localLinearAcceleration_.setValue(0, 0, 0);
-        this->localAngularAcceleration_.setValue(0, 0, 0);
-        this->primaryThrust_  = 100;
-        this->auxiliaryThrust_ = 100;
-        this->rotationThrust_ = 10;
-
-        this->setCollisionType(CollisionType::Dynamic);
-
-        
     }
-
-    /**
-    @brief
-        Destructor. Destroys controller, if present.
-    */
-    Arrow::~Arrow()
-    {
-
-    }
-
-    /**
-    @brief
-        Method for creating a Arrow through XML.
-    */
-    void Arrow::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-    {
-        // This calls the XMLPort function of the parent class
-        SUPER(Arrow, XMLPort, xmlelement, mode);
-
-        XMLPortParam(Arrow, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
-        XMLPortParam(Arrow, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);
-        XMLPortParam(Arrow, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
-     
-    }
-
-    /**
-    @brief
-        Defines which actions the Arrow has to take in each tick.
-    @param dt
-        The length of the tick.
-    */
-    void Arrow::tick(float dt)
-    {
-        SUPER(Arrow, 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 Arrow 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 Arrow::moveFrontBack(const Vector2& value)
-    {
-        this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
-    }
-
-    /**
-    @brief
-        Moves the Arrow 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 Arrow::moveRightLeft(const Vector2& value)
-    {
-        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
-    }
-
-    /**
-    @brief
-        Moves the Arrow 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 Arrow::moveUpDown(const Vector2& value)
-    {
-        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
-    }
-
-    /**
-    @brief
-        Rotates the Arrow 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 Arrow::rotateYaw(const Vector2& value)
-    {
-        this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
-    }
-
-    /**
-    @brief
-        Rotates the Arrow 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 Arrow::rotatePitch(const Vector2& value)
-    {
-        this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
-    }
-
-    /**
-    @brief
-        Rotates the Arrow 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 Arrow::rotateRoll(const Vector2& value)
-    {
-        this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
-    }
-
-
 }

Modified: code/branches/Presentation_HS17_merge/src/orxonox/worldentities/Arrow.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/worldentities/Arrow.h	2018-02-18 23:34:42 UTC (rev 11776)
+++ code/branches/Presentation_HS17_merge/src/orxonox/worldentities/Arrow.h	2018-02-19 21:32:12 UTC (rev 11777)
@@ -20,9 +20,9 @@
  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  *
  *   Author:
- *      Oli Scheuss
+ *      jostoffe
  *   Co-authors:
- *      Damian 'Mozork' Frick
+ *      ...
  *
  */
 
@@ -32,114 +32,16 @@
 #include "OrxonoxPrereqs.h"
 
 #include "core/XMLPort.h"
-//#include "controllers/ArrowController.h"
 
 #include "ControllableEntity.h"
-#include "WorldEntity.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 Arrow : public ControllableEntity
     {
         public:
             Arrow(Context* context);
-            virtual ~Arrow();
-
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an Arrow through XML.
-            virtual void tick(float dt); //!< Defines which actions the Arrow 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.
-
-            inline void setAuxiliaryThrust ( float thrust )
-                { this -> auxiliaryThrust_ = thrust; }
-
-            inline void setRotationThrust (float thrust)
-                { this -> rotationThrust_ = thrust;}
-            // Hint: auxiliary thrust, rotation thrust.
-            
-            /**
-            @brief Gets the primary thrust to the input amount.
-            @return The amount of thrust.
-            */
-            inline float getPrimaryThrust()
-                { return this->primaryThrust_; }
-
-            inline float getAuxiliaryThrust()
-                { return this->auxiliaryThrust_;}
-
-            inline float getRotationThrust()
-                { return this->rotationThrust_;}
-
-            //TODO: Place your get-functions here.
-
-        private:
-            //ArrowController *myController_; //!< The controller of the Arrow.
-
-            btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the Arrow the next tick.
-            btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the Arrow 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
-        
+            virtual ~Arrow() = default;
     };
 
 }



More information about the Orxonox-commit mailing list