PiImageStreamer
Loading...
Searching...
No Matches
SWE4211RPi::CameraController Class Reference

#include <CameraController.h>

Inheritance diagram for SWE4211RPi::CameraController:
Collaboration diagram for SWE4211RPi::CameraController:

Public Member Functions

 CameraController (AbstractImageTransmitter &transmitter, int azimuthPinNumber, int elevationPinNumber, std::string threadName, uint32_t taskRate)
 
virtual ~CameraController ()
 
void taskMethod ()
 
void setElevation (int elevation)
 
void setRotation (int rotation)
 
virtual void startChildTasks ()
 
virtual void stopChildTasks ()
 
- Public Member Functions inherited from SWE4211RPi::PeriodicTask
 PeriodicTask (std::string threadName, uint32_t period, int priority=1)
 
virtual ~PeriodicTask ()
 
virtual void setTaskPeriod (uint32_t period) final
 
virtual uint32_t getTaskPeriod () final
 
void run () final
 
virtual void printInformation ()
 
virtual double getCPUUsageInfo ()
 
virtual void resetThreadDiagnostics ()
 
- Public Member Functions inherited from SWE4211RPi::RunnableClass
 RunnableClass (std::string threadName, int priority=0)
 
virtual ~RunnableClass ()
 
virtual pid_t getThreadID ()
 
virtual void start () final
 
virtual void setPriority (int priority) final
 
virtual int getPriority () final
 
virtual bool isShutdown () final
 
virtual bool isStarted () final
 
virtual void stopThreadExecution ()
 
virtual void waitForShutdown ()
 

Private Attributes

int elevation = 0
 
std::atomic_int desiredElevation = {0}
 
int rotation = 0
 
std::atomic_int desiredRotation = {0}
 
AbstractImageTransmitter & myTransmitter
 
PulsedGPIOPin * azimuthPin
 
PulsedGPIOPin * elevationPin
 

Additional Inherited Members

- Static Public Member Functions inherited from SWE4211RPi::RunnableClass
static void printThreads ()
 
static void resetAllThreadInformation ()
 
- Protected Member Functions inherited from SWE4211RPi::PeriodicTask
virtual void startChildRunnables () final
 
virtual void stopChildRunnables () final
 
- Protected Attributes inherited from SWE4211RPi::PeriodicTask
uint32_t taskPeriod = 100000
 
- Protected Attributes inherited from SWE4211RPi::RunnableClass
std::thread * myThread = NULL
 
pthread_t executingThread = 0
 
pid_t myOSThreadID = 0
 
std::string myName
 
std::atomic< bool > keepGoing {true}
 
std::atomic< bool > runCompleted {false}
 
std::atomic< bool > runStarted {false}
 
int priority = -1
 
- Static Protected Attributes inherited from SWE4211RPi::RunnableClass
static std::list< RunnableClass * > runningThreads
 

Detailed Description

This class controls the camera's servos and the image transmitter's destination.

Constructor & Destructor Documentation

◆ CameraController()

CameraController::CameraController ( AbstractImageTransmitter &  transmitter,
int  azimuthPinNumber,
int  elevationPinNumber,
std::string  threadName,
uint32_t  taskRate 
)

This will construct a new camera controller, creating the pins that drive the servos.

Parameters
transmitterThis is the image transmitter whose destination is to be controlled.
azimuthPinNumberThis is the GPIO pin number for the azimuth (rotation) servo.
elevationPinNumberThis is the GPIO pin number for the elevation servo.
threadNameThis is the name of the thread that is to execute.
taskRateThis is the period for the task, given in microseconds.
Here is the call graph for this function:

◆ ~CameraController()

CameraController::~CameraController ( )
virtual

This is the destructor for the class. It deletes the servo pins.

Member Function Documentation

◆ setElevation()

void CameraController::setElevation ( int  elevation)

This method will set the elevation that the camera is to move to. Values outside of -45 to 90 degrees are ignored.

Parameters
elevationThis is the desired elevation, in degrees.
Here is the caller graph for this function:

◆ setRotation()

void CameraController::setRotation ( int  rotation)

This method will set the rotation (azimuth) that the camera is to move to. Values outside of -90 to 90 degrees are ignored.

Parameters
rotationThis is the desired rotation, in degrees.
Here is the caller graph for this function:

◆ startChildTasks()

void CameraController::startChildTasks ( )
virtual

This method will start up any runnable objects which are contained within this class, which are the servo pins. If there are no other objects that are runnable, there is no need to override this method. However, if a child class contains an instance of a runnable object, then this method must be overridden in the derived class.

Reimplemented from SWE4211RPi::PeriodicTask.

Here is the call graph for this function:

◆ stopChildTasks()

void CameraController::stopChildTasks ( )
virtual

This method will stop any runnable objects which are contained within this class, which are the servo pins.

Reimplemented from SWE4211RPi::PeriodicTask.

Here is the call graph for this function:

◆ taskMethod()

void CameraController::taskMethod ( )
virtual

This is the task method for the class. It will process any queued messages, then move the servos toward their desired positions.

Implements SWE4211RPi::PeriodicTask.

Here is the call graph for this function:

Member Data Documentation

◆ azimuthPin

PulsedGPIOPin* SWE4211RPi::CameraController::azimuthPin
private

This is the pin that drives the azimuth (rotation) servo.

◆ desiredElevation

std::atomic_int SWE4211RPi::CameraController::desiredElevation = {0}
private

This is the elevation the camera is moving toward, in degrees (-45 to 90). It is atomic as it may be set from another thread.

◆ desiredRotation

std::atomic_int SWE4211RPi::CameraController::desiredRotation = {0}
private

This is the rotation the camera is moving toward, in degrees (-90 to 90). It is atomic as it may be set from another thread.

◆ elevation

int SWE4211RPi::CameraController::elevation = 0
private

This is the current elevation of the camera, in degrees.

◆ elevationPin

PulsedGPIOPin* SWE4211RPi::CameraController::elevationPin
private

This is the pin that drives the elevation servo.

◆ myTransmitter

AbstractImageTransmitter& SWE4211RPi::CameraController::myTransmitter
private

This is the image transmitter whose destination is updated when a client connects or disconnects.

◆ rotation

int SWE4211RPi::CameraController::rotation = 0
private

This is the current rotation (azimuth) of the camera, in degrees.


The documentation for this class was generated from the following files: