blah2
A real-time passive radar
Track Class Reference

A class to store track data. More...

#include <Track.h>

Collaboration diagram for Track:
Collaboration graph

Public Member Functions

 Track ()
 Constructor. More...
 
 ~Track ()
 Destructor. More...
 
std::string uint2hex (uint64_t number)
 Convert an unsigned int to hexadecimal. More...
 
void set_state (uint64_t index, std::string state)
 Set the state of the latest tracklet. More...
 
void set_current (uint64_t index, Detection smoothed)
 Set the current track position. More...
 
void set_acceleration (uint64_t index, double acceleration)
 Set the current acceleration. More...
 
void set_nInactive (uint64_t index, uint64_t n)
 Set the current inactivity. More...
 
uint64_t get_nState (std::string state)
 Get number of tracks with specified state. More...
 
uint64_t get_n ()
 Get number of total tracks. More...
 
Detection get_current (uint64_t index)
 Get current track position for track index. More...
 
double get_acceleration (uint64_t index)
 Get current acceleration for track index. More...
 
std::string get_state (uint64_t index)
 Get current state for track index. More...
 
uint64_t get_nInactive (uint64_t index)
 Get number of updates track has been tentative/coasting. More...
 
void update (uint64_t index, Detection update)
 Update an associated detection. More...
 
uint64_t add (Detection initial)
 Add track to the track set. More...
 
void promote (uint64_t index, uint32_t m, uint32_t n)
 Promote track to state ACTIVE if applicable. More...
 
void remove (uint64_t index)
 Remove track based on index. More...
 
std::string to_json (uint64_t timestamp)
 Generate JSON of the map and metadata. More...
 
bool save (std::string json, std::string path)
 Append the map to a save file. More...
 

Private Attributes

std::vector< std::string > id
 Track ID (4 digit alpha-numeric). More...
 
std::vector< std::vector< std::string > > state
 State history for each track. More...
 
std::vector< Detectioncurrent
 Curent track position. More...
 
std::vector< double > acceleration
 Current acceleration (Hz/s). More...
 
std::vector< std::vector< Detection > > associated
 Associated detections in track. More...
 
std::vector< uint64_t > nInactive
 Number of updates the track has been tentative/coasting. More...
 
uint64_t iNext
 Next valid track index. More...
 

Static Private Attributes

static const uint64_t MAX_INDEX = 65535
 Maximum integer index to wrap around. More...
 
static const std::string STATE_ACTIVE = "ACTIVE"
 String for state ACTIVE. More...
 
static const std::string STATE_TENTATIVE = "TENTATIVE"
 String for state TENTATIVE. More...
 
static const std::string STATE_COASTING = "COASTING"
 String for state COASTING. More...
 
static const std::string STATE_ASSOCIATED = "ASSOCIATED"
 String for state ASSOCIATED. More...
 

Detailed Description

A class to store track data.

The ID is 4 digit hexadecimal with 16^4 = 65536 combinations.

The state can be TENTATIVE, ASSOCIATED, ACTIVE or COASTING.

  • TENTATIVE when a track is initialised.
  • TENTATIVE when an ASSOCIATED track fails to associate.
  • ASSOCIATED when a TENTATIVE track has an associated detection.
  • ACTIVE when track passes the promotion threshold.
  • COASTING when an ACTIVE track fails to associate.

Current track is used for smoothing output.

Author
30hours
Todo:
I feel promote() should be implemented in the tracker.

Constructor & Destructor Documentation

◆ Track()

Track::Track ( )

Constructor.

Returns
The object.

◆ ~Track()

Track::~Track ( )

Destructor.

Returns
Void.

Member Function Documentation

◆ add()

uint64_t Track::add ( Detection  initial)

Add track to the track set.

Parameters
initialInitial Detection.

ID is incremented automatically.

Initial state is always TENTATIVE.

Returns
Index of last track.

◆ get_acceleration()

double Track::get_acceleration ( uint64_t  index)

Get current acceleration for track index.

Returns
Current acceleration (Hz/s).

◆ get_current()

Detection Track::get_current ( uint64_t  index)

Get current track position for track index.

Returns
Current detection.

◆ get_n()

uint64_t Track::get_n ( )

Get number of total tracks.

Returns
Number of total tracks.

◆ get_nInactive()

uint64_t Track::get_nInactive ( uint64_t  index)

Get number of updates track has been tentative/coasting.

Returns
Number of updates track has been tentative/coasting.

◆ get_nState()

uint64_t Track::get_nState ( std::string  state)

Get number of tracks with specified state.

Parameters
stateState to check.
Returns
Number of tracks with specified state.

◆ get_state()

std::string Track::get_state ( uint64_t  index)

Get current state for track index.

Returns
Current state.

◆ promote()

void Track::promote ( uint64_t  index,
uint32_t  m,
uint32_t  n 
)

Promote track to state ACTIVE if applicable.

Uses M of N rule for ACTIVE tracks.

Parameters
indexIndex of track to change.
Returns
Void.

◆ remove()

void Track::remove ( uint64_t  index)

Remove track based on index.

Parameters
indexIndex of track to remove.
Returns
Void.

◆ save()

bool Track::save ( std::string  json,
std::string  path 
)

Append the map to a save file.

Parameters
jsonJSON string of map and metadata.
pathPath of file to save.
Returns
True is save is successful.

◆ set_acceleration()

void Track::set_acceleration ( uint64_t  index,
double  acceleration 
)

Set the current acceleration.

Parameters
indexIndex of track to change.
accelerationUpdated acceleration.
Returns
Void.

◆ set_current()

void Track::set_current ( uint64_t  index,
Detection  smoothed 
)

Set the current track position.

Use to update smoothed current position.

Parameters
indexIndex of track to change.
smoothedUpdated state.
Returns
Void.

◆ set_nInactive()

void Track::set_nInactive ( uint64_t  index,
uint64_t  n 
)

Set the current inactivity.

Parameters
indexIndex of track to change.
nUpdated inactivity index.
Returns
Void.

◆ set_state()

void Track::set_state ( uint64_t  index,
std::string  state 
)

Set the state of the latest tracklet.

Parameters
indexIndex of track to change.
stateUpdated state.
Returns
Void.

◆ to_json()

std::string Track::to_json ( uint64_t  timestamp)

Generate JSON of the map and metadata.

Parameters
timestampCurrent time (POSIX ms).
Returns
JSON string.

◆ uint2hex()

std::string Track::uint2hex ( uint64_t  number)

Convert an unsigned int to hexadecimal.

Max number is 16^4 = 65536 before wrap around.

Parameters
numberNumber to convert to hexadecimal.
Returns
hex Hexadecimal number.

◆ update()

void Track::update ( uint64_t  index,
Detection  update 
)

Update an associated detection.

Parameters
indexIndex of track to change.
updateNew associated detection.
Returns
Void.

Member Data Documentation

◆ acceleration

std::vector<double> Track::acceleration
private

Current acceleration (Hz/s).

◆ associated

std::vector<std::vector<Detection> > Track::associated
private

Associated detections in track.

◆ current

std::vector<Detection> Track::current
private

Curent track position.

◆ id

std::vector<std::string> Track::id
private

Track ID (4 digit alpha-numeric).

◆ iNext

uint64_t Track::iNext
private

Next valid track index.

◆ MAX_INDEX

const uint64_t Track::MAX_INDEX = 65535
staticprivate

Maximum integer index to wrap around.

◆ nInactive

std::vector<uint64_t> Track::nInactive
private

Number of updates the track has been tentative/coasting.

Forms criteria for track deletion.

◆ state

std::vector<std::vector<std::string> > Track::state
private

State history for each track.

◆ STATE_ACTIVE

const std::string Track::STATE_ACTIVE = "ACTIVE"
staticprivate

String for state ACTIVE.

◆ STATE_ASSOCIATED

const std::string Track::STATE_ASSOCIATED = "ASSOCIATED"
staticprivate

String for state ASSOCIATED.

◆ STATE_COASTING

const std::string Track::STATE_COASTING = "COASTING"
staticprivate

String for state COASTING.

◆ STATE_TENTATIVE

const std::string Track::STATE_TENTATIVE = "TENTATIVE"
staticprivate

String for state TENTATIVE.


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