Fawkes API  Fawkes Development Version
fawkes::SelectDriveMode Class Reference

This class selects the correct drive mode and calls the appopriate drive component. More...

#include <>>

Public Member Functions

 SelectDriveMode (MotorInterface *motor, NavigatorInterface *colli_target, Logger *logger, Configuration *config, colli_escape_mode_t escape_mode=colli_escape_mode_t::basic)
 Constructor. More...
 
 ~SelectDriveMode ()
 Desctructor. More...
 
void set_local_target (float x, float y)
 Set local target point before update! More...
 
void set_local_trajec (float x, float y)
 Set local trajectory point before update! More...
 
void update (bool escape=false)
 Has to be called before the proposed values are called. More...
 
float get_proposed_trans_x ()
 Returns the proposed translation. After an update. More...
 
float get_proposed_trans_y ()
 Returns the proposed translation. After an update. More...
 
float get_proposed_rot ()
 Returns the proposed rotation. After an update. More...
 
void set_grid_information (LaserOccupancyGrid *occ_grid, int robo_x, int robo_y)
 search for the escape drive mode and hands over the given information to the escape drive mode This should just be called if potential-field-escape mode is used! More...
 
void set_laser_data (std::vector< fawkes::polar_coord_2d_t > &laser_points)
 search for the escape drive mode and hands over the given information to the escape drive mode This should just be called if basic-escape mode is used! More...
 

Detailed Description

This class selects the correct drive mode and calls the appopriate drive component.

Definition at line 42 of file select_drive_mode.h.

Constructor & Destructor Documentation

◆ SelectDriveMode()

fawkes::SelectDriveMode::SelectDriveMode ( MotorInterface motor,
NavigatorInterface target,
Logger logger,
Configuration config,
colli_escape_mode_t  escape_mode = colli_escape_mode_t::basic 
)

Constructor.

Parameters
motorThe motor interface
targetThe "colli target" NavigatorInterface
loggerThe fawkes logger
configThe fawkes configuration
escape_modeThe chosen escape mode

Definition at line 64 of file select_drive_mode.cpp.

References fawkes::Configuration::get_string(), and fawkes::Logger::log_debug().

◆ ~SelectDriveMode()

fawkes::SelectDriveMode::~SelectDriveMode ( )

Desctructor.

Definition at line 105 of file select_drive_mode.cpp.

References fawkes::Logger::log_debug(), and fawkes::Logger::log_error().

Member Function Documentation

◆ get_proposed_rot()

float fawkes::SelectDriveMode::get_proposed_rot ( )

Returns the proposed rotation. After an update.

Returns the proposed rotation which was previously calculated in update()

Returns
The proposed rotation

Definition at line 203 of file select_drive_mode.cpp.

References fawkes::colli_trans_rot_t::rot.

Referenced by ColliThread::loop().

◆ get_proposed_trans_x()

float fawkes::SelectDriveMode::get_proposed_trans_x ( )

Returns the proposed translation. After an update.

Returns the proposed x translation which was previously calculated in update()

Returns
The proposed translation

Definition at line 185 of file select_drive_mode.cpp.

References fawkes::colli_trans_rot_t::x.

Referenced by ColliThread::loop().

◆ get_proposed_trans_y()

float fawkes::SelectDriveMode::get_proposed_trans_y ( )

Returns the proposed translation. After an update.

Returns the proposed y translation which was previously calculated in update()

Returns
The proposed translation

Definition at line 194 of file select_drive_mode.cpp.

References fawkes::colli_trans_rot_t::y.

Referenced by ColliThread::loop().

◆ set_grid_information()

void fawkes::SelectDriveMode::set_grid_information ( LaserOccupancyGrid occ_grid,
int  robo_x,
int  robo_y 
)

search for the escape drive mode and hands over the given information to the escape drive mode This should just be called if potential-field-escape mode is used!

Parameters
occ_gridpointer to the occ_grid
robo_xrobot position on the grid in x
robo_yrobot position on the grid in y

Definition at line 216 of file select_drive_mode.cpp.

References fawkes::NavigatorInterface::ESCAPE, and fawkes::Logger::log_error().

Referenced by ColliThread::loop().

◆ set_laser_data()

void fawkes::SelectDriveMode::set_laser_data ( std::vector< fawkes::polar_coord_2d_t > &  laser_points)

search for the escape drive mode and hands over the given information to the escape drive mode This should just be called if basic-escape mode is used!

Parameters
laser_pointsvector of laser points

Definition at line 235 of file select_drive_mode.cpp.

References fawkes::NavigatorInterface::ESCAPE, and fawkes::Logger::log_error().

Referenced by ColliThread::loop().

◆ set_local_target()

void fawkes::SelectDriveMode::set_local_target ( float  x,
float  y 
)

Set local target point before update!

Parameters
xx-coordinate
yy-coordinate

Definition at line 164 of file select_drive_mode.cpp.

References fawkes::cart_coord_2d_struct::x, and fawkes::cart_coord_2d_struct::y.

Referenced by ColliThread::loop().

◆ set_local_trajec()

void fawkes::SelectDriveMode::set_local_trajec ( float  x,
float  y 
)

Set local trajectory point before update!

Set local target trajectory before update!

Parameters
xx-coordinate
yy-coordinate

Definition at line 175 of file select_drive_mode.cpp.

References fawkes::cart_coord_2d_struct::x, and fawkes::cart_coord_2d_struct::y.

Referenced by ColliThread::loop().

◆ update()

void fawkes::SelectDriveMode::update ( bool  escape = false)

Has to be called before the proposed values are called.

Pick the drive-mode that should be used and calculate the proposed translation and rotation for the current target (which is set by set_local_target() and set_local_trajec(), so make sure to call them beforehand).

update() has to be called before the proposed values are fetched.

Parameters
escapeSet to true if we want to enter escape-mode

Definition at line 261 of file select_drive_mode.cpp.

References fawkes::MotorInterface::des_omega(), fawkes::MotorInterface::des_vx(), fawkes::NavigatorInterface::dest_ori(), fawkes::NavigatorInterface::dest_x(), fawkes::NavigatorInterface::dest_y(), fawkes::NavigatorInterface::drive_mode(), fawkes::NavigatorInterface::ESCAPE, fawkes::AbstractDriveMode::get_proposed_rot(), fawkes::AbstractDriveMode::get_proposed_trans_x(), fawkes::AbstractDriveMode::get_proposed_trans_y(), fawkes::NavigatorInterface::is_stop_at_target(), fawkes::Logger::log_error(), fawkes::NavigatorInterface::max_rotation(), fawkes::NavigatorInterface::max_velocity(), fawkes::NavigatorInterface::MovingNotAllowed, fawkes::normalize_mirror_rad(), fawkes::MotorInterface::odometry_orientation(), fawkes::MotorInterface::odometry_position_x(), fawkes::MotorInterface::odometry_position_y(), fawkes::MotorInterface::omega(), fawkes::NavigatorInterface::orientation_mode(), fawkes::colli_trans_rot_t::rot, fawkes::AbstractDriveMode::set_current_colli_mode(), fawkes::AbstractDriveMode::set_current_robo_pos(), fawkes::AbstractDriveMode::set_current_robo_speed(), fawkes::AbstractDriveMode::set_current_target(), fawkes::AbstractDriveMode::set_local_target(), fawkes::AbstractDriveMode::set_local_trajec(), fawkes::AbstractDriveMode::update(), fawkes::MotorInterface::vx(), fawkes::MotorInterface::vy(), fawkes::cart_coord_2d_struct::x, fawkes::colli_trans_rot_t::x, fawkes::cart_coord_2d_struct::y, and fawkes::colli_trans_rot_t::y.

Referenced by ColliThread::loop().


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