|
Webcam Tracker
V1.0
Using openCV and an Arduino Uno
|
Controles the pan and tilt servo motors. More...
#include <PanTiltController.h>
Public Member Functions | |
| void | setPosition (uint16_t pan, uint16_t tilt) |
| Sets the position of the pan and tilt motor. More... | |
| void | setPositionOffSet (uint16_t pan, uint16_t tilt) |
| Sets the position of the pan and tilt motor. More... | |
| void | home () |
| Homes the pan and tilt motors. More... | |
Static Public Member Functions | |
| static PanTiltController * | initialize (uint8_t panPin, uint8_t tiltPin) |
| Creates a object if there isn't one already. More... | |
Private Member Functions | |
| PanTiltController (uint8_t panPin, uint8_t tiltPin) | |
| constructor of the class More... | |
| void | initServos () |
| attaches the pin number to the servo's and homes the servo's | |
| uint8_t | limit (uint8_t angle) |
| Limits an angle between 0° and 180° More... | |
Private Attributes | |
| Servo | panServo |
| Servo motor object for pan. | |
| Servo | tiltServo |
| Servo motor object for tilt. | |
| uint8_t | panPin |
| pinnumber of the pan pwm | |
| uint8_t | tiltPin |
| pinnumber of the tilt pwm | |
| uint16_t | pan |
| Current pan angle [°]. | |
| uint16_t | tilt |
| Current tilt angle [°]. | |
Static Private Attributes | |
| static PanTiltController * | instance = 0 |
| Pointer to the current used instance. | |
Controles the pan and tilt servo motors.
|
private |
constructor of the class
| panPin | number of the pan pwm-pin |
| tiltPin | number of the tilt pwm-pin |
|
private |
Limits an angle between 0° and 180°
If nessecary sends an error over the serial port, indicating the input angle is out of range. When the angle is out of range it is clamped to 0° or 180°. Depending on at wich end the angle is out of range.
| angle | angle that needs to be checked |
|
static |
Creates a object if there isn't one already.
| panPin | number of the pan pwm-pin |
| tiltPin | number of the tilt pwm-pin |
| void PanTiltController::setPosition | ( | uint16_t | pan, |
| uint16_t | tilt | ||
| ) |
Sets the position of the pan and tilt motor.
if nessecary limits both angles
| pan | angle to set the pan motor to |
| tilt | angle to set the tilt motor to |
| void PanTiltController::setPositionOffSet | ( | uint16_t | pan, |
| uint16_t | tilt | ||
| ) |
Sets the position of the pan and tilt motor.
if nessecary limits both angles
| pan | angle to set the pan motor to |
| tilt | angle to set the tilt motor to |
| void PanTiltController::home | ( | ) |
Homes the pan and tilt motors.
Homing is done by setting both motors to 90 degrees