CodeSubWars 0.4.7b
CodeSubWars::CSWSonar Class Referenceabstract

#include <CSWSonar.h>

Inheritance diagram for CodeSubWars::CSWSonar:

Public Types

enum  ScanDirectionMode {
  FULL = 1 , FRONT = 2 , BACK = 3 ,
  LOCAL_DIRECTION = 4 , GLOBAL_POSITION = 5
}
 
enum  ScanVelocityMode { FAST = 1 , SLOW = 2 }
 
enum  ScanRangeMode { NEAR_RANGE = 1 , FAR_RANGE = 2 }
 

Public Member Functions

void setEnableAutomaticRotation (bool bValue)
 
bool isAutomaticRotationEnabled () const
 
void setScanDirectionMode (int directionMode)
 
void setScanVelocityMode (int velocityMode)
 
void setScanRangeMode (int rangeMode)
 
ScanDirectionMode getScanDirectionMode () const
 
ScanVelocityMode getScanVelocityMode () const
 
ScanRangeMode getScanRangeMode () const
 
void setScanDirection (const Vector3D &vecDirection)
 
const Vector3D & getScanDirection () const
 
void pointToGlobalPosition (const Vector3D &vecPosition)
 
const Vector3D & getDirection () const
 
- Public Member Functions inherited from CodeSubWars::CSWEquipment
bool isMoving () const
 
- Public Member Functions inherited from CodeSubWars::CSWObject
const std::string & getName () const
 

Detailed Description

This is the base class for sonar like functionality. To cover regions the sonar can be rotated periodically. This can be controlled by the three different mode types (direction, velocity and range). The maximal angular velocity for adjusting is 180 degree/second.

Member Enumeration Documentation

◆ ScanDirectionMode

Available scanning directions and areas.

Enumerator
FULL 

Scans horizontal about 360 degree. (Default)

FRONT 

Scans horizontal about 90 degree in forward direction.

BACK 

Scans horizontal about 90 degree in backward direction.

LOCAL_DIRECTION 

Scans horizontal about 30 degree in currently set custom direction.

GLOBAL_POSITION 

Scans horizontal about 30 degree in direction to the currently set global position.

◆ ScanRangeMode

Available scanning ranges.

Enumerator
NEAR_RANGE 

Scans like described above. (Default)

FAR_RANGE 

Reduces the scaning area (horizontal) and the velocity (horizontal) by factor 4.

◆ ScanVelocityMode

Available scanning velocities.

Enumerator
FAST 

Scans horizontal with 90 degree per second. (Default)

SLOW 

Scans horizontal with 20 degree per second.

Member Function Documentation

◆ getDirection()

const Vector3D & CodeSubWars::CSWSonar::getDirection ( ) const

Gets the current scanning direction in world coordinate system.

Returns
Returns the current scanning direction in world coordinate system.

◆ getScanDirection()

const Vector3D & CodeSubWars::CSWSonar::getScanDirection ( ) const

Gets the current custom main scanning direction for scan direction mode LOCAL_DIRECTION.

Returns
Returns the current custom main scanning direction in local coordinate system.
Warning
This makes only sense in mode LOCAL_DIRECTION.

◆ getScanDirectionMode()

CSWSonar::ScanDirectionMode CodeSubWars::CSWSonar::getScanDirectionMode ( ) const

Gets the current scanning direction mode.

Returns
Returns the current scanning direction mode.

◆ getScanRangeMode()

CSWSonar::ScanRangeMode CodeSubWars::CSWSonar::getScanRangeMode ( ) const

Gets the current scanning range mode.

Returns
Returns the current scanning range mode.

◆ getScanVelocityMode()

CSWSonar::ScanVelocityMode CodeSubWars::CSWSonar::getScanVelocityMode ( ) const

Gets the current scanning velocity mode.

Returns
Returns the current scanning velocity mode.

◆ isAutomaticRotationEnabled()

bool CodeSubWars::CSWSonar::isAutomaticRotationEnabled ( ) const

Returns whether the automatic rotation is enabled or not.

Returns
True if the automatic rotation is activated otherwise false.

◆ pointToGlobalPosition()

void CodeSubWars::CSWSonar::pointToGlobalPosition ( const Vector3D &  vecPosition)

Lets the sonar always points to the given position in world coordinate system for scan direction mode GLOBAL_POSITION.

Parameters
vecPositionThe global position to which the sonar should be directed.
Warning
This makes only sense in mode GLOBAL_POSITION.

◆ setEnableAutomaticRotation()

void CodeSubWars::CSWSonar::setEnableAutomaticRotation ( bool  bValue)

Enable the automatic rotation. If this is set to false the sonar can be set manually to desired direction with setDirection().

Parameters
bValueIf true the automatic rotation is activated otherwise not.

◆ setScanDirection()

void CodeSubWars::CSWSonar::setScanDirection ( const Vector3D &  vecDirection)

Sets the new custom main scanning direction for scan direction mode LOCAL_DIRECTION.

Parameters
vecDirectionThe new custom main scanning direction in local coordinate system that should be used.
Warning
This makes only sense in mode LOCAL_DIRECTION.

◆ setScanDirectionMode()

void CodeSubWars::CSWSonar::setScanDirectionMode ( int  directionMode)

Sets the scanning direction.

Parameters
directionModeThe new scanning direction that should be used.
Warning
Mode changes causes direction changes.

◆ setScanRangeMode()

void CodeSubWars::CSWSonar::setScanRangeMode ( int  rangeMode)

Sets the scanning range.

Parameters
rangeModeThe new scanning range that should be used.
Warning
Mode changes causes direction changes.

◆ setScanVelocityMode()

void CodeSubWars::CSWSonar::setScanVelocityMode ( int  velocityMode)

Sets the scanning velocity.

Parameters
velocityModeThe new scanning velocity that should be used.
Warning
Mode changes causes direction changes.

Generated at Sun Aug 7 2022 for project CodeSubWars. www.codesubwars.org