Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify recording time for a ros2 bag #1857

Open
paoloelle opened this issue Nov 15, 2024 · 4 comments · May be fixed by #1896
Open

Specify recording time for a ros2 bag #1857

paoloelle opened this issue Nov 15, 2024 · 4 comments · May be fixed by #1896
Labels
backlog Not assigned and not immediately planned enhancement New feature or request help wanted Extra attention is needed

Comments

@paoloelle
Copy link

Description

I would like to have a flag that allows to specify the time length of a record of a ros2 bag.

Related Issues

I cannot specify the time length when I want to record a bag file. I need it since I will run the record from a bash file and the command timeout 10 ros2 bag record /topic_name doesn't work. If I run the same command directly from the terminal works.

Completion Criteria

  • have a flag that allow to specify the recording lenght
@paoloelle paoloelle added the enhancement New feature or request label Nov 15, 2024
@paoloelle
Copy link
Author

paoloelle commented Nov 15, 2024

An alternative solution that I found is by storing the PID:

ros2 bag record /topic_name
BAG_PID=$!
sleep time_length
kill $BAG_PID

@MichaelOrlov MichaelOrlov added help wanted Extra attention is needed backlog Not assigned and not immediately planned labels Nov 17, 2024
@nicolaloi nicolaloi linked a pull request Jan 13, 2025 that will close this issue
@MichaelOrlov
Copy link
Contributor

@paoloelle, @nicolaloi Could you please provide a real-world use cases/examples when this functionality with requested new --max-recording-duration, --max-recording-size and --max-recording-messages CLI options would be usefull?

@MichaelOrlov
Copy link
Contributor

Why one would need to record for some time and then automatically stop at the first hand?

Why not send SIG_INT or use a service call to stop recording when needed as
ros2 service call /rosbag2_recorder/stop rosbag2_interfaces/Stop ?

@paoloelle
Copy link
Author

paoloelle commented Jan 30, 2025

@MichaelOrlov I'm running an evolutionary algorithm using ROS 2 and Gazebo. In my setup, I need to run a huge amount of simulations (each of them lasts 1 minute) and be able to stop/resume a simulation, change some parameters, and record the data for each single run (using ros2 bag). I do that in an automated way by using a bash file. I thought that having an option that allows me to specify the duration of my recording instead of having to explicitly kill the process would be a more practical way to stop the recording. Also, my idea is to run these simulations on a computing cluster, and I’m not sure I will have the privileges to kill processes at will.

Why one would need to record for some time and then automatically stop at the first hand?

Why not send SIG_INT or use a service call to stop recording when needed as ros2 service call /rosbag2_recorder/stop rosbag2_interfaces/Stop ?

Does this service already exist? Sorry, but I didn't know about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Not assigned and not immediately planned enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants