2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2018-05-11 12:38:23 -07:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2020-07-15 23:48:09 -07:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
|
|
#include <hal/HALBase.h>
|
2020-07-16 22:15:59 -07:00
|
|
|
#include <units/time.h>
|
2018-05-11 12:38:23 -07:00
|
|
|
|
2020-12-28 01:19:59 -08:00
|
|
|
namespace frc::sim {
|
2018-08-16 01:17:59 -04:00
|
|
|
|
2021-01-11 21:55:45 -08:00
|
|
|
/**
|
|
|
|
|
* Override the HAL runtime type (simulated/real).
|
|
|
|
|
*
|
|
|
|
|
* @param type runtime type
|
|
|
|
|
*/
|
2020-07-15 23:48:09 -07:00
|
|
|
void SetRuntimeType(HAL_RuntimeType type);
|
2020-06-26 20:46:13 -07:00
|
|
|
|
2020-07-15 23:48:09 -07:00
|
|
|
void WaitForProgramStart();
|
2018-08-16 01:17:59 -04:00
|
|
|
|
2020-07-15 23:48:09 -07:00
|
|
|
void SetProgramStarted();
|
2018-08-16 01:17:59 -04:00
|
|
|
|
2020-07-15 23:48:09 -07:00
|
|
|
bool GetProgramStarted();
|
2018-08-16 01:17:59 -04:00
|
|
|
|
2021-01-11 21:55:45 -08:00
|
|
|
/**
|
|
|
|
|
* Restart the simulator time.
|
|
|
|
|
*/
|
2020-07-15 23:48:09 -07:00
|
|
|
void RestartTiming();
|
2018-08-16 01:17:59 -04:00
|
|
|
|
2021-01-11 21:55:45 -08:00
|
|
|
/**
|
|
|
|
|
* Pause the simulator time.
|
|
|
|
|
*/
|
2020-07-15 23:48:09 -07:00
|
|
|
void PauseTiming();
|
2020-06-20 23:47:55 -07:00
|
|
|
|
2021-01-11 21:55:45 -08:00
|
|
|
/**
|
|
|
|
|
* Resume the simulator time.
|
|
|
|
|
*/
|
2020-07-15 23:48:09 -07:00
|
|
|
void ResumeTiming();
|
2020-06-20 23:47:55 -07:00
|
|
|
|
2021-01-11 21:55:45 -08:00
|
|
|
/**
|
|
|
|
|
* Check if the simulator time is paused.
|
|
|
|
|
*
|
|
|
|
|
* @return true if paused
|
|
|
|
|
*/
|
2020-07-15 23:48:09 -07:00
|
|
|
bool IsTimingPaused();
|
2020-06-20 23:47:55 -07:00
|
|
|
|
2021-01-11 21:55:45 -08:00
|
|
|
/**
|
|
|
|
|
* Advance the simulator time and wait for all notifiers to run.
|
|
|
|
|
*
|
2021-10-29 15:07:05 -07:00
|
|
|
* @param delta the amount to advance (in seconds)
|
2021-01-11 21:55:45 -08:00
|
|
|
*/
|
2020-07-16 22:15:59 -07:00
|
|
|
void StepTiming(units::second_t delta);
|
2020-06-20 23:47:55 -07:00
|
|
|
|
2021-01-11 21:55:45 -08:00
|
|
|
/**
|
|
|
|
|
* Advance the simulator time and return immediately.
|
|
|
|
|
*
|
2021-10-29 15:07:05 -07:00
|
|
|
* @param delta the amount to advance (in seconds)
|
2021-01-11 21:55:45 -08:00
|
|
|
*/
|
2020-09-27 13:27:53 -07:00
|
|
|
void StepTimingAsync(units::second_t delta);
|
|
|
|
|
|
2020-12-28 01:19:59 -08:00
|
|
|
} // namespace frc::sim
|