ros-drivers / video_stream_opencv

A package to open video streams and publish them in ROS using the opencv videocapture mechanism
227 stars 159 forks source link

Deal better with looping on a video file and the start and stop frame selection #67

Closed awesomebytes closed 3 years ago

awesomebytes commented 4 years ago

Based on this issue: #61

And this PR: #65

I've used the approach from @martiege. I tried to have a flag to mark if the dynamic_reconfigure server needed to be updated, and the call updateConfig with the new configuration, but this didn't work (the updateConfig never actually calls the dynamic_reconfigure server to update itself).

I've also added some extra logging to try to make a bit clearer what is happening when a user plays with the start_frame and stop_frame parameters.

I've increased the dynamic_reconfigure levels of changing start_frame and stop_frame to force re-subscribing as in the subscription point in the code we have the checks for the frame count. I couldn't move these checks to the dynamic_reconfigure call because we don't have a way to know the amount of frames up until we've opened the video file to call that API. Changing this would imply more changes than I'm comfortable making right now without adding a lot of unit tests (that we should have).

awesomebytes commented 4 years ago

P.S.: sorry about the second commit, please squash them together when merging (if you find this approach makes sense to you).