27 #include <fvmodels/relative_position/omni_relative.h> 43 this->mirror_model = mirror_model;
45 avg_x = avg_y = avg_x_sum = avg_y_sum = 0.f;
46 avg_x_num = avg_y_num = 0;
48 ball_x = ball_y = bearing = slope = distance_ball_motor = distance_ball_cam = 0.f;
53 DEFAULT_X_VARIANCE = 36.f;
54 DEFAULT_Y_VARIANCE = 25.f;
77 return distance_ball_motor;
112 image_x = (
unsigned int)roundf(x);
113 image_y = (
unsigned int)roundf(y);
154 return "OmniRelative";
161 last_available =
false;
173 distance_ball_cam = rel_pos.
r;
174 bearing = rel_pos.
phi;
177 ball_x = cos( bearing ) * distance_ball_cam;
178 ball_y = sin( bearing ) * distance_ball_cam;
182 distance_ball_motor = sqrt( ball_x * ball_x + ball_y * ball_y );
200 distance_ball_cam = rel_pos.
r;
201 bearing = rel_pos.
phi;
207 ball_x = cos( bearing ) * distance_ball_cam;
208 ball_y = sin( bearing ) * distance_ball_cam;
210 distance_ball_motor = sqrt( ball_x * ball_x + ball_y * ball_y );
virtual void reset()
Reset all data.
OmniRelative(MirrorModel *mirror_model)
Constructor.
virtual float get_x() const
Get relative X coordinate of object.
virtual float get_bearing() const
Get bearing (horizontal angle) to object.
virtual void calc_unfiltered()
Calculate data unfiltered.
virtual bool is_pos_valid() const
Check if position is valid.
virtual void set_radius(float r)
Set radius of a found circle.
virtual bool isValidPoint(unsigned int image_x, unsigned int image_y) const =0
Check if the given point is valid.
virtual float get_distance() const
Get distance to object.
virtual float get_radius() const
Get radius.
virtual void calc()
Calculate position data.
virtual fawkes::polar_coord_2d_t getWorldPointRelative(unsigned int image_x, unsigned int image_y) const =0
Get relative coordinate based on image coordinates.
virtual float get_y() const
Get relative Y coordinate of object.
virtual const char * get_name() const
Get name of relative position model.
virtual float get_slope() const
Get slope (vertical angle) to object.
virtual void set_center(float x, float y)
Set center of a found circle.
virtual void get_pan_tilt(float *pan, float *tilt) const
Get camera pan tilt.
virtual void set_pan_tilt(float pan=0.0f, float tilt=0.0f)
Set camera pan and tilt.