PlayerClock initial implementation - Player functionally unchanged#689
PlayerClock initial implementation - Player functionally unchanged#689emersonknapp merged 11 commits intomasterfrom
Conversation
ef47e0e to
06398ad
Compare
06398ad to
3049f1a
Compare
6fe7642 to
c5a0c06
Compare
|
Cross-platform sanity check Gist: https://gist.githubusercontent.com/emersonknapp/56fa49315468fd07d734740da7975b4a/raw/b85678a7e3040cb2fef7dbccb3e6133c1431ee56/ros2.repos Note: |
261fd11 to
f06836e
Compare
jikawa-az
left a comment
There was a problem hiding this comment.
Thanks for the documentation, diagrams, and test cases!
f06836e to
bc24c53
Compare
|
Gist: https://gist.githubusercontent.com/emersonknapp/6fb38f4384ee9db70d518f601711591a/raw/e3aa6275de0ca40c21d1a6860083e814c486933c/ros2.repos |
david-prody
left a comment
There was a problem hiding this comment.
API looks good. my main question is how scenerio 3 from the design would be set up using this class.
da412e2 to
5e1012c
Compare
Create new PlayerClock class with `now()`, `sleep_until()`, and rate handling, with tests. Removes time handling from `Player` in favor of using this new class. Signed-off-by: Emerson Knapp <eknapp@amazon.com>
Signed-off-by: Emerson Knapp <eknapp@amazon.com>
Signed-off-by: Emerson Knapp <eknapp@amazon.com>
…lper functions to match design Signed-off-by: Emerson Knapp <eknapp@amazon.com>
…nts to clock setup and move some logic out into helper function Signed-off-by: Emerson Knapp <eknapp@amazon.com>
…implement - makes it obvious how SimTimeClock will be implemented Signed-off-by: Emerson Knapp <eknapp@amazon.com>
Signed-off-by: Emerson Knapp <eknapp@amazon.com>
5e1012c to
20f37f3
Compare
Signed-off-by: Emerson Knapp <eknapp@amazon.com>
05e2252 to
3173b87
Compare
…nings Signed-off-by: Emerson Knapp <eknapp@amazon.com>
Karsten1987
left a comment
There was a problem hiding this comment.
Generally lgtm, but I am finding the typedefs a bit wild. I'd actually stick to their original types if we don't plan on evolving them further into their own structs.
rosbag2_storage/include/rosbag2_storage/serialized_bag_message.hpp
Outdated
Show resolved
Hide resolved
550d432 to
08e530d
Compare
* Remove time point typedefs in favor of using the types directly. * Use condition_variable for waiting * Minor formatting updates Signed-off-by: Emerson Knapp <eknapp@amazon.com>
08e530d to
daadf5b
Compare
|
@Karsten1987 thanks for the feedback - I think it put a nice finishing touch on this diff. Now, fingers crossed for a green result :) |
Signed-off-by: Emerson Knapp <eknapp@amazon.com>
|
Fixed float->double conversion warning ^ Green - cmake warning is eclipse-cyclonedds/cyclonedds#741 |
| return reference.steady + std::chrono::nanoseconds(diff_nanos); | ||
| } | ||
|
|
||
| std::mutex mutex; |
There was a problem hiding this comment.
It is bad practice to use names reserved in C++. It would be more safe if rename variable mutex .
Maybe ref_rate_mutex or time_control_mutex ?
|
|
||
| std::mutex mutex; | ||
| std::condition_variable cv; | ||
| PlayerClock::NowFunction now_fn RCPPUTILS_TSA_GUARDED_BY(mutex); |
There was a problem hiding this comment.
If I am understand correctly we are going to assign now_fn only in constructor. In this case strict requirement to lock mutex is extra and not required.
| return std::chrono::duration_cast<std::chrono::nanoseconds>(duration).count(); | ||
| } | ||
|
|
||
| rcutils_time_point_value_t steady_to_ros(std::chrono::steady_clock::time_point steady_time) |
There was a problem hiding this comment.
@emersonknapp It would be nice to add REQUIRES(mutex) attribute to steady_to_ros function.
https://clang.llvm.org/docs/ThreadSafetyAnalysis.html#getting-started
However I am not sure if it possible to do with rclcpp abstraction layer.
| } | ||
|
|
||
| std::chrono::steady_clock::time_point ros_to_steady(rcutils_time_point_value_t ros_time) | ||
| { |
There was a problem hiding this comment.
Similar. It would be nice to add REQUIRES(mutex) attribute to ros_to_steady function.
…os2#689) * Initial PlayerClock integration - functionality unchanged * Create PlayerClock, a pure virtual interface with `now()`, and `sleep_until()` for Player to use to control timing of message playback * TimeControllerClock implementation of PlayerClock * Removes time handling from `Player` in favor of using this new class Signed-off-by: Emerson Knapp <eknapp@amazon.com>
…os2#689) * Initial PlayerClock integration - functionality unchanged * Create PlayerClock, a pure virtual interface with `now()`, and `sleep_until()` for Player to use to control timing of message playback * TimeControllerClock implementation of PlayerClock * Removes time handling from `Player` in favor of using this new class Signed-off-by: Emerson Knapp <eknapp@amazon.com>
* Design for rosbag2 handling of clock/simtime (ros2#675) * Add a design dock for rosbag2 handling of clock/simtime Signed-off-by: Emerson Knapp <eknapp@amazon.com> * PlayerClock initial implementation - Player functionally unchanged (ros2#689) * Initial PlayerClock integration - functionality unchanged * Create PlayerClock, a pure virtual interface with `now()`, and `sleep_until()` for Player to use to control timing of message playback * TimeControllerClock implementation of PlayerClock * Removes time handling from `Player` in favor of using this new class Signed-off-by: Emerson Knapp <eknapp@amazon.com> * /clock publisher in Player (ros2#695) * Add /clock publishing to Player Signed-off-by: Emerson Knapp <eknapp@amazon.com> * fix for foxy abi Signed-off-by: mitsudome-r <ryohsuke.mitsudome@tier4.jp> * fix bug Signed-off-by: mitsudome-r <ryohsuke.mitsudome@tier4.jp> Co-authored-by: Emerson Knapp <537409+emersonknapp@users.noreply.github.com>
Related Issues
Description
PlayerClockwithnow()andsleep_until()with simple rate handling.Playerin favor of configuring and usingPlayerClock