ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

ROSTOPIC publish every 1 second a new data

asked 2020-04-26 17:12:17 -0500

Primo gravatar image

Hey all,

I would like to publish a rostopic that countains a certain data every 1 second, and i would like that the data change in every publish. Maybe read from a text file and publish line by line every 1 second or publish the output from a math function ... How can i do that ? I'm only using a cmd like this (rostopic pub my_topic std_msgs/String "hello there") and i can't figure it out, i've being looking for a solution online but couldn't find it. Please help me.

Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-04-27 04:21:25 -0500

gvdhoorn gravatar image

I would like to publish a rostopic that countains a certain data every 1 second [..] I'm only using a cmd like this (rostopic pub my_topic std_msgs/String "hello there")

This is not something rostopic is designed for.

You'll have to write a node for this.

edit flag offensive delete link more
0

answered 2020-04-27 08:45:43 -0500

Thomas D gravatar image

I agree with @gvdhoorn that the best way to do this is probably with a node using a Timer (roscpp, rospy). An alternative is to use ROS GUI as in the ros_control tutorial (look for the section "Use RQT To Send Commands").

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-04-26 17:12:17 -0500

Seen: 531 times

Last updated: Apr 27 '20