Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5766


Ignore:
Timestamp:
Sep 23, 2009, 4:57:45 PM (15 years ago)
Author:
scheusso
Message:

removed lines students will have to reinsert again

Location:
code/branches/tutorial
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutorial/data/levels/tutorial.oxw

    r5765 r5766  
    1313   skybox       = "Orxonox/skypanoramagen1"
    1414  >
    15 
    16 <Drone name="meineDrohne" position="0,0,-10" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
    17   <attached>
    18     <Model scale="10" mesh="drone.mesh"/>
    19   </attached>
    20   <collisionShapes>
    21     <BoxCollisionShape position="0,0,0"      halfExtents="10, 10, 10" />
    22   </collisionShapes>
    23 </Drone>
    24 
    2515
    2616    <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" />
  • code/branches/tutorial/src/orxonox/controllers

  • code/branches/tutorial/src/orxonox/controllers/DroneController.cc

    r5765 r5766  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Oli Scheuss
    2424 *   Co-authors:
    2525 *      ...
     
    3939        // - make sure to register the object in the factory
    4040        // - do any kind of initialisation
    41         RegisterObject(DroneController);
     41       
     42       
    4243       
    4344        // this checks that our creator really is a drone
     
    5556        // Place your code here:
    5657        // - steering commands
    57         static float totaltime = 0;
    58         totaltime += dt;
    5958        Drone *myDrone = static_cast<Drone*>(this->getControllableEntity());
    60         if(totaltime<100)
    61         {
    62             myDrone->moveFrontBack( -sqrt(dt) );
    63             myDrone->rotatePitch(-dt);
    64         }
     59        // you can use the following commands for steering
     60        // - moveFrontBack, moveRightLeft, moveUpDown
     61        // - rotatePitch, rotateYaw, rotateRoll
     62        // - apply the to myDrone (e.g. myDrone->rotateYaw(..) )
     63       
    6564    }
    6665}
  • code/branches/tutorial/src/orxonox/controllers/DroneController.h

    r5765 r5766  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Oli Scheuss
    2424 *   Co-authors:
    2525 *      ...
  • code/branches/tutorial/src/orxonox/worldentities

  • code/branches/tutorial/src/orxonox/worldentities/Drone.cc

    r5765 r5766  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Oli Scheuss
    2424 *   Co-authors:
    2525 *      ...
     
    3434namespace orxonox
    3535{
    36     // put your code in here:
     36    // PLACE YOUR CODE HERE
    3737    // create the factory for the drone
    3838    CreateFactory(Drone);
     
    4040    Drone::Drone(BaseObject* creator) : ControllableEntity(creator)
    4141    {
    42         //put your code in here:
     42        this->myController_ = 0;
     43        // PLACE YOUR CODE HERE
    4344        // - register the drone class to the core
    4445        // - create a new controller and pass our this pointer to it as creator
    45         this->myController_ = 0;
    46         RegisterObject(Drone);
    4746       
    4847        this->localLinearAcceleration_.setValue(0, 0, 0);
     
    7170        SUPER(Drone, XMLPort, xmlelement, mode);
    7271
    73         XMLPortParamVariable(Drone, "primaryThrust",  primaryThrust_,  xmlelement, mode);
    74         XMLPortParamVariable(Drone, "auxilaryThrust", auxilaryThrust_, xmlelement, mode);
    75         XMLPortParamVariable(Drone, "rotationThrust", rotationThrust_, xmlelement, mode);
     72        // PLACE YOUR CODE HERE
     73        // make sure you add the variables primaryThrust_, auxilaryThrust_ and rotationThrust_ to xmlport
     74        // variables can be added by the following command
     75        // XMLPortParamVariable(Class, "xml-attribute-name",  variable_name,  xmlelement, mode);
    7676    }
    7777
    7878    void Drone::tick(float dt)
    7979    {
    80         SUPER(Drone, tick, dt);
     80        // PLACE YOUR CODE HERE
     81        // make sure the tick function of the base class gets called here
    8182       
    82         //if (this->hasLocalController())
    83         //{
    84             this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
    85             this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
    86             if (this->localLinearAcceleration_.z() > 0)
    87               this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
    88             else
    89               this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
    90             this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
    91             this->localLinearAcceleration_.setValue(0, 0, 0);
    92        
    93             this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
    94             this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
    95             this->localAngularAcceleration_.setValue(0, 0, 0);
    96         //}
     83        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
     84        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
     85        if (this->localLinearAcceleration_.z() > 0)
     86          this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
     87        else
     88          this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
     89        this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
     90        this->localLinearAcceleration_.setValue(0, 0, 0);
     91   
     92        this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
     93        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
     94        this->localAngularAcceleration_.setValue(0, 0, 0);
    9795    }
    9896   
  • code/branches/tutorial/src/orxonox/worldentities/Drone.h

    r5765 r5766  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Oli Scheuss
    2424 *   Co-authors:
    2525 *      ...
Note: See TracChangeset for help on using the changeset viewer.