forked from microsoft/AirSim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in how timeout happens while monitoring HIL and SITL communic…
…ations. Add diagram explaining how AirSim is loaded and initialized in Unreal.
- Loading branch information
1 parent
dbf901e
commit 9998b74
Showing
6 changed files
with
75 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef CommonUtils_Timer_hpp | ||
#define CommonUtils_Timer_hpp | ||
#include <chrono> | ||
|
||
namespace common_utils { | ||
class Timer { | ||
public: | ||
Timer() { | ||
started_ = false; | ||
} | ||
void start() { | ||
started_ = true; | ||
start_ = now(); | ||
} | ||
void stop() { | ||
started_ = false; | ||
end_ = now(); | ||
} | ||
double seconds() { | ||
return static_cast<double>(end() - start_) / 1000000.0; | ||
} | ||
double milliseconds() { | ||
return static_cast<double>(end() - start_) / 1000.0; | ||
} | ||
double microseconds() { | ||
return static_cast<double>(end() - start_); | ||
} | ||
bool started() { | ||
return started_; | ||
} | ||
private: | ||
int64_t now() { | ||
return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch()).count(); | ||
} | ||
int64_t end() { | ||
if (started_) { | ||
// not stopped yet, so return "elapsed time so far". | ||
end_ = now(); | ||
} | ||
return end_; | ||
} | ||
int64_t start_; | ||
int64_t end_; | ||
bool started_; | ||
}; | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.