Relative ball position model for pan/tilt camera. More...
#include <models/relative_position/ball_trigo.h>
Public Member Functions | |
BallTrigoRelativePos (unsigned int image_width, unsigned int image_height, float camera_height, float camera_offset_x, float camera_offset_y, float camera_base_pan, float camera_base_tilt, float horizontal_angle, float vertical_angle, float ball_circumference) | |
Constructor. | |
virtual const char * | get_name () const |
Get name of relative position model. | |
virtual void | set_radius (float r) |
Set radius of a found circle. | |
virtual void | set_center (float x, float y) |
Set center of a found circle. | |
virtual void | set_center (const center_in_roi_t &c) |
Set center of a found circle. | |
virtual void | set_pan_tilt (float pan=0.0f, float tilt=0.0f) |
Set camera pan and tilt. | |
virtual void | get_pan_tilt (float *pan, float *tilt) const |
Get camera pan tilt. | |
virtual float | get_distance () const |
Get distance to object. | |
virtual float | get_x () const |
Get relative X coordinate of object. | |
virtual float | get_y () const |
Get relative Y coordinate of object. | |
virtual float | get_bearing () const |
Get bearing (horizontal angle) to object. | |
virtual float | get_slope () const |
Get slope (vertical angle) to object. | |
virtual void | calc () |
Calculate position data. | |
virtual void | calc_unfiltered () |
Calculate data unfiltered. | |
virtual void | reset () |
Reset all data. | |
virtual bool | is_pos_valid () const |
Check if position is valid. |
Relative ball position model for pan/tilt camera.
This uses basic trigonometry to calculate the position of the ball given only the center of the ball in the image as variable parameters, and the camera parameters as static parameters.
Definition at line 34 of file ball_trigo.h.
firevision::BallTrigoRelativePos::BallTrigoRelativePos | ( | unsigned int | image_width, | |
unsigned int | image_height, | |||
float | camera_height, | |||
float | camera_offset_x, | |||
float | camera_offset_y, | |||
float | camera_base_pan, | |||
float | camera_base_tilt, | |||
float | horizontal_angle, | |||
float | vertical_angle, | |||
float | ball_circumference | |||
) |
Constructor.
image_width | width of image in pixels | |
image_height | height of image in pixels | |
camera_height | height of camera in meters | |
camera_offset_x | camera offset of the motor axis in x direction | |
camera_offset_y | camera offset of the motor axis in y direction | |
camera_base_pan | camera base pan in rad | |
camera_base_tilt | camera base tilt in rad | |
horizontal_angle | horizontal viewing angle (in degree) | |
vertical_angle | vertical viewing angle (in degree) | |
ball_circumference | ball circumference |
Definition at line 57 of file ball_trigo.cpp.
References fawkes::deg2rad(), firevision::center_in_roi_t::x, and firevision::center_in_roi_t::y.
void firevision::BallTrigoRelativePos::calc | ( | ) | [virtual] |
Calculate position data.
Call this method if all relevant data (set(Radius|Center|PanTilt)) has been set, after this valid data can be retrieved via get*
Implements firevision::RelativePositionModel.
Definition at line 180 of file ball_trigo.cpp.
References firevision::center_in_roi_t::x, and firevision::center_in_roi_t::y.
virtual void firevision::BallTrigoRelativePos::calc_unfiltered | ( | ) | [inline, virtual] |
Calculate data unfiltered.
Same as calc(), but without any filtering (i.e. no Kalman filter).
Implements firevision::RelativePositionModel.
Definition at line 63 of file ball_trigo.h.
float firevision::BallTrigoRelativePos::get_bearing | ( | void | ) | const [virtual] |
Get bearing (horizontal angle) to object.
Implements firevision::RelativePositionModel.
Definition at line 102 of file ball_trigo.cpp.
float firevision::BallTrigoRelativePos::get_distance | ( | ) | const [virtual] |
Get distance to object.
Implements firevision::RelativePositionModel.
Definition at line 95 of file ball_trigo.cpp.
const char * firevision::BallTrigoRelativePos::get_name | ( | void | ) | const [virtual] |
Get name of relative position model.
Implements firevision::RelativePositionModel.
Definition at line 168 of file ball_trigo.cpp.
void firevision::BallTrigoRelativePos::get_pan_tilt | ( | float * | pan, | |
float * | tilt | |||
) | const [virtual] |
Get camera pan tilt.
pan | contains pan value (rad) upon return | |
tilt | contains tilt value (rad) upon return |
Implements firevision::RelativePositionModel.
Definition at line 160 of file ball_trigo.cpp.
float firevision::BallTrigoRelativePos::get_slope | ( | ) | const [virtual] |
Get slope (vertical angle) to object.
Implements firevision::RelativePositionModel.
Definition at line 109 of file ball_trigo.cpp.
float firevision::BallTrigoRelativePos::get_x | ( | void | ) | const [virtual] |
Get relative X coordinate of object.
Implements firevision::RelativePositionModel.
Definition at line 123 of file ball_trigo.cpp.
float firevision::BallTrigoRelativePos::get_y | ( | void | ) | const [virtual] |
Get relative Y coordinate of object.
Implements firevision::RelativePositionModel.
Definition at line 116 of file ball_trigo.cpp.
bool firevision::BallTrigoRelativePos::is_pos_valid | ( | ) | const [virtual] |
Check if position is valid.
Implements firevision::RelativePositionModel.
Definition at line 207 of file ball_trigo.cpp.
void firevision::BallTrigoRelativePos::reset | ( | ) | [virtual] |
Reset all data.
This must be called if the object is not visible.
Implements firevision::RelativePositionModel.
Definition at line 175 of file ball_trigo.cpp.
void firevision::BallTrigoRelativePos::set_center | ( | const center_in_roi_t & | c | ) | [virtual] |
Set center of a found circle.
This is especially used for ball position implementations.
c | center |
Implements firevision::RelativePositionModel.
Definition at line 138 of file ball_trigo.cpp.
References firevision::center_in_roi_t::x, and firevision::center_in_roi_t::y.
void firevision::BallTrigoRelativePos::set_center | ( | float | x, | |
float | y | |||
) | [virtual] |
Set center of a found circle.
This is especially used for ball position implementations.
x | x position in image (pixels) | |
y | y position in image (pixels) |
Implements firevision::RelativePositionModel.
Definition at line 130 of file ball_trigo.cpp.
References firevision::center_in_roi_t::x, and firevision::center_in_roi_t::y.
void firevision::BallTrigoRelativePos::set_pan_tilt | ( | float | pan = 0.0f , |
|
float | tilt = 0.0f | |||
) | [virtual] |
Set camera pan and tilt.
pan | pan value (rad) | |
tilt | tilt value (rad) |
Implements firevision::RelativePositionModel.
Definition at line 152 of file ball_trigo.cpp.
void firevision::BallTrigoRelativePos::set_radius | ( | float | r | ) | [virtual] |
Set radius of a found circle.
This is especially used for ball position implementations.
r | radius |
Implements firevision::RelativePositionModel.
Definition at line 146 of file ball_trigo.cpp.