JMotor
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
JTwoDTransform Struct Reference

struct for storing a 2 dimensional transformation. Used for telling a drivetrain how to move. More...

#include <JTwoDTransform.h>

Public Member Functions

JTwoDTransform operator& (const JTwoDTransform &t)
 adds the second transform after the first, assuming movement, then rotation
 
JTwoDTransform operator+ (const JTwoDTransform &t)
 
JTwoDTransform operator- (const JTwoDTransform &t)
 
JTwoDTransform operator* (const JTwoDTransform &t)
 
JTwoDTransform operator/ (const JTwoDTransform &t)
 
JTwoDTransform operator* (const float v)
 
JTwoDTransform operator/ (const float v)
 
JTwoDTransform operator- ()
 
JTwoDTransform operator+= (const JTwoDTransform &t)
 
JTwoDTransform operator-= (const JTwoDTransform &t)
 
JTwoDTransform operator*= (const JTwoDTransform &t)
 
JTwoDTransform operator/= (const JTwoDTransform &t)
 
JTwoDTransform operator*= (const float v)
 
JTwoDTransform operator/= (const float v)
 
float getByNumber (int8_t index)
 access the three values based on a numerical index
 
void setByNumber (int8_t index, float value)
 sets one of the three values based on a numerical index
 
float sumAbs ()
 sum of absolute value of the three values
 
void print (bool labels=true, bool newline=false, Stream *serial=&Serial)
 use to print values of transform to serial port
 

Static Public Member Functions

static JTwoDTransform rotate (JTwoDTransform tIn, float theta)
 
static JTwoDTransform fromNice (float fb, float sideways, float turn)
 converts from a coordinate system that might be more intuitive for some people
 
static float getForwards (JTwoDTransform t)
 
static float getRight (JTwoDTransform t)
 
static float getTurnDegreesCW (JTwoDTransform t)
 

Public Attributes

float x
 backwards- | forward+
 
float y
 right- | left+
 
float theta
 clockwise- | counterclockwise+
 

Detailed Description

struct for storing a 2 dimensional transformation. Used for telling a drivetrain how to move.

Note
{forwards,left,CCW} Follows ROS conventions for coordinate system: forward is positive, rotation CCW is positive, left is positive

Member Function Documentation

◆ fromNice()

static JTwoDTransform JTwoDTransform::fromNice ( float  fb,
float  sideways,
float  turn 
)
inlinestatic

converts from a coordinate system that might be more intuitive for some people

Parameters
fbbackwards- | forward+
sidewaysleft- | right+
turnCCW- | CW+ in DEGREES
Return values
convertedJTwoDTransform

◆ getByNumber()

float JTwoDTransform::getByNumber ( int8_t  index)
inline

access the three values based on a numerical index

Parameters
index0 returns x, 1 returns y, 2 returns z, other numbers returns NAN
Return values
(float)

◆ getForwards()

static float JTwoDTransform::getForwards ( JTwoDTransform  t)
inlinestatic

◆ getRight()

static float JTwoDTransform::getRight ( JTwoDTransform  t)
inlinestatic

◆ getTurnDegreesCW()

static float JTwoDTransform::getTurnDegreesCW ( JTwoDTransform  t)
inlinestatic

◆ operator&()

JTwoDTransform JTwoDTransform::operator& ( const JTwoDTransform t)
inline

adds the second transform after the first, assuming movement, then rotation

Note
assumes radians
Return values
combinedtransform

◆ operator*() [1/2]

JTwoDTransform JTwoDTransform::operator* ( const float  v)
inline

◆ operator*() [2/2]

JTwoDTransform JTwoDTransform::operator* ( const JTwoDTransform t)
inline

◆ operator*=() [1/2]

JTwoDTransform JTwoDTransform::operator*= ( const float  v)
inline

◆ operator*=() [2/2]

JTwoDTransform JTwoDTransform::operator*= ( const JTwoDTransform t)
inline

◆ operator+()

JTwoDTransform JTwoDTransform::operator+ ( const JTwoDTransform t)
inline

◆ operator+=()

JTwoDTransform JTwoDTransform::operator+= ( const JTwoDTransform t)
inline

◆ operator-() [1/2]

JTwoDTransform JTwoDTransform::operator- ( )
inline

◆ operator-() [2/2]

JTwoDTransform JTwoDTransform::operator- ( const JTwoDTransform t)
inline

◆ operator-=()

JTwoDTransform JTwoDTransform::operator-= ( const JTwoDTransform t)
inline

◆ operator/() [1/2]

JTwoDTransform JTwoDTransform::operator/ ( const float  v)
inline

◆ operator/() [2/2]

JTwoDTransform JTwoDTransform::operator/ ( const JTwoDTransform t)
inline

◆ operator/=() [1/2]

JTwoDTransform JTwoDTransform::operator/= ( const float  v)
inline

◆ operator/=() [2/2]

JTwoDTransform JTwoDTransform::operator/= ( const JTwoDTransform t)
inline

◆ print()

void JTwoDTransform::print ( bool  labels = true,
bool  newline = false,
Stream *  serial = &Serial 
)
inline

use to print values of transform to serial port

Parameters
labels(bool, default=true) label what axis each value corresponds to
newline(bool, default=false) send a newline character at the end
serial(Stream*, default=Serial) what serial port to print to

◆ rotate()

static JTwoDTransform JTwoDTransform::rotate ( JTwoDTransform  tIn,
float  theta 
)
inlinestatic

◆ setByNumber()

void JTwoDTransform::setByNumber ( int8_t  index,
float  value 
)
inline

sets one of the three values based on a numerical index

Parameters
index0 sets x, 1 sets y, 2 sets z, other numbers have no effect

◆ sumAbs()

float JTwoDTransform::sumAbs ( )
inline

sum of absolute value of the three values

Member Data Documentation

◆ theta

float JTwoDTransform::theta

clockwise- | counterclockwise+

◆ x

float JTwoDTransform::x

backwards- | forward+

◆ y

float JTwoDTransform::y

right- | left+


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