Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fawkes::WorldInfoTransceiver Class Reference

Class to send and receive world information. More...

#include <netcomm/worldinfo/transceiver.h>

List of all members.

Public Types

enum  SocketType { MULTICAST, BROADCAST }
 Socket type. More...

Public Member Functions

 WorldInfoTransceiver (SocketType socket_type, const char *addr, unsigned short port, const char *key, const char *iv, NetworkNameResolver *resolver=NULL)
 Constructor.
 ~WorldInfoTransceiver ()
 Destructor.
void set_fatmsg_enabled (bool fatmsg_enabled)
 Enable or disable sending of fat message.
void add_handler (WorldInfoHandler *h)
 Add a handler for world information.
void rem_handler (WorldInfoHandler *h)
 Remove handler for world information.
void set_pose (float x, float y, float theta, float *covariance)
 Set global pose of robot.
void set_velocity (float vel_x, float vel_y, float vel_theta, float *covariance)
 Set velocity of the robot.
void set_rel_ball_pos (float dist, float bearing, float slope, float *covariance)
 Set ball position.
void set_rel_ball_visible (bool visible, int visibility_history)
 Set ball visibility.
void set_rel_ball_velocity (float vel_x, float vel_y, float vel_z, float *covariance)
 Set ball velocity.
void set_glob_ball_pos (float x, float y, float z, float *covariance)
 Set global ball position.
void set_glob_ball_visible (bool visible, int visibility_history)
 Set ball visibility for the global ball.
void set_glob_ball_velocity (float vel_x, float vel_y, float vel_z, float *covariance)
 Set global ball velocity.
void set_gamestate (int gamestate, worldinfo_gamestate_team_t state_team)
 Set current game state.
void set_score (unsigned int score_cyan, unsigned int score_magenta)
 Set score.
void set_team_goal (worldinfo_gamestate_team_t our_color, worldinfo_gamestate_goalcolor_t goal_color)
 Set team and goal info.
void set_half (worldinfo_gamestate_half_t half)
 Set current half of the game time.
void add_penalty (unsigned int player, unsigned int penalty, unsigned int seconds_remaining)
 Add penalty message.
void clear_opponents ()
 Clear opponents list.
void add_opponent (unsigned int uid, float distance, float bearing, float *covariance)
 Add opponent to transmit list.
void add_disappeared_opponent (unsigned int uid)
 Add disappeared opponent.
void send ()
 Send information.
void recv (bool block=false, unsigned int max_num_msgs=0)
 Receive information.
void set_loop (bool loop)
 Set loopback of sent packets.
void flush_sequence_numbers (unsigned int sec)
 Flush sequence numbers conditionally.
void * last_sent_plain_buffer ()
 Get last sent plain buffer.
size_t last_sent_plain_buffer_size ()
 Get last sent plain buffer size.
void * last_sent_crypted_buffer ()
 Get last sent crypted buffer.
size_t last_sent_crypted_buffer_size ()
 Get last sent crypted buffer size.

Detailed Description

Class to send and receive world information.

An important point in a domain of cooperating soccer robots is transmitting and receiving a robot's belief of its surrounding. The world info transceiver does exactly that. It allows for sending information about the robot's pose and velocity and its perception of the ball and other robots on the field.

The unit for distances and positions is meter (m), speed is given in meter per second (m/s), angles are given in radiant (rad). Angles can be in the range 0 to 2 * PI or -PI to PI. Since they can be converted easily between these ranges without further information users of such information shall be able to process both.

Coordinates are given in a right-handed coordinate system with the origin in center of the field, X pointing towards the opponent goal, Y to the right and Z downwards.

Information is transmitted with a simple protocol via UDP Multicast or Broadcast packets.

A call to send() will reset all information, thus all opponents are removed from the list to be sent, positions of robot and ball are marked invalid. You have to call the appropriate set methods before the information is sent. You can thus call send() at any time but only changed information (information set since last send() call) is transmitted over the network.

Author:
Tim Niemueller

Definition at line 52 of file transceiver.h.


Member Enumeration Documentation

Socket type.

Enumerator:
MULTICAST 

Use multicast socket for communication.

BROADCAST 

Use broadcase socket for communication.

Definition at line 56 of file transceiver.h.


Constructor & Destructor Documentation

fawkes::WorldInfoTransceiver::WorldInfoTransceiver ( SocketType  socket_type,
const char *  addr,
unsigned short  port,
const char *  key,
const char *  iv,
NetworkNameResolver resolver = NULL 
)

Constructor.

Parameters:
socket_typeeither multicast or broadcast socket
addrmulticast or broadcast address to send information to and receive from
portUDP port to send information to and receive from
keyencryption key
ivencryption initialisation vector
resolverAn initialized network resolver, is NULL is supplied an internal resolver will be created without mDNS support.
Exceptions:
OutOfMemoryExceptionthrown if internal buffers cannot be created

Definition at line 99 of file transceiver.cpp.

References fawkes::Exception::append(), fawkes::BroadcastDatagramSocket::bind(), fawkes::MulticastDatagramSocket::bind(), BROADCAST, MULTICAST, fawkes::WorldInfoMessageEncryptor::recommended_crypt_buffer_size(), fawkes::WorldInfoMessageEncryptor::set_crypt_buffer(), set_loop(), fawkes::WorldInfoMessageEncryptor::set_plain_buffer(), and fawkes::WorldInfoMessageDecryptor::set_plain_buffer().

fawkes::WorldInfoTransceiver::~WorldInfoTransceiver ( )

Destructor.

Definition at line 179 of file transceiver.cpp.

References set_fatmsg_enabled().


Member Function Documentation

void fawkes::WorldInfoTransceiver::add_disappeared_opponent ( unsigned int  uid)

Add disappeared opponent.

Add any opponent that you had added in an earlier cycle (before the last send()) with add_opponent() and that is no longer visible. After it has been marked as disappeared the unique ID may not be reused. Gibt it another new ID instead.

Parameters:
uidUnique ID of opponent that disappeared

Definition at line 601 of file transceiver.cpp.

void fawkes::WorldInfoTransceiver::add_handler ( WorldInfoHandler h)

Add a handler for world information.

World information will be dispatched to all registered handlers as soon it is received.

Parameters:
hhandler to register

Definition at line 252 of file transceiver.cpp.

References fawkes::LockList< Type >::lock(), and fawkes::LockList< Type >::unlock().

Referenced by WorldModelNetworkThread::init(), and WorldInfoViewerBackendThread::WorldInfoViewerBackendThread().

void fawkes::WorldInfoTransceiver::add_opponent ( unsigned int  uid,
float  distance,
float  bearing,
float *  covariance 
)

Add opponent to transmit list.

Add an opponent to the list of opponents to be transmitted on next send() call. Opponents are given in a 2D polar coordinate system (assumption is that robots don't fly in the soccer domain).

Parameters:
uidunique ID of this opponent. The caller shall assign the same UID to an opponent if and only if the object is the same (for example an opponent that was tracked)
distanceto opponent
bearingto opponent (angle is zero if opponent is in front of robot, positive if right of robot, negative if left of robot).
covariancecovariance matrix with 4 entries, ordered as two concatenated rows (first row, two floats, second row, two floats. No length check or whatsoever is done. This will crash if c is not long enough! c will not be copied but referenced so it has to exist when send() is called!

Definition at line 586 of file transceiver.cpp.

References fawkes::distance().

void fawkes::WorldInfoTransceiver::add_penalty ( unsigned int  player,
unsigned int  penalty,
unsigned int  seconds_remaining 
)

Add penalty message.

Parameters:
playerplayer for which the penalty applies
penaltypenalty code
seconds_remainingestimated time in seconds until the penalty is lifted

Definition at line 522 of file transceiver.cpp.

References fawkes::worldinfo_penalty_message_t::penalty, fawkes::worldinfo_penalty_message_t::player, fawkes::worldinfo_penalty_message_t::reserved, and fawkes::worldinfo_penalty_message_t::seconds_remaining.

void fawkes::WorldInfoTransceiver::clear_opponents ( )

Clear opponents list.

Clear the list of opponents that has to be transmitted. This is done implicitly in send().

Definition at line 563 of file transceiver.cpp.

void fawkes::WorldInfoTransceiver::flush_sequence_numbers ( unsigned int  sec)

Flush sequence numbers conditionally.

This will conditionally flush the sequence numbers stored per sender. The sequence numbers are stored per IP. With this method you can flush the sequence numbers that have been inactive for a specified time. A recommended value is 10 seconds. You may NOT call this concurrently to recv()!

Parameters:
secnumber of seconds since that must have passed without a message to remove a specific IP from sequence list

Definition at line 284 of file transceiver.cpp.

Referenced by WorldInfoViewerBackendThread::loop(), and WorldModelNetworkThread::loop().

void * fawkes::WorldInfoTransceiver::last_sent_crypted_buffer ( )

Get last sent crypted buffer.

This method is meant to be used for debugging and testing purposes only.

Returns:
last crytped message buffer

Definition at line 1223 of file transceiver.cpp.

size_t fawkes::WorldInfoTransceiver::last_sent_crypted_buffer_size ( )

Get last sent crypted buffer size.

This method is meant to be used for debugging and testing purposes only.

Returns:
last crypted message buffer size

Definition at line 1234 of file transceiver.cpp.

void * fawkes::WorldInfoTransceiver::last_sent_plain_buffer ( )

Get last sent plain buffer.

This method is meant to be used for debugging and testing purposes only.

Returns:
last plain text message buffer

Definition at line 1201 of file transceiver.cpp.

size_t fawkes::WorldInfoTransceiver::last_sent_plain_buffer_size ( )

Get last sent plain buffer size.

This method is meant to be used for debugging and testing purposes only.

Returns:
last plain text message buffer size

Definition at line 1212 of file transceiver.cpp.

void fawkes::WorldInfoTransceiver::recv ( bool  block = false,
unsigned int  max_num_msgs = 0 
)

Receive information.

This checks if there is information on the network waiting to be received and if so receives and processes the information and dispatches it to all registered handlers. If you order it to block this method will block until information has been received and dispatched (useful if running in a thread).

Received packets will be ignored if

  • they do not start with 0xBEEF
  • they are of an incompatible version
  • the sequence number is smaller or equal to an already received packet They will only be partially handled if
  • a packet has been truncated (truncated message is ignored)
  • an unknown message type is encountered (message is ignored)
  • a message size does not match the expected size for a given type (message is ignored)
Parameters:
blockset to true for blocking operation, in this case recv() will block until data is available, false for non-blocking operation where recv() will immediately return if there is no data available
max_num_msgsmaximum number of messages to process in a single call to recv(). Set to 0 for an unlimited number of messages per call (this can block for an infinite time if messages are coming in fast).

Definition at line 875 of file transceiver.cpp.

References fawkes::Socket::available(), fawkes::worldinfo_relballpos_message_t::bearing, fawkes::worldinfo_opppose_message_t::bearing, fawkes::worldinfo_header_t::beef, fawkes::worldinfo_pose_message_t::covariance, fawkes::worldinfo_velocity_message_t::covariance, fawkes::worldinfo_relballpos_message_t::covariance, fawkes::worldinfo_globballpos_message_t::covariance, fawkes::worldinfo_relballvelo_message_t::covariance, fawkes::worldinfo_globballvelo_message_t::covariance, fawkes::worldinfo_opppose_message_t::covariance, fawkes::WorldInfoMessageDecryptor::decrypt(), fawkes::worldinfo_relballpos_message_t::dist, fawkes::worldinfo_opppose_message_t::dist, fawkes::worldinfo_gamestate_message_t::game_state, fawkes::worldinfo_gamestate_message_t::half, fawkes::worldinfo_relballpos_message_t::history, fawkes::worldinfo_globballpos_message_t::history, fawkes::LockList< Type >::lock(), fawkes::worldinfo_fat_message_t::num_opponents, fawkes::worldinfo_fat_message_t::opponents, fawkes::worldinfo_gamestate_message_t::our_goal_color, fawkes::worldinfo_gamestate_message_t::our_team, fawkes::worldinfo_penalty_message_t::penalty, fawkes::worldinfo_penalty_message_t::player, fawkes::worldinfo_fat_message_t::pose, fawkes::Socket::recv(), fawkes::worldinfo_fat_message_t::relball_pos, fawkes::worldinfo_fat_message_t::relball_velo, fawkes::NetworkNameResolver::resolve_address(), fawkes::worldinfo_gamestate_message_t::score_cyan, fawkes::worldinfo_gamestate_message_t::score_magenta, fawkes::worldinfo_penalty_message_t::seconds_remaining, fawkes::worldinfo_header_t::seq, fawkes::WorldInfoMessageDecryptor::set_crypt_buffer(), fawkes::worldinfo_message_header_t::size, fawkes::worldinfo_relballpos_message_t::slope, fawkes::worldinfo_gamestate_message_t::state_team, fawkes::worldinfo_pose_message_t::theta, fawkes::worldinfo_message_header_t::type, fawkes::worldinfo_opppose_message_t::uid, fawkes::worldinfo_oppdisappeared_message_t::uid, fawkes::LockList< Type >::unlock(), fawkes::worldinfo_fat_message_t::valid_pose, fawkes::worldinfo_fat_message_t::valid_relball_pos, fawkes::worldinfo_fat_message_t::valid_relball_velo, fawkes::worldinfo_fat_message_t::valid_velo, fawkes::worldinfo_velocity_message_t::vel_theta, fawkes::worldinfo_velocity_message_t::vel_x, fawkes::worldinfo_relballvelo_message_t::vel_x, fawkes::worldinfo_globballvelo_message_t::vel_x, fawkes::worldinfo_velocity_message_t::vel_y, fawkes::worldinfo_relballvelo_message_t::vel_y, fawkes::worldinfo_globballvelo_message_t::vel_y, fawkes::worldinfo_relballvelo_message_t::vel_z, fawkes::worldinfo_globballvelo_message_t::vel_z, fawkes::worldinfo_fat_message_t::velo, fawkes::worldinfo_header_t::version, fawkes::worldinfo_relballpos_message_t::visible, fawkes::worldinfo_globballpos_message_t::visible, fawkes::WORLDINFO_MSGTYPE_FAT_WORLDINFO, fawkes::WORLDINFO_MSGTYPE_GAMESTATE, fawkes::WORLDINFO_MSGTYPE_GLOBBALL, fawkes::WORLDINFO_MSGTYPE_GLOBBALLVELO, fawkes::WORLDINFO_MSGTYPE_OPP_DISAPP, fawkes::WORLDINFO_MSGTYPE_OPP_POSE, fawkes::WORLDINFO_MSGTYPE_PENALTY, fawkes::WORLDINFO_MSGTYPE_POSE, fawkes::WORLDINFO_MSGTYPE_RELBALL, fawkes::WORLDINFO_MSGTYPE_RELBALLVELO, fawkes::WORLDINFO_MSGTYPE_VELO, fawkes::worldinfo_pose_message_t::x, fawkes::worldinfo_globballpos_message_t::x, fawkes::worldinfo_pose_message_t::y, fawkes::worldinfo_globballpos_message_t::y, and fawkes::worldinfo_globballpos_message_t::z.

Referenced by WorldInfoViewerBackendThread::loop(), and WorldModelNetworkThread::loop().

void fawkes::WorldInfoTransceiver::rem_handler ( WorldInfoHandler h)

Remove handler for world information.

The handler is removed from the list of handlers that incoming information is dispatched to. No error is thrown if the handler was never registered so it is safe to call this for any handler.

Parameters:
hhandler to remove from subscriber list

Definition at line 269 of file transceiver.cpp.

References fawkes::LockList< Type >::remove_locked().

void fawkes::WorldInfoTransceiver::send ( )

Send information.

All information that has been set since last call is sent over the network. This implicitly resets all information and flushes the opponent list.

Definition at line 667 of file transceiver.cpp.

References fawkes::worldinfo_relballpos_message_t::bearing, fawkes::worldinfo_opppose_message_t::bearing, fawkes::worldinfo_pose_message_t::covariance, fawkes::worldinfo_velocity_message_t::covariance, fawkes::worldinfo_relballpos_message_t::covariance, fawkes::worldinfo_globballpos_message_t::covariance, fawkes::worldinfo_relballvelo_message_t::covariance, fawkes::worldinfo_globballvelo_message_t::covariance, fawkes::worldinfo_opppose_message_t::covariance, fawkes::worldinfo_relballpos_message_t::dist, fawkes::worldinfo_opppose_message_t::dist, fawkes::WorldInfoMessageEncryptor::encrypt(), fawkes::worldinfo_relballpos_message_t::history, fawkes::worldinfo_globballpos_message_t::history, fawkes::worldinfo_fat_message_t::num_opponents, fawkes::worldinfo_fat_message_t::opponents, fawkes::worldinfo_fat_message_t::pose, fawkes::worldinfo_fat_message_t::relball_pos, fawkes::worldinfo_fat_message_t::relball_velo, fawkes::Socket::send(), fawkes::worldinfo_header_t::seq, fawkes::WorldInfoMessageEncryptor::set_plain_buffer(), fawkes::worldinfo_relballpos_message_t::slope, fawkes::worldinfo_pose_message_t::theta, fawkes::worldinfo_opppose_message_t::uid, fawkes::worldinfo_oppdisappeared_message_t::uid, fawkes::worldinfo_fat_message_t::valid_pose, fawkes::worldinfo_fat_message_t::valid_relball_pos, fawkes::worldinfo_fat_message_t::valid_relball_velo, fawkes::worldinfo_fat_message_t::valid_velo, fawkes::worldinfo_velocity_message_t::vel_theta, fawkes::worldinfo_velocity_message_t::vel_x, fawkes::worldinfo_relballvelo_message_t::vel_x, fawkes::worldinfo_globballvelo_message_t::vel_x, fawkes::worldinfo_velocity_message_t::vel_y, fawkes::worldinfo_relballvelo_message_t::vel_y, fawkes::worldinfo_globballvelo_message_t::vel_y, fawkes::worldinfo_relballvelo_message_t::vel_z, fawkes::worldinfo_globballvelo_message_t::vel_z, fawkes::worldinfo_fat_message_t::velo, fawkes::worldinfo_relballpos_message_t::visible, fawkes::worldinfo_globballpos_message_t::visible, fawkes::WORLDINFO_MSGTYPE_GAMESTATE, fawkes::WORLDINFO_MSGTYPE_GLOBBALL, fawkes::WORLDINFO_MSGTYPE_GLOBBALLVELO, fawkes::WORLDINFO_MSGTYPE_OPP_DISAPP, fawkes::WORLDINFO_MSGTYPE_OPP_POSE, fawkes::WORLDINFO_MSGTYPE_PENALTY, fawkes::WORLDINFO_MSGTYPE_POSE, fawkes::WORLDINFO_MSGTYPE_RELBALLVELO, fawkes::WORLDINFO_MSGTYPE_VELO, fawkes::worldinfo_pose_message_t::x, fawkes::worldinfo_globballpos_message_t::x, fawkes::worldinfo_pose_message_t::y, fawkes::worldinfo_globballpos_message_t::y, and fawkes::worldinfo_globballpos_message_t::z.

Referenced by WorldModelThread::loop().

void fawkes::WorldInfoTransceiver::set_fatmsg_enabled ( bool  fatmsg_enabled)

Enable or disable sending of fat message.

The fat message is considered to be legacy code and therefore disabled by default. If you happen to need the fat message you can enable it using this method and then it will be send for every call to send().

Parameters:
fatmsg_enabledtrue to enable sending of fat message, false otherwise

Definition at line 221 of file transceiver.cpp.

Referenced by ~WorldInfoTransceiver().

void fawkes::WorldInfoTransceiver::set_gamestate ( int  gamestate,
worldinfo_gamestate_team_t  state_team 
)

Set current game state.

Parameters:
gamestatecurrent game state
state_teamteam referenced by the game state

Definition at line 491 of file transceiver.cpp.

References fawkes::worldinfo_gamestate_message_t::game_state, and fawkes::worldinfo_gamestate_message_t::state_team.

void fawkes::WorldInfoTransceiver::set_glob_ball_pos ( float  x,
float  y,
float  z,
float *  covariance 
)

Set global ball position.

Note that the ball position is given in polar coordinates in 3D space! The confidence about the ball position is transmitted as a 3x3 covariance matrix.

Parameters:
xthe x-coordinate of the global ball position
ythe y-coordinate of the global ball position
zthe z-coordinate of the global ball position
covariancecovariance matrix with 9 entries, ordered as three concatenated rows (first row, three floats, second row, three floats, third row, three floats). No length check or whatsoever is done. This will crash if c is not long enough! c will not be copied but referenced so it has to exist when send() is called!

Definition at line 395 of file transceiver.cpp.

Referenced by WorldModelThread::loop().

void fawkes::WorldInfoTransceiver::set_glob_ball_velocity ( float  vel_x,
float  vel_y,
float  vel_z,
float *  covariance 
)

Set global ball velocity.

Set the current, global velocity of the robot.

Parameters:
vel_xvelocity in x direction wrt. to the global frame
vel_yvelocity in y direction wrt. to the global frame
vel_zvelocity in z direction wrt. to the global frame
covariancecovariance matrix with 9 entries, ordered as three concatenated rows (first row, three floats, second row, three floats, third row, three floats). No length check or whatsoever is done. This will crash if c is not long enough! c will not be copied but referenced so it has to exist when send() is called!

Definition at line 475 of file transceiver.cpp.

void fawkes::WorldInfoTransceiver::set_glob_ball_visible ( bool  visible,
int  visibility_history 
)

Set ball visibility for the global ball.

Same semantics as set_ball_visible().

Parameters:
visibletrue if the ball is visible, false otherwise
visibility_historyvisibility history, see above.

Definition at line 432 of file transceiver.cpp.

Referenced by WorldModelThread::loop().

void fawkes::WorldInfoTransceiver::set_half ( worldinfo_gamestate_half_t  half)

Set current half of the game time.

Parameters:
halfcurrent half

Definition at line 551 of file transceiver.cpp.

References fawkes::worldinfo_gamestate_message_t::half.

void fawkes::WorldInfoTransceiver::set_loop ( bool  loop)

Set loopback of sent packets.

This sets whether packets should be looped back to local sockets for multicast communication.

Parameters:
looptrue to deliver sent packets to local sockets, false prevent delivering
See also:
MulticastDatagramSocket::set_loop()

Definition at line 204 of file transceiver.cpp.

References fawkes::MulticastDatagramSocket::set_loop().

Referenced by WorldModelNetworkThread::init(), and WorldInfoTransceiver().

void fawkes::WorldInfoTransceiver::set_pose ( float  x,
float  y,
float  theta,
float *  covariance 
)

Set global pose of robot.

Global pose of sensing robot (x, y, theta) with the origin in the middle of the field, right handed coordinate system (y to opponent goal, x to the right, z pointing upwards, same as in simulation league). Theta points in y direction (theta = 0 iff robot front points to opponent goal). The confidence about the robot's pose is transmitted as a 3x3 covariance matrix.

Parameters:
xx position of robot
yy position of robot
thetarotation of robot
covariancecovariance matrix with 9 entries, ordered as three concatenated rows (first row, three floats, second row, three floats, third row, three floats). No length check or whatsoever is done. This will crash if c is not long enough! c will not be copied but referenced so it has to exist when send() is called!

Definition at line 321 of file transceiver.cpp.

Referenced by WorldModelThread::loop().

void fawkes::WorldInfoTransceiver::set_rel_ball_pos ( float  dist,
float  bearing,
float  slope,
float *  covariance 
)

Set ball position.

Set the ball perception relative to the current robot position. Note that the ball position is given in polar coordinates in 3D space! The confidence about the ball position is transmitted as a 3x3 covariance matrix.

Parameters:
distdistance to ball in meters
bearingbearing angle to ball
slopeslope angle to ball
covariancecovariance matrix with 9 entries, ordered as three concatenated rows (first row, three floats, second row, three floats, third row, three floats). No length check or whatsoever is done. This will crash if c is not long enough! c will not be copied but referenced so it has to exist when send() is called!

Definition at line 370 of file transceiver.cpp.

void fawkes::WorldInfoTransceiver::set_rel_ball_velocity ( float  vel_x,
float  vel_y,
float  vel_z,
float *  covariance 
)

Set ball velocity.

Set the current velocity of the robot.

Parameters:
vel_xvelocity in x direction
vel_yvelocity in y direction
vel_zvelocity in z direction
covariancecovariance matrix with 9 entries, ordered as three concatenated rows (first row, three floats, second row, three floats, third row, three floats). No length check or whatsoever is done. This will crash if c is not long enough! c will not be copied but referenced so it has to exist when send() is called!

Definition at line 452 of file transceiver.cpp.

void fawkes::WorldInfoTransceiver::set_rel_ball_visible ( bool  visible,
int  visibility_history 
)

Set ball visibility.

This method defines if the ball is currently visible or not. Additionally more detailed information is provided in the visibility history. The history shall be 0 only if the vision has just been initialized. It shall be positive if the ball is visible and shall have the number of vision cycles in which the ball was visible in a row. It shall be negative if the ball is not visible and shall be the negative value of the number of frames where the ball was not visible. A value of 30 for example means that the ball has been continuously visible for 30 frames, it was never lost. A value of -20 means that the ball was not seen for the last 20 frames.

Parameters:
visibletrue if the ball is visible, false otherwise
visibility_historyvisibility history, see above.

Definition at line 418 of file transceiver.cpp.

void fawkes::WorldInfoTransceiver::set_score ( unsigned int  score_cyan,
unsigned int  score_magenta 
)

Set score.

Parameters:
score_cyancurrent score of team cyan
score_magentacurrent score of team magenta

Definition at line 508 of file transceiver.cpp.

References fawkes::worldinfo_gamestate_message_t::score_cyan, and fawkes::worldinfo_gamestate_message_t::score_magenta.

void fawkes::WorldInfoTransceiver::set_team_goal ( worldinfo_gamestate_team_t  our_team,
worldinfo_gamestate_goalcolor_t  goal_color 
)

Set team and goal info.

Parameters:
our_teamour team color
goal_colorour goal color

Definition at line 538 of file transceiver.cpp.

References fawkes::worldinfo_gamestate_message_t::our_goal_color, and fawkes::worldinfo_gamestate_message_t::our_team.

void fawkes::WorldInfoTransceiver::set_velocity ( float  vel_x,
float  vel_y,
float  vel_theta,
float *  covariance 
)

Set velocity of the robot.

Set the current velocity of the robot.

Parameters:
vel_xvelocity in x direction
vel_yvelocity in y direction
vel_thetarotational velocity, positive velocity means clockwise rotation, negative velocity means counter-clockwise.
covariancecovariance matrix with 9 entries, ordered as three concatenated rows (first row, three floats, second row, three floats, third row, three floats). No length check or whatsoever is done. This will crash if c is not long enough! c will not be copied but referenced so it has to exist when send() is called!

Definition at line 344 of file transceiver.cpp.

Referenced by WorldModelThread::loop().


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