WPILibC++ 2024.3.2
Analog Gyro Functions

Functions

HAL_GyroHandle HAL_InitializeAnalogGyro (HAL_AnalogInputHandle handle, const char *allocationLocation, int32_t *status)
 Initializes an analog gyro. More...
 
void HAL_SetupAnalogGyro (HAL_GyroHandle handle, int32_t *status)
 Sets up an analog gyro with the proper offsets and settings for the KOP analog gyro. More...
 
void HAL_FreeAnalogGyro (HAL_GyroHandle handle)
 Frees an analog gyro. More...
 
void HAL_SetAnalogGyroParameters (HAL_GyroHandle handle, double voltsPerDegreePerSecond, double offset, int32_t center, int32_t *status)
 Sets the analog gyro parameters to the specified values. More...
 
void HAL_SetAnalogGyroVoltsPerDegreePerSecond (HAL_GyroHandle handle, double voltsPerDegreePerSecond, int32_t *status)
 Sets the analog gyro volts per degrees per second scaling. More...
 
void HAL_ResetAnalogGyro (HAL_GyroHandle handle, int32_t *status)
 Resets the analog gyro value to 0. More...
 
void HAL_CalibrateAnalogGyro (HAL_GyroHandle handle, int32_t *status)
 Calibrates the analog gyro. More...
 
void HAL_SetAnalogGyroDeadband (HAL_GyroHandle handle, double volts, int32_t *status)
 Sets the deadband of the analog gyro. More...
 
double HAL_GetAnalogGyroAngle (HAL_GyroHandle handle, int32_t *status)
 Gets the gyro angle in degrees. More...
 
double HAL_GetAnalogGyroRate (HAL_GyroHandle handle, int32_t *status)
 Gets the gyro rate in degrees/second. More...
 
double HAL_GetAnalogGyroOffset (HAL_GyroHandle handle, int32_t *status)
 Gets the calibrated gyro offset. More...
 
int32_t HAL_GetAnalogGyroCenter (HAL_GyroHandle handle, int32_t *status)
 Gets the calibrated gyro center. More...
 

Detailed Description

Function Documentation

◆ HAL_CalibrateAnalogGyro()

void HAL_CalibrateAnalogGyro ( HAL_GyroHandle  handle,
int32_t *  status 
)

Calibrates the analog gyro.

This happens by calculating the average value of the gyro over 5 seconds, and setting that as the center. Note that this call blocks for 5 seconds to perform this.

Parameters
[in]handlethe gyro handle
[out]statusError status variable. 0 on success.

◆ HAL_FreeAnalogGyro()

void HAL_FreeAnalogGyro ( HAL_GyroHandle  handle)

Frees an analog gyro.

Parameters
[in,out]handlethe gyro handle

◆ HAL_GetAnalogGyroAngle()

double HAL_GetAnalogGyroAngle ( HAL_GyroHandle  handle,
int32_t *  status 
)

Gets the gyro angle in degrees.

Parameters
[in]handlethe gyro handle
[out]statusError status variable. 0 on success.
Returns
the gyro angle in degrees

◆ HAL_GetAnalogGyroCenter()

int32_t HAL_GetAnalogGyroCenter ( HAL_GyroHandle  handle,
int32_t *  status 
)

Gets the calibrated gyro center.

Can be used to not repeat a calibration but reconstruct the gyro object.

Parameters
[in]handlethe gyro handle
[out]statusError status variable. 0 on success.
Returns
the gyro center

◆ HAL_GetAnalogGyroOffset()

double HAL_GetAnalogGyroOffset ( HAL_GyroHandle  handle,
int32_t *  status 
)

Gets the calibrated gyro offset.

Can be used to not repeat a calibration but reconstruct the gyro object.

Parameters
[in]handlethe gyro handle
[out]statusError status variable. 0 on success.
Returns
the gryo offset

◆ HAL_GetAnalogGyroRate()

double HAL_GetAnalogGyroRate ( HAL_GyroHandle  handle,
int32_t *  status 
)

Gets the gyro rate in degrees/second.

Parameters
[in]handlethe gyro handle
[out]statusError status variable. 0 on success.
Returns
the gyro rate in degrees/second

◆ HAL_InitializeAnalogGyro()

HAL_GyroHandle HAL_InitializeAnalogGyro ( HAL_AnalogInputHandle  handle,
const char *  allocationLocation,
int32_t *  status 
)

Initializes an analog gyro.

Parameters
[in]handlehandle to the analog input port
[in]allocationLocationthe location where the allocation is occurring (can be null)
[out]statusthe error code, or 0 for success
Returns
the initialized gyro handle

◆ HAL_ResetAnalogGyro()

void HAL_ResetAnalogGyro ( HAL_GyroHandle  handle,
int32_t *  status 
)

Resets the analog gyro value to 0.

Parameters
[in]handlethe gyro handle
[out]statusthe error code, or 0 for success

◆ HAL_SetAnalogGyroDeadband()

void HAL_SetAnalogGyroDeadband ( HAL_GyroHandle  handle,
double  volts,
int32_t *  status 
)

Sets the deadband of the analog gyro.

Parameters
[in]handlethe gyro handle
[in]voltsthe voltage deadband
[out]statusError status variable. 0 on success.

◆ HAL_SetAnalogGyroParameters()

void HAL_SetAnalogGyroParameters ( HAL_GyroHandle  handle,
double  voltsPerDegreePerSecond,
double  offset,
int32_t  center,
int32_t *  status 
)

Sets the analog gyro parameters to the specified values.

This is meant to be used if you want to reuse the values from a previous calibration.

Parameters
[in]handlethe gyro handle
[in]voltsPerDegreePerSecondthe gyro volts scaling
[in]offsetthe gyro offset
[in]centerthe gyro center
[out]statusthe error code, or 0 for success

◆ HAL_SetAnalogGyroVoltsPerDegreePerSecond()

void HAL_SetAnalogGyroVoltsPerDegreePerSecond ( HAL_GyroHandle  handle,
double  voltsPerDegreePerSecond,
int32_t *  status 
)

Sets the analog gyro volts per degrees per second scaling.

Parameters
[in]handlethe gyro handle
[in]voltsPerDegreePerSecondthe gyro volts scaling
[out]statusthe error code, or 0 for success

◆ HAL_SetupAnalogGyro()

void HAL_SetupAnalogGyro ( HAL_GyroHandle  handle,
int32_t *  status 
)

Sets up an analog gyro with the proper offsets and settings for the KOP analog gyro.

Parameters
[in]handlethe gyro handle
[out]statusthe error code, or 0 for success