VEX V5 C++ API
Classes | Public Member Functions | Protected Types | Protected Member Functions | List of all members
vex::inertial Class Reference

Use the inertial class to control the inertial sensor. More...

Inherits vex::device, and vex::guido.

Classes

class  accel
 class to hold inertial sensor acceleration data More...
 
class  attitude
 class to hold inertial angle data More...
 
class  gyro
 recover inertial sensor temperature in deg C More...
 
class  matrix
 class to hold an inertial matrix More...
 
class  quaternion
 class to hold inertial quaternion data More...
 

Public Member Functions

 inertial (int32_t index)
 Creates a new inertial object on the port specified. More...
 
 ~inertial ()
 
bool installed ()
 
int32_t value ()
 
void startCalibration (int32_t value=0)
 Starts recalibration of the inertial sensor. More...
 
bool isCalibrating (void)
 Returns true while the inertial sensor is performing a requested recalibration, changing to false once recalibration has completed. More...
 
void resetHeading ()
 reset the heading of the sensor to 0 More...
 
void resetRotation ()
 reset the rotation angle of the sensor to 0 More...
 
void setHeading (double value, rotationUnits units)
 set the inertial sensor heading to a new value More...
 
void setRotation (double value, rotationUnits units)
 set the inertial sensor rotation to angle More...
 
double angle (rotationUnits units=rotationUnits::deg)
 Gets the angle (yaw angle) of the inertial sensor. More...
 
double roll (rotationUnits units=rotationUnits::deg)
 Gets the roll angle of the inertial sensor. More...
 
double pitch (rotationUnits units=rotationUnits::deg)
 Gets the pitch angle of the inertial sensor. More...
 
double yaw (rotationUnits units=rotationUnits::deg)
 Gets the yaw angle of the inertial sensor. More...
 
double orientation (orientationType axis, rotationUnits units)
 Gets an orientation angle of the inertial sensor. More...
 
double heading (rotationUnits units=rotationUnits::deg)
 Gets the heading (yaw angle as 0-360 deg) of the inertial sensor. More...
 
double rotation (rotationUnits units=rotationUnits::deg)
 Gets the absolute angle (yaw angle without limits) of the inertial sensor. More...
 
void orientation (quaternion &q)
 Gets the inertial sensor orientation in quaternion form. More...
 
quaternion orientation ()
 Gets the inertial sensor orientation in quaternion form. More...
 
void orientation (attitude &a)
 Gets the inertial sensor orientation in rotation form. More...
 
double gyroRate (axisType axis, velocityUnits units)
 Gets the inertial sensor raw gyro data in specified units. More...
 
double acceleration (axisType axis)
 Gets the inertial sensor raw acceleration data in G. More...
 
- Public Member Functions inherited from vex::device
 device ()
 
 device (int32_t index)
 
 ~device ()
 
V5_DeviceType type ()
 
void init (int32_t index)
 
- Public Member Functions inherited from vex::guido
virtual ~guido ()
 

Protected Types

enum  orientationMode {
  orientationMode::ZUp, orientationMode::ZDown, orientationMode::XUp, orientationMode::XDown,
  orientationMode::YUp, orientationMode::YDown, orientationMode::Auto
}
 

Protected Member Functions

int32_t status ()
 recover inertial sensor raw status More...
 
inertial::gyro gyroRate ()
 Gets the inertial sensor raw gyro data in dps. More...
 
inertial::accel acceleration ()
 Gets the inertial sensor raw acceleration data in G. More...
 
void setOrientation (inertial::orientationMode orientation)
 Set the physical orientation of the inertial sensor, this will cause recalibration. More...
 
void setAccelerometerRange (uint8_t value)
 
void setCollisionThreshold (double value)
 

Additional Inherited Members

- Protected Attributes inherited from vex::device
int32_t _index
 

Detailed Description

Use the inertial class to control the inertial sensor.

Member Enumeration Documentation

◆ orientationMode

enum vex::inertial::orientationMode
strongprotected
Enumerator
ZUp 
ZDown 
XUp 
XDown 
YUp 
YDown 
Auto 

Constructor & Destructor Documentation

◆ inertial()

vex::inertial::inertial ( int32_t  index)

Creates a new inertial object on the port specified.

Parameters
indexThe port index for this inertial. The index is zero-based.

◆ ~inertial()

vex::inertial::~inertial ( )

Member Function Documentation

◆ installed()

bool vex::inertial::installed ( )
virtual

Reimplemented from vex::device.

◆ value()

int32_t vex::inertial::value ( )
virtual

Reimplemented from vex::device.

◆ startCalibration()

void vex::inertial::startCalibration ( int32_t  value = 0)

Starts recalibration of the inertial sensor.

◆ isCalibrating()

bool vex::inertial::isCalibrating ( void  )
virtual

Returns true while the inertial sensor is performing a requested recalibration, changing to false once recalibration has completed.

Returns
Returns true if inertial sensor is still calibrating.

Implements vex::guido.

◆ resetHeading()

void vex::inertial::resetHeading ( )

reset the heading of the sensor to 0

◆ resetRotation()

void vex::inertial::resetRotation ( )

reset the rotation angle of the sensor to 0

◆ setHeading()

void vex::inertial::setHeading ( double  value,
rotationUnits  units 
)
virtual

set the inertial sensor heading to a new value

Parameters
valueThe new heading for the inertial sensor
unitsThe rotation unit for the angle

Implements vex::guido.

◆ setRotation()

void vex::inertial::setRotation ( double  value,
rotationUnits  units 
)
virtual

set the inertial sensor rotation to angle

Parameters
valueThe new absolute rotation angle for the inertial sensor
unitsThe rotation unit for the angle

Implements vex::guido.

◆ angle()

double vex::inertial::angle ( rotationUnits  units = rotationUnits::deg)

Gets the angle (yaw angle) of the inertial sensor.

Returns
Returns a double that represents the unit value specified by the parameter of the inertial sensor.
Parameters
unitsThe measurement unit for the inertial device.

◆ roll()

double vex::inertial::roll ( rotationUnits  units = rotationUnits::deg)

Gets the roll angle of the inertial sensor.

Returns
Returns a double that represents the unit value specified by the parameter of the inertial sensor.
Parameters
unitsThe measurement unit for the inertial sensor.

◆ pitch()

double vex::inertial::pitch ( rotationUnits  units = rotationUnits::deg)

Gets the pitch angle of the inertial sensor.

Returns
Returns a double that represents the unit value specified by the parameter of the inertial sensor.
Parameters
unitsThe measurement unit for the inertial device.

◆ yaw()

double vex::inertial::yaw ( rotationUnits  units = rotationUnits::deg)

Gets the yaw angle of the inertial sensor.

Returns
Returns a double that represents the unit value specified by the parameter of the inertial sensor.
Parameters
unitsThe measurement unit for the inertial sensor.

◆ orientation() [1/4]

double vex::inertial::orientation ( orientationType  axis,
rotationUnits  units 
)

Gets an orientation angle of the inertial sensor.

Returns
Returns a double that represents the unit value specified by the parameter of the inertial sensor.
Parameters
axisThe orientation axis to recover, roll, pitch or yaw.
unitsThe measurement unit for the inertial sensor.

◆ heading()

double vex::inertial::heading ( rotationUnits  units = rotationUnits::deg)
virtual

Gets the heading (yaw angle as 0-360 deg) of the inertial sensor.

Returns
Returns a double that represents the unit value specified by the parameter of the inertial sensor.
Parameters
unitsThe measurement unit for the inertial sensor.

Implements vex::guido.

◆ rotation()

double vex::inertial::rotation ( rotationUnits  units = rotationUnits::deg)
virtual

Gets the absolute angle (yaw angle without limits) of the inertial sensor.

Returns
Returns a double that represents the unit value specified by the parameter of the inertial sensor.
Parameters
unitsThe measurement unit for the inertial sensor.

Implements vex::guido.

◆ orientation() [2/4]

void vex::inertial::orientation ( quaternion q)

Gets the inertial sensor orientation in quaternion form.

Parameters
qreference to instance of a inertial::quaternion class

◆ orientation() [3/4]

quaternion vex::inertial::orientation ( )

Gets the inertial sensor orientation in quaternion form.

Returns
inertial::quaternion object

◆ orientation() [4/4]

void vex::inertial::orientation ( attitude a)

Gets the inertial sensor orientation in rotation form.

Parameters
areference to instance of a inertial::attitude class

◆ gyroRate() [1/2]

double vex::inertial::gyroRate ( axisType  axis,
velocityUnits  units 
)

Gets the inertial sensor raw gyro data in specified units.

Parameters
axisthe inertial sensor axis to use
unitsThe units return value
Returns
value of the specified inertial sensor axis

◆ acceleration() [1/2]

double vex::inertial::acceleration ( axisType  axis)

Gets the inertial sensor raw acceleration data in G.

Parameters
axisthe inertial sensor axis to use
Returns
value of the specified inertial sensor axis

◆ status()

int32_t vex::inertial::status ( )
protected

recover inertial sensor raw status

◆ gyroRate() [2/2]

inertial::gyro vex::inertial::gyroRate ( )
protected

Gets the inertial sensor raw gyro data in dps.

Returns
inertial::gyro object

◆ acceleration() [2/2]

inertial::accel vex::inertial::acceleration ( )
protected

Gets the inertial sensor raw acceleration data in G.

Returns
inertial::accel object

◆ setOrientation()

void vex::inertial::setOrientation ( inertial::orientationMode  orientation)
protected

Set the physical orientation of the inertial sensor, this will cause recalibration.

Parameters
orientationthe inertial sensor orientation

◆ setAccelerometerRange()

void vex::inertial::setAccelerometerRange ( uint8_t  value)
protected

◆ setCollisionThreshold()

void vex::inertial::setCollisionThreshold ( double  value)
protected