CodeSubWars 0.4.7b
CodeSubWars::CSWActiveSonar Class Reference

#include <CSWActiveSonar.h>

Inheritance diagram for CodeSubWars::CSWActiveSonar:

Public Member Functions

const double & getDistance () const
 
const double & getMaximalDistance () const
 
bool hasTargetDetected () const
 
bool isTargetDynamic () const
 
bool isTargetBorder () const
 
bool isTargetSubmarine () const
 
bool isTargetWeapon () const
 
const Vector3D & getTargetPosition () const
 
- Public Member Functions inherited from CodeSubWars::CSWSonar
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
 

Additional Inherited Members

- Public Types inherited from CodeSubWars::CSWSonar
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 }
 

Detailed Description

This class specializes a sonar to an active sonar. The time difference between sent and received sonic waves gives the distance to detected solid objects within a small region. The three modes for direction, velocity and range have now additional meanings:

  • ScanDirectionModes:
    • FULL Scans additionally vertical about 30 degree. (Default)
    • FRONT Scans additionally vertical about 60 degree in forward direction.
    • BACK Scans additionally vertical about 60 degree in backward direction.
    • LOCAL_DIRECTION Scans additionally vertical about 30 degree in currently set custom local direction.
    • GLOBAL_POSITION Scans additionally vertical about 30 degree in direction to the currently set global position.
  • ScanVelocityMode:
    • FAST Scans additionally vertical with 1125 degree per second. (Default)
    • SLOW Scans additionally vertical with 375 degree per second.
  • ScanRangeModes:
    • NEAR_RANGE Scans like described above. (Default)
    • FAR_RANGE Reduces the scaning area (vertical) and the velocity (vertical) by factor 4.

Detected objects are reported to the map.

Warning
Objects closer than 60m are not detected.

Member Function Documentation

◆ getDistance()

const double & CodeSubWars::CSWActiveSonar::getDistance ( ) const

Returns the distance from the sensor to the detected object.

Returns
The distance from the sensor to the currently detected object. If no object has been detected getMaximalDistance() is returned.

◆ getMaximalDistance()

const double & CodeSubWars::CSWActiveSonar::getMaximalDistance ( ) const

Returns the maximal distance within objects can be detected.

Returns
The maximal distance within objects can be detected.

◆ getTargetPosition()

const Vector3D & CodeSubWars::CSWActiveSonar::getTargetPosition ( ) const

Returns the position of the detection in world coordinates.

Returns
The position of the detection in world coordinates. If no object has been detected Vector3(0, 0, 0) is returned.

◆ hasTargetDetected()

bool CodeSubWars::CSWActiveSonar::hasTargetDetected ( ) const

Returns true if an object has been detected otherwise false

Returns
True if an object has been detected otherwise false.

◆ isTargetBorder()

bool CodeSubWars::CSWActiveSonar::isTargetBorder ( ) const

Returns true if a world border has been detected.

Returns
True if a world border has been detected.

◆ isTargetDynamic()

bool CodeSubWars::CSWActiveSonar::isTargetDynamic ( ) const

Returns true if a dynamic object has been detected.

Returns
True if a dynamic object has been detected.

◆ isTargetSubmarine()

bool CodeSubWars::CSWActiveSonar::isTargetSubmarine ( ) const

Returns true if a submarine has been detected.

Returns
True if a submarine has been detected.

◆ isTargetWeapon()

bool CodeSubWars::CSWActiveSonar::isTargetWeapon ( ) const

Returns true if a weapon has been detected.

Returns
True if a weapon has been detected.

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