ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You're describing subsampling a topic, correct?
If so: I don't believe that is supported right now.
You could post-process your back yourself using the rosbag API. Only keeping 1 out of 3 messages shouldn't be too hard to implement.
2 | No.2 Revision |
You're describing subsampling a topic, correct?
If so: I don't believe that is supported right now.
You could post-process your back yourself using the rosbag API. Only keeping 1 out of 3 messages shouldn't be too hard to implement.
Edit:
Yes, i want to record on an other bag, only 1 out of 3 messages that are published from the original bag. can you tell me more about how can I do it ?
write a Python script that does something like the following:
import rosbag
# opening hard-coded filenames here, but you could obviously make this
# a command line option
with rosbag.Bag('output.bag', 'w') as outbag:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
# drop only messages on 'your_topic'
if topic == "/your_topic":
# here we drop every 2 out of 3 messages
if (count % 3 == 0):
outbag.write(topic, msg)
else:
outbag.write(topic, msg)
I haven't checked this, so it could be that you'd need to tweak this a bit or make some corrections.
3 | No.3 Revision |
You're describing subsampling a topic, correct?
If so: I don't believe that is supported right now.
You could post-process your back yourself using the rosbag API. Only keeping 1 out of 3 messages shouldn't be too hard to implement.
Edit:
Yes, i want to record on an other bag, only 1 out of 3 messages that are published from the original bag. can you tell me more about how can I do it ?
write a Python script that does something like the following:
import rosbag
# opening hard-coded filenames here, but you could obviously make this
# a command line option
with rosbag.Bag('output.bag', 'w') as outbag:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
# drop only messages on 'your_topic'
if topic == "/your_topic":
# here we drop every 2 out of 3 messages
if (count % 3 == 0):
outbag.write(topic, msg)
else:
outbag.write(topic, msg)
I haven't checked this, so it could be that you'd need to tweak this a bit or make some corrections.
4 | No.4 Revision |
You're describing subsampling a topic, correct?
If so: I don't believe that is supported right now.
You could post-process your back yourself using the rosbag API. Only keeping 1 out of 3 messages shouldn't be too hard to implement.
Edit:
Yes, i want to record on an other bag, only 1 out of 3 messages that are published from the original bag. can you tell me more about how can I do it ?
write a Python script that does something like the following:
import rosbag
# opening hard-coded filenames here, but you could obviously make this
# a command line option
with rosbag.Bag('output.bag', 'w') as outbag:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
# drop only messages on 'your_topic'
if topic == "/your_topic":
# here we drop every 2 out of 3 messages
if (count % 3 == 0):
outbag.write(topic, msg)
else:
outbag.write(topic, msg)
This is essentially example 1 combined with example 5.
I haven't checked this, so it could be that you'd need to tweak this a bit or make some corrections.
5 | No.5 Revision |
You're describing subsampling a topic, correct?
If so: I don't believe that is supported right now.
You could post-process your back yourself using the rosbag API. Only keeping 1 out of 3 messages shouldn't be too hard to implement.
Edit:
Yes, i want to record on an other bag, only 1 out of 3 messages that are published from the original bag. can you tell me more about how can I do it ?
write a Python script that does something like the following:
import rosbag
# opening hard-coded filenames here, but you could obviously make this
# a command line option
with rosbag.Bag('output.bag', 'w') as outbag:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
# drop only messages on 'your_topic'
if topic == "/your_topic":
# here we drop every 2 out of 3 messages
if (count % 3 == 0):
outbag.write(topic, msg)
msg, t)
else:
outbag.write(topic, msg)
msg, t)
This is essentially example 1 combined with example 5.
I haven't checked this, so it could be that you'd need to tweak this a bit or make some corrections.
6 | No.6 Revision |
You're describing subsampling a topic, correct?
If so: I don't believe that is supported right now.
You could post-process your back yourself using the rosbag API. Only keeping 1 out of 3 messages shouldn't be too hard to implement.
Edit:
Yes, i want to record on an other bag, only 1 out of 3 messages that are published from the original bag. can you tell me more about how can I do it ?
write a Python script that does something like the following:
import rosbag
# opening hard-coded filenames here, but you could obviously make this
# a command line option
count = 0
with rosbag.Bag('output.bag', 'w') as outbag:
for topic, msg, t in rosbag.Bag('input.bag').read_messages():
# drop only messages on 'your_topic'
if topic == "/your_topic":
# here we drop every 2 out of 3 messages
if (count % 3 == 0):
outbag.write(topic, msg, t)
else:
outbag.write(topic, msg, t)
count += 1
This is essentially example 1 combined with example 5.
I haven't checked this, so it could be that you'd need to tweak this a bit or make some corrections.