VEX Inertial Sensor C++ API module
///
Files
- file imu.hpp
Namespaces
- namespace pros::v5
- namespace pros::v5::literals
Classes
- class pros::v5::Imu
Functions
- Imu(const std::uint8_t port)
- Creates an Imu object for the given port.
- Imu(const Device& device)
- static Imu get_imu()
- Gets a IMU sensor that is plugged in to the brain.
- std::int32_t reset(bool blocking = false) const virtual
- Calibrate IMU.
- std::int32_t set_data_rate(std::uint32_t rate) const virtual
- Set the Inertial Sensor's refresh interval in milliseconds.
- static std::vector<Imu> get_all_devices()
- Gets all IMU sensors.
- double get_rotation() const virtual
- Get the total number of degrees the Inertial Sensor has spun about the z-axis.
- double get_heading() const virtual
- Get the Inertial Sensor's heading relative to the initial direction of its x-axis.
-
pros::
quaternion_s_t get_quaternion() const virtual - Get a quaternion representing the Inertial Sensor's orientation.
-
pros::
euler_s_t get_euler() const virtual - Get the Euler angles representing the Inertial Sensor's orientation.
- double get_pitch() const virtual
- Get the Inertial Sensor's pitch angle bounded by (-180,180)
- double get_roll() const virtual
- Get the Inertial Sensor's roll angle bounded by (-180,180)
- double get_yaw() const virtual
- Get the Inertial Sensor's yaw angle bounded by (-180,180)
-
pros::
imu_gyro_s_t get_gyro_rate() const virtual - Get the Inertial Sensor's raw gyroscope values.
- std::int32_t tare_rotation() const virtual
- Resets the current reading of the Inertial Sensor's rotation to zero.
- std::int32_t tare_heading() const virtual
- Resets the current reading of the Inertial Sensor's heading to zero.
- std::int32_t tare_pitch() const virtual
- Resets the current reading of the Inertial Sensor's pitch to zero.
- std::int32_t tare_yaw() const virtual
- Resets the current reading of the Inertial Sensor's yaw to zero.
- std::int32_t tare_roll() const virtual
- Resets the current reading of the Inertial Sensor's roll to zero.
- std::int32_t tare() const virtual
- Resets all 5 values of the Inertial Sensor to 0.
- std::int32_t tare_euler() const virtual
- Reset all 3 euler values of the Inertial Sensor to 0.
- std::int32_t set_heading(const double target) const virtual
- Sets the current reading of the Inertial Sensor's heading to target value Target will default to 360 if above 360 and default to 0 if below 0.
- std::int32_t set_rotation(const double target) const virtual
- Sets the current reading of the Inertial Sensor's rotation to target value.
- std::int32_t set_yaw(const double target) const virtual
- Sets the current reading of the Inertial Sensor's yaw to target value Will default to +/- 180 if target exceeds +/- 180.
- std::int32_t set_pitch(const double target) const virtual
- Sets the current reading of the Inertial Sensor's pitch to target value.
- std::int32_t set_roll(const double target) const virtual
- Sets the current reading of the Inertial Sensor's roll to target value Will default to +/- 180 if target exceeds +/- 180.
-
std::int32_t set_euler(const pros::
euler_s_t target) const virtual - Sets the current reading of the Inertial Sensor's euler values to target euler values.
-
pros::
imu_accel_s_t get_accel() const virtual - Get the Inertial Sensor's raw accelerometer values.
-
pros::
ImuStatus get_status() const virtual - Get the Inertial Sensor's status.
- bool is_calibrating() const virtual
- Check whether the IMU is calibrating.
- imu_orientation_e_t get_physical_orientation() const virtual
- Returns the physical orientation of the IMU.
-
const pros::
Imu operator""_imu(const unsigned long long int i) - Constructs a Imu from a literal ending in _imu via calling the constructor.
Enums
- enum class ImuStatus { ready = 0, calibrating = 19, error = 0xFF }
Typedefs
- using IMU = Imu
Function documentation
Imu(const std::uint8_t port)
#include <pros/imu.hpp>
Creates an Imu object for the given port.
Parameters | |
---|---|
port | The V5 Inertial Sensor port number from 1-21 |
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21).
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Do something with the sensor data } }
Imu(const Device& device)
#include <pros/imu.hpp>
static Imu get_imu()
#include <pros/imu.hpp>
Gets a IMU sensor that is plugged in to the brain.
Returns | A IMU object corresponding to a port that a IMU sensor is connected to the brain If no IMU sensor is plugged in, it returns a IMU sensor on port PROS_ERR_BYTE |
---|
This functions uses the following values of errno when an error state is reached: ENODEV - No IMU sensor is plugged into the brain
std::int32_t reset(bool blocking = false) const virtual
#include <pros/imu.hpp>
Calibrate IMU.
Parameters | |
---|---|
blocking | Whether this function blocks during calibration. |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
Calibration takes approximately 2 seconds and blocks during this period if the blocking param is true, with a timeout for this operation being set a 3 seconds as a safety margin. This function also blocks until the IMU status flag is set properly to E_IMU_STATUS_CALIBRATING, with a minimum blocking time of 5ms and a timeout of 1 second if it's never set.
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is already calibrating, or time out setting the status flag.
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); imu.calibrate(); // Block until calibration is complete imu.reset(true); }
std::int32_t set_data_rate(std::uint32_t rate) const virtual
#include <pros/imu.hpp>
Set the Inertial Sensor's refresh interval in milliseconds.
Parameters | |
---|---|
rate | The data refresh interval in milliseconds |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
The rate may be specified in increments of 5ms, and will be rounded down to the nearest increment. The minimum allowable refresh rate is 5ms. The default rate is 10ms.
As values are copied into the shared memory buffer only at 10ms intervals, setting this value to less than 10ms does not mean that you can poll the sensor's values any faster. However, it will guarantee that the data is as recent as possible.
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the refresh rate to 5ms std::int32_t status = imu.set_data_rate(5); delay(20); // Check if the operation was successful if (status == PROS_ERR) { // Do something with the error } // Do something with the sensor data } }
static std::vector<Imu> get_all_devices()
#include <pros/imu.hpp>
Gets all IMU sensors.
Returns | A vector of Imu sensor objects. |
---|
Example
void opcontrol() { std::vector<Imu> imu_all = pros::Imu::get_all_devices(); // All IMU sensors that are connected }
double get_rotation() const virtual
#include <pros/imu.hpp>
Get the total number of degrees the Inertial Sensor has spun about the z-axis.
Returns | The degree value or PROS_ERR_F if the operation failed, setting errno. |
---|
This value is theoretically unbounded. Clockwise rotations are represented with positive degree values, while counterclockwise rotations are represented with negative ones.
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Get the total number of degrees the sensor has spun printf("Total rotation: %f\n", imu.get_rotation()); delay(20); } }
double get_heading() const virtual
#include <pros/imu.hpp>
Get the Inertial Sensor's heading relative to the initial direction of its x-axis.
Returns | The degree value or PROS_ERR_F if the operation failed, setting errno. |
---|
This value is bounded by [0,360). Clockwise rotations are represented with positive degree values, while counterclockwise rotations are represented with negative ones.
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Get the sensor's heading printf("Heading: %f\n", imu.get_heading()); delay(20); } }
pros:: quaternion_s_t get_quaternion() const virtual
#include <pros/imu.hpp>
Get a quaternion representing the Inertial Sensor's orientation.
Returns | The quaternion representing the sensor's orientation. If the operation failed, all the quaternion's members are filled with PROS_ERR_F and errno is set. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Get the sensor's quaternion pros::quaternion_s_t quat = imu.get_quaternion(); cout << "Quaternion: " << quat.w << ", " << quat.x << ", " << quat.y << ", " << quat.z << endl; delay(20); } }
pros:: euler_s_t get_euler() const virtual
#include <pros/imu.hpp>
Get the Euler angles representing the Inertial Sensor's orientation.
Returns | The Euler angles representing the sensor's orientation. If the operation failed, all the structure's members are filled with PROS_ERR_F and errno is set. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Get the sensor's Euler angles pros::euler_s_t euler = imu.get_euler(); cout << "Euler: " << euler.roll << ", " << euler.pitch << ", " << euler.yaw << endl; delay(20); } }
double get_pitch() const virtual
#include <pros/imu.hpp>
Get the Inertial Sensor's pitch angle bounded by (-180,180)
Returns | The pitch angle, or PROS_ERR_F if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Get the sensor's pitch printf("Pitch: %f\n", imu.get_pitch()); delay(20); } }
double get_roll() const virtual
#include <pros/imu.hpp>
Get the Inertial Sensor's roll angle bounded by (-180,180)
Returns | The roll angle, or PROS_ERR_F if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Get the sensor's roll printf("Roll: %f\n", imu.get_roll()); delay(20); } }
double get_yaw() const virtual
#include <pros/imu.hpp>
Get the Inertial Sensor's yaw angle bounded by (-180,180)
Returns | The yaw angle, or PROS_ERR_F if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Get the sensor's yaw printf("Yaw: %f\n", imu.get_yaw()); delay(20); } }
pros:: imu_gyro_s_t get_gyro_rate() const virtual
#include <pros/imu.hpp>
Get the Inertial Sensor's raw gyroscope values.
Returns | The raw gyroscope values. If the operation failed, all the structure's members are filled with PROS_ERR_F and errno is set. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Get the sensor's raw gyroscope values pros::imu_gyro_s_t gyro = imu.get_gyro_rate(); cout << "Gyro: " << gyro.x << ", " << gyro.y << ", " << gyro.z << endl; delay(20); } }
std::int32_t tare_rotation() const virtual
#include <pros/imu.hpp>
Resets the current reading of the Inertial Sensor's rotation to zero.
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's rotation value to 10 imu.set_rotation(10); delay(20); // Do something with sensor // Reset the sensor's rotation value to 0 imu.tare_rotation(); delay(20); } }
std::int32_t tare_heading() const virtual
#include <pros/imu.hpp>
Resets the current reading of the Inertial Sensor's heading to zero.
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's heading value to 10 imu.set_heading(10); delay(20); // Do something with sensor // Reset the sensor's heading value to 0 imu.tare_heading(); delay(20); } }
std::int32_t tare_pitch() const virtual
#include <pros/imu.hpp>
Resets the current reading of the Inertial Sensor's pitch to zero.
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's pitch value to 10 imu.set_pitch(10); delay(20); // Do something with sensor // Reset the sensor's pitch value to 0 imu.tare_pitch(); delay(20); } }
std::int32_t tare_yaw() const virtual
#include <pros/imu.hpp>
Resets the current reading of the Inertial Sensor's yaw to zero.
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's yaw value to 10 imu.set_yaw(10); delay(20); // Do something with sensor // Reset the sensor's yaw value to 0 imu.tare_yaw(); delay(20); } }
std::int32_t tare_roll() const virtual
#include <pros/imu.hpp>
Resets the current reading of the Inertial Sensor's roll to zero.
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's roll value to 10 imu.set_roll(10); delay(20); // Do something with sensor // Reset the sensor's roll value to 0 imu.tare_roll(); delay(20); } }
std::int32_t tare() const virtual
#include <pros/imu.hpp>
Resets all 5 values of the Inertial Sensor to 0.
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Reset all values of the sensor to 0 imu.tare(); delay(20); } }
std::int32_t tare_euler() const virtual
#include <pros/imu.hpp>
Reset all 3 euler values of the Inertial Sensor to 0.
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Reset all euler values of the sensor to 0 imu.tare_euler(); delay(20); } }
std::int32_t set_heading(const double target) const virtual
#include <pros/imu.hpp>
Sets the current reading of the Inertial Sensor's heading to target value Target will default to 360 if above 360 and default to 0 if below 0.
Parameters | |
---|---|
target | Target value for the heading value to be set to |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's heading value to 10 imu.set_heading(10); delay(20); // Do something with sensor } }
std::int32_t set_rotation(const double target) const virtual
#include <pros/imu.hpp>
Sets the current reading of the Inertial Sensor's rotation to target value.
Parameters | |
---|---|
target | Target value for the rotation value to be set to |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's rotation value to 10 imu.set_rotation(10); delay(20); // Do something with sensor } }
std::int32_t set_yaw(const double target) const virtual
#include <pros/imu.hpp>
Sets the current reading of the Inertial Sensor's yaw to target value Will default to +/- 180 if target exceeds +/- 180.
Parameters | |
---|---|
target | Target value for yaw value to be set to |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's yaw value to 10 imu.set_yaw(10); delay(20); // Do something with sensor } }
std::int32_t set_pitch(const double target) const virtual
#include <pros/imu.hpp>
Sets the current reading of the Inertial Sensor's pitch to target value.
Parameters | |
---|---|
target | Target value for the pitch value to be set to |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's pitch value to 10 imu.set_pitch(10); delay(20); // Do something with sensor } }
std::int32_t set_roll(const double target) const virtual
#include <pros/imu.hpp>
Sets the current reading of the Inertial Sensor's roll to target value Will default to +/- 180 if target exceeds +/- 180.
Parameters | |
---|---|
target | Target euler values for the euler values to be set to |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's roll value to 100 imu.set_roll(100); delay(20); // Do something with sensor } }
std::int32_t set_euler(const pros:: euler_s_t target) const virtual
#include <pros/imu.hpp>
Sets the current reading of the Inertial Sensor's euler values to target euler values.
Parameters | |
---|---|
target | Target euler values for the euler values to be set to |
Returns | 1 if the operation was successful or PROS_ERR if the operation failed, setting errno. |
Will default to +/- 180 if target exceeds +/- 180.
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Set the sensor's euler values to 50 imu.set_euler(50); delay(20); // Do something with sensor } }
pros:: imu_accel_s_t get_accel() const virtual
#include <pros/imu.hpp>
Get the Inertial Sensor's raw accelerometer values.
Returns | The raw accelerometer values. If the operation failed, all the structure's members are filled with PROS_ERR_F and errno is set. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Get the sensor's raw accelerometer values pros::imu_accel_s_t accel = imu.get_accel(); printf("x: %f, y: %f, z: %f\n", accel.x, accel.y, accel.z); delay(20); // Do something with sensor } }
pros:: ImuStatus get_status() const virtual
#include <pros/imu.hpp>
Get the Inertial Sensor's status.
Returns | The Inertial Sensor's status code, or PROS_ERR if the operation failed, setting errno. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor EAGAIN - The sensor is still calibrating
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Get the sensor's status pros::ImuStatus status = imu.get_status(); cout << "Status: " << status << endl; delay(20); // Do something with sensor } }
bool is_calibrating() const virtual
#include <pros/imu.hpp>
Check whether the IMU is calibrating.
Returns | true if the V5 Inertial Sensor is calibrating or false false if it is not. |
---|
Example
#define IMU_PORT 1 void opcontrol() { pros::Imu imu(IMU_PORT); while (true) { // Calibrate the sensor imu.calibrate(); delay(20); // Check if the sensor is calibrating if (imu.is_calibrating()) { printf("Calibrating...\n"); } // Do something with sensor } }
imu_orientation_e_t get_physical_orientation() const virtual
#include <pros/imu.hpp>
Returns the physical orientation of the IMU.
Returns | The physical orientation of the Inertial Sensor or PROS_ERR if an error occured. |
---|
This function uses the following values of errno when an error state is reached: ENXIO - The given value is not within the range of V5 ports (1-21). ENODEV - The port cannot be configured as an Inertial Sensor
const pros:: Imu operator""_imu(const unsigned long long int i)
#include <pros/imu.hpp>
Constructs a Imu from a literal ending in _imu via calling the constructor.
Returns | a pros:: |
---|
Example
using namespace pros::literals; void opcontrol() { pros::Imu imu = 2_imu; //Makes an IMU object on port 2 }
Enum documentation
enum class ImuStatus
#include <pros/imu.hpp>
Enumerators | |
---|---|
ready |
|
calibrating |
The IMU is calibrating. |
error |
Used to indicate that an error state was reached in the imu_get_status function,\ not that the IMU is necessarily in an error state. |
Typedef documentation
using IMU = Imu
#include <pros/imu.hpp>