Vision Sensor C API module

Files

file vision.h

Namespaces

namespace pros
LLEMU Conditional Include
namespace pros::c

Classes

struct vision_signature_s_t
struct vision_object_s_t

Functions

int32_t vision_clear_led(uint8_t port)
Clears the vision sensor LED color, reseting it back to its default behavior, displaying the most prominent object signature color.
vision_signature_s_t vision_signature_from_utility(const int32_t id, const int32_t u_min, const int32_t u_max, const int32_t u_mean, const int32_t v_min, const int32_t v_max, const int32_t v_mean, const float range, const int32_t type)
Creates a signature from the vision sensor utility.
vision_color_code_t vision_create_color_code(uint8_t port, const uint32_t sig_id1, const uint32_t sig_id2, const uint32_t sig_id3, const uint32_t sig_id4, const uint32_t sig_id5)
Creates a color code that represents a combination of the given signature IDs.
vision_object_s_t vision_get_by_size(uint8_t port, const uint32_t size_id)
Gets the nth largest object according to size_id.
vision_object_s_t vision_get_by_sig(uint8_t port, const uint32_t size_id, const uint32_t sig_id)
Gets the nth largest object of the given signature according to size_id.
vision_object_s_t vision_get_by_code(uint8_t port, const uint32_t size_id, const vision_color_code_t color_code)
Gets the nth largest object of the given color code according to size_id.
int32_t vision_get_exposure(uint8_t port)
Gets the exposure parameter of the Vision Sensor.
int32_t vision_get_object_count(uint8_t port)
Gets the number of objects currently detected by the Vision Sensor.
int32_t vision_get_white_balance(uint8_t port)
Get the white balance parameter of the Vision Sensor.
int32_t vision_print_signature(const vision_signature_s_t sig)
Prints the contents of the signature as an initializer list to the terminal.
int32_t vision_read_by_size(uint8_t port, const uint32_t size_id, const uint32_t object_count, vision_object_s_t*const object_arr)
Reads up to object_count object descriptors into object_arr.
int32_t vision_read_by_sig(uint8_t port, const uint32_t size_id, const uint32_t sig_id, const uint32_t object_count, vision_object_s_t*const object_arr)
Reads up to object_count object descriptors into object_arr.
int32_t vision_read_by_code(uint8_t port, const uint32_t size_id, const vision_color_code_t color_code, const uint32_t object_count, vision_object_s_t*const object_arr)
Reads up to object_count object descriptors into object_arr.
vision_signature_s_t vision_get_signature(uint8_t port, const uint8_t signature_id)
Gets the object detection signature with the given id number.
int32_t vision_set_signature(uint8_t port, const uint8_t signature_id, vision_signature_s_t*const signature_ptr)
Stores the supplied object detection signature onto the vision sensor.
int32_t vision_set_auto_white_balance(uint8_t port, const uint8_t enable)
Enables/disables auto white-balancing on the Vision Sensor.
int32_t vision_set_exposure(uint8_t port, const uint8_t exposure)
Sets the exposure parameter of the Vision Sensor.
int32_t vision_set_led(uint8_t port, const int32_t rgb)
Sets the vision sensor LED color, overriding the automatic behavior.
int32_t vision_set_white_balance(uint8_t port, const int32_t rgb)
Sets the white balance parameter of the Vision Sensor.
int32_t vision_set_zero_point(uint8_t port, vision_zero_e_t zero_point)
Sets the (0,0) coordinate for the Field of View.
int32_t vision_set_wifi_mode(uint8_t port, const uint8_t enable)
Sets the Wi-Fi mode of the Vision sensor.

Macros

Parameters given by VEX

#define VISION_OBJECT_ERR_SIG
The width of the Vision Sensor’s field of view.
#define VISION_FOV_WIDTH
The width of the Vision Sensor’s field of view.
#define VISION_FOV_HEIGHT
The height of the Vision Sensor’s field of view.

Enums

enum vision_object_type { E_VISION_OBJECT_NORMAL = 0, E_VISION_OBJECT_COLOR_CODE = 1, E_VISION_OBJECT_LINE = 2 }
enum vision_zero { E_VISION_ZERO_TOPLEFT = 0, E_VISION_ZERO_CENTER = 1 }

Typedefs

using vision_color_code_t = uint16_t

Variables

vision_signature_s_t
vision_object_s_t

Enum documentation

enum vision_zero

This enumeration defines different zero points for returned vision objects.

Enumerators
E_VISION_ZERO_TOPLEFT

(0,0) coordinate is the top left of the FOV

E_VISION_ZERO_CENTER

(0,0) coordinate is the center of the FOV

Typedef documentation

typedef uint16_t vision_color_code_t

Color codes are just signatures with multiple IDs and a different type.

Variable documentation

Define documentation

#define VISION_OBJECT_ERR_SIG

The width of the Vision Sensor’s field of view.

#define VISION_FOV_WIDTH

The width of the Vision Sensor’s field of view.

#define VISION_FOV_HEIGHT

The height of the Vision Sensor’s field of view.