Aria  2.8.0
ArPose Class Reference

Represents an x, y position with an orientation. More...

#include <ariaUtil.h>

Inherited by ArPoseWithTime.

Public Member Functions

 ArPose (double x=0, double y=0, double th=0)
 Constructor, with optional initial values. More...
 
 ArPose (const ArPose &pose)
 Copy Constructor.
 
virtual double findAngleTo (ArPose position) const
 Finds the angle between this position and the given position. More...
 
virtual double findDistanceTo (ArPose position) const
 Finds the distance from this position to the given position. More...
 
void getPose (double *x, double *y, double *th=NULL) const
 Gets the whole position in one function call. More...
 
double getTh (void) const
 Gets the heading.
 
double getThRad (void) const
 Gets the heading, in radians.
 
double getX (void) const
 Gets the x position.
 
double getY (void) const
 Gets the y position.
 
virtual void log (void) const
 Logs the coordinates using ArLog.
 
virtual bool operator!= (const ArPose &other) const
 
virtual ArPose operator+ (const ArPose &other) const
 Add the other pose's X, Y and theta to this pose's X, Y, and theta (sum in theta will be normalized to (-180,180)), and return the result.
 
ArPoseoperator+= (const ArPose &other)
 Adds the given pose to this one. More...
 
virtual ArPose operator- (const ArPose &other) const
 Substract the other pose's X, Y, and theta from this pose's X, Y, and theta (difference in theta will be normalized to (-180,180)), and return the result.
 
ArPoseoperator-= (const ArPose &other)
 Subtracts the given pose from this one. More...
 
virtual bool operator< (const ArPose &other) const
 Less than operator (for sets)
 
virtual bool operator== (const ArPose &other) const
 Equality operator (for sets)
 
virtual void setPose (double x, double y, double th=0)
 Sets the position to the given values. More...
 
virtual void setPose (ArPose position)
 Sets the position equal to the given position. More...
 
void setTh (double th)
 Sets the heading.
 
void setThRad (double th)
 Sets the heading, using radians.
 
void setX (double x)
 Sets the x position.
 
void setY (double y)
 Sets the y position.
 
virtual double squaredFindDistanceTo (ArPose position) const
 Finds the square distance from this position to the given position. More...
 
virtual ~ArPose ()
 Destructor.
 

Static Public Member Functions

static double distanceBetween (ArPose pose1, ArPose pose2)
 Finds the distance between two poses (static function, uses no data from any instance and shouldn't be able to be called on an instance) More...
 

Protected Attributes

double myTh
 
double myX
 
double myY
 

Detailed Description

Represents an x, y position with an orientation.

This class represents a robot position with heading. The heading is automatically adjusted to be in the range -180 to 180. It also defaults to 0, and so does not need to be used. (This avoids having 2 types of positions.) Everything in the class is inline so it should be fast.

Examples:
gotoActionExample.cpp.

Constructor & Destructor Documentation

◆ ArPose()

ArPose::ArPose ( double  x = 0,
double  y = 0,
double  th = 0 
)
inline

Constructor, with optional initial values.

Sets the pose to the given values. The constructor can be called with no parameters, with just x and y, or with x, y, and th. The given heading (th) is automatically adjusted to be in the range -180 to 180.

Parameters
xthe double to set the x position to, default of 0
ythe double to set the y position to, default of 0
ththe double value for the pose's heading (or th), default of 0

Member Function Documentation

◆ distanceBetween()

static double ArPose::distanceBetween ( ArPose  pose1,
ArPose  pose2 
)
inlinestatic

Finds the distance between two poses (static function, uses no data from any instance and shouldn't be able to be called on an instance)

Parameters
pose1the first coords
pose2the second coords
Returns
the distance between the poses

◆ findAngleTo()

virtual double ArPose::findAngleTo ( ArPose  position) const
inlinevirtual

Finds the angle between this position and the given position.

Parameters
positionthe position to find the angle to
Returns
the angle to the given position from this instance, in degrees

◆ findDistanceTo()

virtual double ArPose::findDistanceTo ( ArPose  position) const
inlinevirtual

Finds the distance from this position to the given position.

Parameters
positionthe position to find the distance to
Returns
the distance to the position from this instance

◆ getPose()

void ArPose::getPose ( double *  x,
double *  y,
double *  th = NULL 
) const
inline

Gets the whole position in one function call.

Gets the whole position at once, by giving it 2 or 3 pointers to doubles. If you give the function a null pointer for a value it won't try to use the null pointer, so you can pass in a NULL if you don't care about that value. Also note that th defaults to NULL so you can use this with just x and y.

Parameters
xa pointer to a double to set the x position to
ya pointer to a double to set the y position to
tha pointer to a double to set the heading to, defaults to NULL

◆ operator+=()

ArPose& ArPose::operator+= ( const ArPose other)
inline

Adds the given pose to this one.

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

◆ operator-=()

ArPose& ArPose::operator-= ( const ArPose other)
inline

Subtracts the given pose from this one.

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

◆ setPose() [1/2]

virtual void ArPose::setPose ( double  x,
double  y,
double  th = 0 
)
inlinevirtual

Sets the position to the given values.

Sets the position with the given three values, but the theta does not need to be given as it defaults to 0.

Parameters
xthe position to set the x position to
ythe position to set the y position to
ththe position to set the th position to, default of 0

◆ setPose() [2/2]

virtual void ArPose::setPose ( ArPose  position)
inlinevirtual

Sets the position equal to the given position.

Parameters
positionthe position value this instance should be set to

◆ squaredFindDistanceTo()

virtual double ArPose::squaredFindDistanceTo ( ArPose  position) const
inlinevirtual

Finds the square distance from this position to the given position.

This is only here for speed, if you aren't doing this thousands of times a second don't use this one use findDistanceTo

Parameters
positionthe position to find the distance to
Returns
the distance to the position from this instance

The documentation for this class was generated from the following file: