Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2018, 4:42:43 PM (6 years ago)
Author:
adamc
Message:

first final draft

File:
1 moved

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.cc

    r11961 r12006  
    2727 */
    2828
    29 #include "AAAAutonomousDrone.h"
     29#include "ScriptableControllerDrone.h"
    3030
    3131#include "core/CoreIncludes.h"
     
    4444    */
    4545
    46     RegisterClass(AAAAutonomousDrone);
     46    RegisterClass(ScriptableControllerDrone);
    4747   
    48     AAAAutonomousDrone::AAAAutonomousDrone(Context* context) : Pawn(context)
     48    ScriptableControllerDrone::ScriptableControllerDrone(Context* context) : Pawn(context)
    4949    {
    5050        //TODO: Put your code in here:
    5151        // Register the drone class to the core.
    5252
    53         RegisterObject(AAAAutonomousDrone);
     53        RegisterObject(ScriptableControllerDrone);
    5454     
    5555        //this->myController_ = NULL;
     
    7070        //this->setCollisionType(CollisionType::Dynamic);
    7171
    72         //this->myController_ = new AAAAutonomousDroneController(this); // Creates a new controller and passes our this pointer to it as creator.
     72        //this->myController_ = new ScriptableControllerDroneController(this); // Creates a new controller and passes our this pointer to it as creator.
    7373    }
    7474
     
    7777        Destructor. Destroys controller, if present.
    7878    */
    79     AAAAutonomousDrone::~AAAAutonomousDrone()
     79    ScriptableControllerDrone::~ScriptableControllerDrone()
    8080    {
    8181        // Deletes the controller if the object was initialized and the pointer to the controller is not NULL.
     
    8686    /**
    8787    @brief
    88         Method for creating a AAAAutonomousDrone through XML.
    89     */
    90     void AAAAutonomousDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     88        Method for creating a ScriptableControllerDrone through XML.
     89    */
     90    void ScriptableControllerDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    9191    {
    9292        // This calls the XMLPort function of the parent class
    93         SUPER(AAAAutonomousDrone, XMLPort, xmlelement, mode);
    94 
    95         XMLPortParam(AAAAutonomousDrone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
     93        SUPER(ScriptableControllerDrone, XMLPort, xmlelement, mode);
     94
     95        XMLPortParam(ScriptableControllerDrone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
    9696        //TODO: Put your code in here:
    9797        // Make sure you add the variables auxiliaryThrust_ and rotationThrust_ to XMLPort.
    9898        // Variables can be added by the following command
    9999        // XMLPortParam(Classname, "xml-attribute-name (i.e. variablename)", setFunctionName, getFunctionName, xmlelement, mode);
    100         // 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.
    101         XMLPortParam(AAAAutonomousDrone, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);
    102     XMLPortParam(AAAAutonomousDrone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
    103         XMLPortParam(AAAAutonomousDrone, "mass", setMass, getMass, xmlelement, mode);
    104         XMLPortParam(AAAAutonomousDrone, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode);
    105         XMLPortParam(AAAAutonomousDrone, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode);
     100        // Also make sure that you also create the get- and set-functions in ScriptableControllerDrone.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.
     101        XMLPortParam(ScriptableControllerDrone, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);
     102    XMLPortParam(ScriptableControllerDrone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
     103        XMLPortParam(ScriptableControllerDrone, "mass", setMass, getMass, xmlelement, mode);
     104        XMLPortParam(ScriptableControllerDrone, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode);
     105        XMLPortParam(ScriptableControllerDrone, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode);
    106106
    107107   
     
    113113    /**
    114114    @brief
    115         Defines which actions the AAAAutonomousDrone has to take in each tick.
     115        Defines which actions the ScriptableControllerDrone has to take in each tick.
    116116    @param dt
    117117        The length of the tick.
    118118    */
    119     void AAAAutonomousDrone::tick(float dt)
    120     {
    121         SUPER(AAAAutonomousDrone, tick, dt);
     119    void ScriptableControllerDrone::tick(float dt)
     120    {
     121        SUPER(ScriptableControllerDrone, tick, dt);
    122122
    123123
     
    141141    /**
    142142    @brief
    143         Moves the AAAAutonomousDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
     143        Moves the ScriptableControllerDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
    144144    @param value
    145145        The vector determining the amount of the movement.
    146146    */
    147     void AAAAutonomousDrone::moveFrontBack(const Vector2& value)
     147    void ScriptableControllerDrone::moveFrontBack(const Vector2& value)
    148148    {
    149149        this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
     
    152152    /**
    153153    @brief
    154         Moves the AAAAutonomousDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
     154        Moves the ScriptableControllerDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
    155155    @param value
    156156        The vector determining the amount of the movement.
    157157    */
    158     void AAAAutonomousDrone::moveRightLeft(const Vector2& value)
     158    void ScriptableControllerDrone::moveRightLeft(const Vector2& value)
    159159    {
    160160        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
     
    163163    /**
    164164    @brief
    165         Moves the AAAAutonomousDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
     165        Moves the ScriptableControllerDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
    166166    @param value
    167167        The vector determining the amount of the movement.
    168168    */
    169     void AAAAutonomousDrone::moveUpDown(const Vector2& value)
     169    void ScriptableControllerDrone::moveUpDown(const Vector2& value)
    170170    {
    171171        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
     
    174174    /**
    175175    @brief
    176         Rotates the AAAAutonomousDrone around the y-axis by the amount specified by the first component of the input 2-dim vector.
     176        Rotates the ScriptableControllerDrone around the y-axis by the amount specified by the first component of the input 2-dim vector.
    177177    @param value
    178178        The vector determining the amount of the angular movement.
    179179    */
    180     void AAAAutonomousDrone::rotateYaw(const Vector2& value)
     180    void ScriptableControllerDrone::rotateYaw(const Vector2& value)
    181181    {
    182182        this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
     
    185185    /**
    186186    @brief
    187         Rotates the AAAAutonomousDrone around the x-axis by the amount specified by the first component of the input 2-dim vector.
     187        Rotates the ScriptableControllerDrone around the x-axis by the amount specified by the first component of the input 2-dim vector.
    188188    @param value
    189189        The vector determining the amount of the angular movement.
    190190    */
    191     void AAAAutonomousDrone::rotatePitch(const Vector2& value)
     191    void ScriptableControllerDrone::rotatePitch(const Vector2& value)
    192192    {
    193193        this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
     
    196196    /**
    197197    @brief
    198         Rotates the AAAAutonomousDrone around the z-axis by the amount specified by the first component of the input 2-dim vector.
     198        Rotates the ScriptableControllerDrone around the z-axis by the amount specified by the first component of the input 2-dim vector.
    199199    @param value
    200200        The vector determining the amount of the angular movement.
    201201    */
    202     void AAAAutonomousDrone::rotateRoll(const Vector2& value)
     202    void ScriptableControllerDrone::rotateRoll(const Vector2& value)
    203203    {
    204204        this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
Note: See TracChangeset for help on using the changeset viewer.