modm API documentation
|
Location in a 2D coordinate system. More...
#include <modm/math/geometry/location_2d.hpp>
Public Member Functions | |
Location2D (const Vector< T, 2 > &position, const float &orientation) | |
Location2D (const T &x, const T &y, const float &orientation) | |
const Vector< T, 2 > & | getPosition () const |
const T & | getX () const |
const T & | getY () const |
void | setPosition (const Vector< T, 2 > &point) |
void | setPosition (const T &x, const T &y) |
float | getOrientation () const |
void | setOrientation (const float &phi) |
void | move (const Location2D &diff) |
Add a position increment. | |
void | move (const Vector< T, 2 > &diff) |
void | move (T x, float phi) |
Add a increment only in x-direction. More... | |
Vector< T, 2 > | translated (const Vector< T, 2 > &vector) const |
TODO. | |
template<typename U > | |
Location2D< U > | convert () const |
Convert between Location-objects with different base-types. | |
bool | operator== (const Location2D &other) const |
bool | operator!= (const Location2D &other) const |
Friends | |
template<typename U > | |
IOStream & | operator<< (IOStream &, const Location2D< U > &) |
Location in a 2D coordinate system.
This class is primarily used to describe the location of a robot on the field. The robot has a position (x- and y-coordinate) and a orientation (absolute angle in the range (-pi, pi)).
void modm::Location2D< T >::move | ( | T | x, |
float | phi | ||
) |
Add a increment only in x-direction.
Our robots mostly use a differential drive with two driven wheels side by side, allowing the robot to move only in the drive direction (x-direction in the local coordinate system of the robot) and rotate. A movement perpendicular to the drive direction is impossible without an external force.
To estimate the position of the robot over time, we use odometry. Therefore it is necessary to add a lot small increments of movement over time. Because the y-component will always be zero, we created this method, which avoids unnecessary computations for the y-component and is therefore faster the the universal move-method.
x | movement in x-direction |
phi | rotation |