ros2-dotnet / ros2_dotnet

.NET bindings for ROS2
Apache License 2.0
136 stars 54 forks source link

Exposing clock and adding timer features #124

Closed Chootin closed 7 months ago

Chootin commented 8 months ago

This PR exposes the clock to users of rcldotnet, removing the static clock reference and providing one on each node. This is important as later we will need a clock on each node for the purpose of implementing the use_sim_time parameter.

User facing duration objects have been substituded with TimeSpan in order to play nicely with other C# APIs.

rcldotnet_examples/RCLDotnetTalker.cs has been updated to demonstrate the use of the clock and timer features.

I also added RegisterNativeFunction to DllLoadUtils as I grew tired of making mistakes copy-pasting boilerplate code.

hoffmann-stefan commented 8 months ago

Hi @Chootin,

did start the review today, but couldn't finish yet. Trying to understand how this all fits together takes some time. Will try to finish this wednesday, there is a public holiday where I should have move time :)

Chootin commented 8 months ago

@hoffmann-stefan No worries mate. Take your time, I'm in no great hurry.

Chootin commented 7 months ago

I downloaded your branch and tested your improved IDisposable implementation of the JumpHandler using some reflection to simulate the use_sim_time parameter and /clock topic handling. The solution works well and I was unable to get garbage collection to cause any problems. I also tested the disposing of the JumpHandler and didn't have any issues. I have added your commit to this PR. :+1:

Chootin commented 7 months ago

Cheers for your feedback @hoffmann-stefan - it has certainly made my work better!

I'll get on to the next PR soon 👍.