WALL-E Version 1.0
The "WALL-E" Project is a ME 507 quarter term project inspired to recreate the robot WALL-E. The WALL-E robot is a fully 3D printed robot with modified components in order to fit the needs of the chosen peripherals and electronics. WALL-E contains a custom made PCB which is housed in the main body of WALL-E. WALL-E's peripherals and components include 2 pololu Romi Motors with encoders, 4 MG90s servos, BNO055 IMU, and a OV2640 ArduCam camera. The objective of WALL-E is to scan the surrounding area for the closest object to it. Once that object is detected, WALL-E drives up to the object, attempts to pick up or hold the object and detect the color of the object.
Loading...
Searching...
No Matches
OV2640Camera Class Reference

WALL-E Camera class used for object and color detection. More...

#include <camera.h>

Public Member Functions

 OV2640Camera (I2C_HandleTypeDef *i2c, SPI_HandleTypeDef *spi, GPIO_TypeDef *cs_port, uint16_t cs_pin)
 Constructor function for the Camera Class.
bool initialize ()
 Function initializes the camera for photo capturing by using the OV2640 register and values list in the header/include folder.
bool captureFrame ()
 Function captures a single frame from the camera storing the RGB and data from the photo for parsing and basic color detection.
void printCaptureReport (UART_HandleTypeDef *huart)
 Function is designed to parse the photo data captured by the camera. The data is the transmitted via USART to a PUTTY Terminal for viewing and debugging.
void printBlueDetectionMap (UART_HandleTypeDef *huart)
 Function is designed to parse the photo data captured by the camera focusing on blue color pixels and selecting by a threshold value. The data is the transmitted via USART to a PUTTY Terminal for viewing and debugging.
DominantColor analyzeColor ()
 Function is the analysis/parsing function to analyze the colors in frame by pixels.
DominantColor analyzeColorCenter ()
 Function is the analysis/parsing function focusing solely on the pixels closer to the center of the Camera.

Private Member Functions

void writeRegister (uint8_t reg, uint8_t val)
 Function takes in a register and value utilizing I2C to write to the desired register.
void csHigh ()
 Function sets the Chip Select GPIO pin high for SPI Communication.
void csLow ()
 Function sets the Chip Select GPIO pin low for SPI Communication.

Private Attributes

I2C_HandleTypeDef * i2c_
SPI_HandleTypeDef * spi_
GPIO_TypeDef * cs_port_
uint16_t cs_pin_
uint8_t frame_buffer_ [FRAME_SIZE]

Static Private Attributes

static constexpr size_t FRAME_SIZE = 160 * 120 * 2

Detailed Description

WALL-E Camera class used for object and color detection.

Constructor & Destructor Documentation

◆ OV2640Camera()

OV2640Camera::OV2640Camera ( I2C_HandleTypeDef * i2c,
SPI_HandleTypeDef * spi,
GPIO_TypeDef * cs_port,
uint16_t cs_pin )

Constructor function for the Camera Class.

Member Function Documentation

◆ analyzeColor()

DominantColor OV2640Camera::analyzeColor ( )

Function is the analysis/parsing function to analyze the colors in frame by pixels.

Returns
None

◆ analyzeColorCenter()

DominantColor OV2640Camera::analyzeColorCenter ( )

Function is the analysis/parsing function focusing solely on the pixels closer to the center of the Camera.

Returns
None

◆ captureFrame()

bool OV2640Camera::captureFrame ( )

Function captures a single frame from the camera storing the RGB and data from the photo for parsing and basic color detection.

Returns
None

◆ csHigh()

void OV2640Camera::csHigh ( )
private

Function sets the Chip Select GPIO pin high for SPI Communication.

Returns
None

◆ csLow()

void OV2640Camera::csLow ( )
private

Function sets the Chip Select GPIO pin low for SPI Communication.

Returns
None

◆ initialize()

bool OV2640Camera::initialize ( )

Function initializes the camera for photo capturing by using the OV2640 register and values list in the header/include folder.

Returns
Boolean

◆ printBlueDetectionMap()

void OV2640Camera::printBlueDetectionMap ( UART_HandleTypeDef * huart)

Function is designed to parse the photo data captured by the camera focusing on blue color pixels and selecting by a threshold value. The data is the transmitted via USART to a PUTTY Terminal for viewing and debugging.

Parameters
huartParameter that sets the USART definition from the STM32 HAL Configuration
Returns
None

◆ printCaptureReport()

void OV2640Camera::printCaptureReport ( UART_HandleTypeDef * huart)

Function is designed to parse the photo data captured by the camera. The data is the transmitted via USART to a PUTTY Terminal for viewing and debugging.

Parameters
huartParameter that sets the USART definition from the STM32 HAL Configuration
Returns
None

◆ writeRegister()

void OV2640Camera::writeRegister ( uint8_t reg,
uint8_t val )
private

Function takes in a register and value utilizing I2C to write to the desired register.

Parameters
regParameter that takes in the register value to write data into
valParameter that takes in the data to write to specified register
Returns
None

Member Data Documentation

◆ cs_pin_

uint16_t OV2640Camera::cs_pin_
private

Private Variable cs_pin. Sets the Chip Select GPIO definition from the STM32 HAL Config

◆ cs_port_

GPIO_TypeDef* OV2640Camera::cs_port_
private

Private Variable cs_port_. Sets the Chip Select GPIO Port definition from the STM32 HAL Config

◆ frame_buffer_

uint8_t OV2640Camera::frame_buffer_[FRAME_SIZE]
private

Private Variable frame_buffer_. Sets the buffer for frame analysis

◆ FRAME_SIZE

size_t OV2640Camera::FRAME_SIZE = 160 * 120 * 2
staticconstexprprivate

Private Variable FRAME_SIZE. Sets the camera's fixed Frame Capture Size

◆ i2c_

I2C_HandleTypeDef* OV2640Camera::i2c_
private

Private Variable i2c_. Sets the I2C definition from the STM32 HAL Config

◆ spi_

SPI_HandleTypeDef* OV2640Camera::spi_
private

Private Variable spi_. Sets the SPI definition from the STM32 HAL Config


The documentation for this class was generated from the following files:
  • C:/Users/arath/OneDrive/Documents/ME 507/Project-WALLE/Code/Inc/camera.h
  • C:/Users/arath/OneDrive/Documents/ME 507/Project-WALLE/Code/src/camera.cpp