Galaxis Codebase  1.0.0
Team Galaxis software stack for the Carolo Cup 2023 - ROS2 based software
galaxis::utils::MicroStopwatch Class Reference

#include <clock.hpp>

Public Member Functions

 MicroStopwatch ()
 
void start ()
 
long long get () const
 
long long get_time () const
 
long long get_milliseconds () const
 
void restart ()
 

Private Attributes

long long time = -1
 

Detailed Description

Definition at line 10 of file clock.hpp.

Constructor & Destructor Documentation

◆ MicroStopwatch()

MicroStopwatch::MicroStopwatch ( )

Definition at line 21 of file clock.cpp.

21  {
22  start();
23 }

References start().

Here is the call graph for this function:

Member Function Documentation

◆ get()

long long MicroStopwatch::get ( ) const

Definition at line 29 of file clock.cpp.

29  {
30  return get_time_now_us() - time;
31 }

References galaxis::utils::get_time_now_us(), and time.

Referenced by get_milliseconds(), and get_time().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_milliseconds()

long long MicroStopwatch::get_milliseconds ( ) const

Definition at line 37 of file clock.cpp.

37  {
38  return get() / 1000;
39 }

References get().

Referenced by StopLineDetection::detect_startline(), StopLineDetection::on_stop_line_detection_callback(), and AutoPilotNode::send_full_map_debug_image().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_time()

long long MicroStopwatch::get_time ( ) const

Definition at line 33 of file clock.cpp.

33  {
34  return get();
35 }

References get().

Referenced by galaxis::control::TwoAndAHalfCarrots::calculate_best_yaw_rate(), AutoPilotNode::controller_reference_publish_loop(), AutoPilotNode::debug_publish_loop(), AutoPilotNode::on_vci_lane_detection_callback(), and AutoPilotNode::send_controller_references().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restart()

void MicroStopwatch::restart ( )

Definition at line 41 of file clock.cpp.

41  {
42  start();
43 }

References start().

Here is the call graph for this function:

◆ start()

void MicroStopwatch::start ( )

Definition at line 25 of file clock.cpp.

25  {
27 }

References galaxis::utils::get_time_now_us(), and time.

Referenced by galaxis::control::TwoAndAHalfCarrots::calculate_best_yaw_rate(), MicroStopwatch(), and restart().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ time

long long galaxis::utils::MicroStopwatch::time = -1
private

Definition at line 12 of file clock.hpp.

Referenced by get(), and start().


The documentation for this class was generated from the following files:
galaxis::utils::get_time_now_us
long long get_time_now_us()
Definition: clock.cpp:13
galaxis::utils::MicroStopwatch::start
void start()
Definition: clock.cpp:25
galaxis::utils::MicroStopwatch::time
long long time
Definition: clock.hpp:12
galaxis::utils::MicroStopwatch::get
long long get() const
Definition: clock.cpp:29