Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# Representations/Cognition/RobotPose.h

Go to the documentation of this file.

    00001 /**
    00002  * @file RobotPose.h
    00003  *
    00004  * The file contains the definition of the class RobotPose.
    00005  *
    00006  * @author <A href=mailto:roefer@tzi.de>Thomas Röfer</A>
    00007  */
    00008
    00009 #ifndef __RobotPose_h_
    00010 #define __RobotPose_h_
    00011
    00012 #include "Tools/Streams/InOut.h"
    00013 #include "Tools/Math/Pose2D.h"
    00014
    00015 /**
    00016  * @class RobotPose
    00017  * A Pose2D with validity.
    00018  */
    00019 class RobotPose : public Pose2D
    00020 {
    00021   public:
    00022     double validity; /**< The validity of the robot pose. */
    00023     double positionVariance; /**< The variance of the particle distribution from which the pose was generated. */
    00024     Pose2D greatestUncertainty; /**< direction of greatest uncertainty from the (x,y) average of all particles */
    00025     bool directionOfGreatestUncertaintyExists; /**< if particle distribution is symmetrical, this is false, otherwise its set to true*/
    00026
    00027   public:
    00028     /**
    00029      * Constructor.
    00030      */
    00031     RobotPose() {validity = 0; frameNumber = 0; directionOfGreatestUncertaintyExists = false;}
    00032
    00033     const RobotPose& operator=(const RobotPose& other)
    00034     {
    00035       (Pose2D&) *this = (const Pose2D&) other;
    00036       validity = other.validity;
    00037       positionVariance = other.positionVariance;
    00038       greatestUncertainty = other.greatestUncertainty;
    00039       directionOfGreatestUncertaintyExists = other.directionOfGreatestUncertaintyExists;
    00040       frameNumber = other.frameNumber;
    00041       timestamp = other.timestamp;
    00042       return *this;
    00043     }
    00044
    00045     /**
    00046      * Cast Contructor.
    00047      */
    00048     RobotPose (const Pose2D& otherPose) {
    00049       (Pose2D&) *this = otherPose;
    00050       validity=0;
    00051       positionVariance=0;
    00052       directionOfGreatestUncertaintyExists = false;
    00053       greatestUncertainty = Pose2D();
    00054     }
    00055
    00056     const RobotPose& operator=(const Pose2D& other)
    00057     {
    00058       (Pose2D&) *this = other;
    00059       //don't touch validity and frameNumber here!
    00060       return *this;
    00061     }
    00062
    00063     /**
    00064      * The function sets the current pose.
    00065      * @param p The pose.
    00066      */
    00067     void setPose(const Pose2D& p) {
    00068       (Pose2D&) *this = p;
    00069     }
    00070
    00071     /**
    00072      * The function sets the validity of the current pose.
    00073      * @param v The validity.
    00074      */
    00075     void setValidity(const double v) {validity = v;}
    00076
    00077     /**
    00078      * The function sets the validity of the current pose.
    00079      * @param v The validity.
    00080      */
    00081     void setPositionVariance(const double v) {positionVariance = v;}
    00082
    00083   /**
    00084      * The function sets the frame number of the current pose.
    00085      */
    00086     void setFrameNumber(unsigned long frameNumber) {this->frameNumber = frameNumber;}
    00087
    00088   /**
    00089      * The function sets the timestamp of the current pose.
    00090      */
    00091     void setTimestamp(unsigned long timestamp) {this->timestamp = timestamp;}
    00092
    00093
    00094   /**
    00095      * The function returns the current pose.
    00096      * @return The pose.
    00097      * @attention this function is obsolete and should not be used any more
    00098      * @attention instead this object IS a pose instead of owning one
    00099      */
    00100     const Pose2D getPose() const {
    00101       return (const Pose2D&) *this;
    00102     }
    00103
    00104     /**
    00105      * The function returns the validity of the current pose.
    00106      * @return The validity.
    00107      */
    00108     const double& getValidity() const {return validity;}
    00109
    00110     /**
    00111      * The function returns the variance of the current particle distribuiton of the robot pose.
    00112      * @return The variance.
    00113      */
    00114     const double& getPositionVariance() const {return positionVariance;}
    00115
    00116     /**
    00117      * The function returns the standard deviation of the current particle distribuiton of the robot pose.
    00118      * @return The standard-deviation.
    00119      */
    00120     double getPositionStandardDeviation() const;
    00121
    00122     /**
    00123      * The function returns the position, where the robot will be
    00124      * if it walks with the specified translation and rotation for the specified time.
    00125      * @param movementPerSec The movement with x- and y-translation in mm/s and rotation in rad/s
    00126      * @param time The time in sec how long the robot moves
    00127      * @param result The target pose.
    00128      */
    00129     void calculateMovement(const Pose2D & movementPerSec, double time, RobotPose & result) const;
    00130
    00131
    00132   /**< The frame number when perceived. */
    00133   unsigned long frameNumber;
    00134
    00135   /**< The time when the position is calculated. */
    00136   unsigned long timestamp;
    00137
    00138   /**< Speed measured by perceived distance to goal. */
    00139   double speedbyDistanceToGoal;
    00140
    00141 /**< The distance to the field border */
    00142   double distanceToBorder;
    00143
    00144   /**< The angle to the field border */
    00145   double angleToBorder;
    00146
    00147   friend In& operator>>(In& stream,RobotPose& robotPose);
    00148   friend Out& operator<<(Out& stream, const RobotPose& robotPose);
    00149 };
    00150
    00151 /**
    00152  * Streaming operator that reads a robot pose from a stream.
    00153  * @param stream The stream from which is read.
    00154  * @param robotPose The robot pose object.
    00155  * @return The stream.
    00156  */
    00157 In& operator>>(In& stream,RobotPose& robotPose);
    00158
    00159 /**
    00160  * Streaming operator that writes a robot pose to a stream.
    00161  * @param stream The stream to write on.
    00162  * @param robotPose The robot pose object.
    00163  * @return The stream.
    00164  */
    00165 Out& operator<<(Out& stream, const RobotPose& robotPose);
    00166
    00167
    00168 #endif //__RobotPose_h_