Open5
ROS 2のuse_sim_timeはどうなっているのか?

まずアーキテクチャについての公式の情報はここ
基本的なClockの種類として以下が挙げられている
- System Time: システムの時間
- ROS Time: use_sim_time = Trueであれば、Time Sourceからの時間を用いる。それ以外はSystem Time
- Steady Time: C++のsteady_clockと同様

ROS TimeのTime Sourceについて
-
/clock
topicに1つのソースからpublishする - なにもpublishされていない間は時刻が0になる = エラー判定してよい
- 逆行した場合にコールバックが呼ばれる
Custom Time Source
TimeSource
をオーバーライドして実現できる
rclcppにおいて
実装は以下のファイル

rclcppでの扱いを読む
一般的に用いられているのはTimeSource::NodeStateによるclock
のsubscriptionと思われる
use_clock_thread_
興味深いオプション: clockの受信スレッドを分割できる
set_all_clocks
時間の設定関数 -
set_clock
を呼び出す
2.rcl_disable_ros_time_override
かrcl_enable_ros_time_override
で時間を上書きするかどうかを設定する
3.rcl_set_ros_time_override
で上書きする
rcl_ret_t rcl_set_ros_time_override(rcl_clock_t *clock, rcl_time_point_value_t time_value)
This function will update the internal storage for the RCL_ROS_TIME time source. If queried and override enabled the time source will return this value, otherwise it will return the system time.

rclでの扱い
rcl_set_ros_time_overrideはここ
あとで追記する

timerでjump(clock経由の上書きがあればいつでもこれ扱い?)が生じた場合に呼ばれるハンドラ