Skip to content

Instantly share code, notes, and snippets.

Created Jun 16, 2016
What would you like to do?
// The main loop
void loop()
// Initialize previous time
std::chrono::high_resolution_clock::time_point previousTime = std::chrono::high_resolution_clock::now();
// While the program should run and has a connection with ROS
while (!shouldTerminate && io.ok())
// Check whether new data is available and stor the data
if (hasNewData())
// Detect all edges in sight
// Update passed seconds
passedSeconds = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - previousTime).count() / 1000000000.0;
// Execute slam
// Update previous time
previousTime = std::chrono::high_resolution_clock::now();
// Communicate the availability of data to the GUI and the strategy module
// Sleep for 1 microsecond to avoid hogging all processing power
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment