Fawkes API  Fawkes Development Version
firevision::FieldDrawer Class Reference

This class is used to draw a soccer field. More...

#include <>>

List of all members.

Public Member Functions

 FieldDrawer (const FieldLines &lines)
 Created a new field object.
virtual ~FieldDrawer ()
 Destructor.
void set_head_yaw (float head_yaw)
 Sets the angular offset between body and head (along the body axis)
void set_own_pos (fawkes::field_pos_t own_position)
 Own position setter.
void set_own_pos_est (fawkes::field_pos_t own_position_estimate)
 Own position estimate setter.
void set_line_points (const fld_line_points_t *points)
 Setter for detected line points.
void set_line_points_est (const fld_line_points_t *points_est)
 Setter for detected line points.
void set_color_background (YUV_t color)
 Sets the background color (outside the field)
void set_color_field (YUV_t color)
 Sets the field color.
void set_color_lines (YUV_t color)
 Sets the lines color.
void set_color_line_points (YUV_t color)
 Sets the line points color.
void set_color_line_points_est (YUV_t color)
 Sets the line points color.
void set_color_own_pos (YUV_t color)
 Sets the own position color.
void set_color_own_pos_est (YUV_t color)
 Sets the own position estimates color.
virtual void draw_field (unsigned char *yuv422_planar, unsigned int img_width, unsigned int img_height, bool draw_background=true, bool draw_landscape=true)
 Draws the field (including the own position [est]).

Protected Member Functions

void clear_own_pos ()
 Clears the own position.
float get_scale (unsigned int img_width, unsigned int img_height, bool draw_landscape=true) const
 Calculates the conversion factor between field size and image size.
virtual void draw_line_points (bool draw_landscape=true, float scale=0) const
 Draws the line points.
virtual void draw_lines (YUV_t color, bool draw_landscape=true, float scale=0) const
 Draws the field lines to a SharedMemoryImageBuffer.

Protected Attributes

unsigned char * _img_buffer
 The pointer to the target image buffer.
unsigned int _img_width
 The width of the target image buffer.
unsigned int _img_height
 The height of the target image buffer.

Detailed Description

This class is used to draw a soccer field.

Author:
Christof Rath

Constructor & Destructor Documentation

firevision::FieldDrawer::~FieldDrawer ( ) [virtual]

Destructor.

Definition at line 82 of file field_drawer.cpp.


Member Function Documentation

void firevision::FieldDrawer::clear_own_pos ( ) [inline, protected]

Clears the own position.

Used (e.g.) if the own position couldn't be calculated

Definition at line 124 of file field_drawer.cpp.

References fawkes::field_pos_t::ori, _img_buffer, _img_width, and _img_height.

Referenced by FieldDrawer(), and draw_field().

void firevision::FieldDrawer::draw_field ( unsigned char *  yuv422_planar,
unsigned int  img_width,
unsigned int  img_height,
bool  draw_background = true,
bool  draw_landscape = true 
) [virtual]

Draws the field (including the own position [est]).

The position [est] and line points [est] gets reseted after drawing

Parameters:
yuv422_planarthe image buffer
img_widththe image width
img_heightthe image height
draw_backgroundtrue if the background (field and border) should be drawn
draw_landscapetrue if the field should be drawn landscape

Definition at line 259 of file field_drawer.cpp.

References _img_buffer, _img_width, _img_height, firevision::FieldLines::get_field_length(), firevision::FieldLines::get_field_width(), firevision::YUV_t_struct::Y, firevision::YUV_t_struct::U, firevision::YUV_t_struct::V, firevision::ROI::contains(), draw_lines(), firevision::FieldLines::get_field_offsets(), fawkes::cart_coord_2d_t::x, fawkes::cart_coord_2d_t::y, fawkes::field_pos_t::ori, firevision::Drawer::set_buffer(), firevision::Drawer::set_color(), fawkes::field_pos_t::x, fawkes::field_pos_t::y, firevision::Drawer::draw_circle(), firevision::Drawer::draw_line(), draw_line_points(), and clear_own_pos().

void firevision::FieldDrawer::draw_line_points ( bool  draw_landscape = true,
float  scale = 0 
) const [protected, virtual]

Draws the line points.

Parameters:
draw_landscapetrue if the field should be drawn landscape
scalethe pre calculated scale (conversion factor between image size and field size - if 0 the value gets calculated)

Definition at line 401 of file field_drawer.cpp.

References _img_width, firevision::FieldLines::get_field_length(), _img_height, firevision::FieldLines::get_field_width(), firevision::FieldLines::get_field_offsets(), fawkes::cart_coord_2d_t::x, fawkes::cart_coord_2d_t::y, firevision::Drawer::set_buffer(), _img_buffer, firevision::Drawer::set_color(), and firevision::Drawer::draw_cross().

Referenced by draw_field().

void firevision::FieldDrawer::draw_lines ( YUV_t  color,
bool  draw_landscape = true,
float  scale = 0 
) const [protected, virtual]

Draws the field lines to a SharedMemoryImageBuffer.

Parameters:
colorof the lines
draw_landscapeif true (default) the field is supposed to be landscape
scalethe conversation factor between [m] and [px] (if 0 this value gets calculated)

Definition at line 445 of file field_drawer.cpp.

References _img_width, firevision::FieldLines::get_field_length(), _img_height, firevision::FieldLines::get_field_width(), firevision::FieldLines::get_field_offsets(), fawkes::cart_coord_2d_t::x, fawkes::cart_coord_2d_t::y, firevision::Drawer::set_buffer(), _img_buffer, firevision::Drawer::set_color(), firevision::Drawer::draw_line(), firevision::FieldLines::get_circles(), and firevision::Drawer::draw_circle().

Referenced by draw_field().

float firevision::FieldDrawer::get_scale ( unsigned int  img_width,
unsigned int  img_height,
bool  draw_landscape = true 
) const [inline, protected]

Calculates the conversion factor between field size and image size.

Parameters:
img_widthof the target image
img_heightof the target image
draw_landscapetrue if the image should be drawn landscape
Returns:
the conversion factor

Definition at line 169 of file field_drawer.cpp.

References firevision::FieldLines::get_field_length(), and firevision::FieldLines::get_field_width().

void firevision::FieldDrawer::set_color_background ( YUV_t  color)

Sets the background color (outside the field)

Parameters:
colorto be used

Definition at line 181 of file field_drawer.cpp.

Referenced by FieldDrawer().

void firevision::FieldDrawer::set_color_field ( YUV_t  color)

Sets the field color.

Parameters:
colorto be used

Definition at line 191 of file field_drawer.cpp.

Referenced by FieldDrawer().

void firevision::FieldDrawer::set_color_line_points ( YUV_t  color)

Sets the line points color.

Parameters:
colorto be used

Definition at line 211 of file field_drawer.cpp.

Referenced by FieldDrawer().

void firevision::FieldDrawer::set_color_line_points_est ( YUV_t  color)

Sets the line points color.

Parameters:
colorto be used

Definition at line 221 of file field_drawer.cpp.

Referenced by FieldDrawer().

void firevision::FieldDrawer::set_color_lines ( YUV_t  color)

Sets the lines color.

Parameters:
colorto be used

Definition at line 201 of file field_drawer.cpp.

Referenced by FieldDrawer().

void firevision::FieldDrawer::set_color_own_pos ( YUV_t  color)

Sets the own position color.

Parameters:
colorto be used

Definition at line 231 of file field_drawer.cpp.

Referenced by FieldDrawer().

void firevision::FieldDrawer::set_color_own_pos_est ( YUV_t  color)

Sets the own position estimates color.

Parameters:
colorto be used

Definition at line 241 of file field_drawer.cpp.

Referenced by FieldDrawer().

void firevision::FieldDrawer::set_head_yaw ( float  head_yaw)

Sets the angular offset between body and head (along the body axis)

Parameters:
head_yawangular offset

Definition at line 92 of file field_drawer.cpp.

void firevision::FieldDrawer::set_line_points ( const fld_line_points_t points)

Setter for detected line points.

Parameters:
pointsa list of line points (relative to the center of the field!)

Definition at line 143 of file field_drawer.cpp.

void firevision::FieldDrawer::set_line_points_est ( const fld_line_points_t points_est)

Setter for detected line points.

Parameters:
points_esta list of line points (relative to the center of the field!)

Definition at line 154 of file field_drawer.cpp.

void firevision::FieldDrawer::set_own_pos ( fawkes::field_pos_t  own_position)

Own position setter.

Sets the (calculated) own position on the field

Parameters:
own_positionas calculated by the localization

Definition at line 103 of file field_drawer.cpp.

void firevision::FieldDrawer::set_own_pos_est ( fawkes::field_pos_t  own_position_estimate)

Own position estimate setter.

Sets the position estimate (e.g. by triangulation, odometry, ...)

Parameters:
own_position_estimateas estimated

Definition at line 114 of file field_drawer.cpp.


Member Data Documentation

The pointer to the target image buffer.

Definition at line 68 of file field_drawer.h.

Referenced by clear_own_pos(), draw_field(), draw_line_points(), and draw_lines().

The height of the target image buffer.

Definition at line 70 of file field_drawer.h.

Referenced by clear_own_pos(), draw_field(), draw_line_points(), and draw_lines().

The width of the target image buffer.

Definition at line 69 of file field_drawer.h.

Referenced by clear_own_pos(), draw_field(), draw_line_points(), and draw_lines().


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