Ask Your Question
5

Publish to topic via launch file

asked 2016-03-29 16:37:22 -0600

Borob gravatar image

Is it possible to publish to a topic with a custom message type from within a launch file?

In a launch-file I launch several robots from external packages which I want to register to my running platform as they are launched.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
11

answered 2016-03-29 19:25:56 -0600

ahendrix gravatar image

You can run rostopic pub from within a launch file with:

<node pkg="rostopic" type="rostopic" name="rostopic" args="pub {pub args}"/>

where {pub args} are the arguments to rostopic pub to make it publish the way you want it to.

You may also want to change name="rostopic" to something specific to each robot, if there will be multiple copies of this running with the same ros master.

edit flag offensive delete link more

Comments

Hi, please can you help me,i have project arm robot with ROS in Raspberry, i know how run two arduino same time but i need publish different valor of just each topic , the commade is :

rostopic pub servo4 std_msgs/UInt16 180

<node pkg="rostopic" type="rostopic" name="rostopic" args="pub {pub args}" <="" p="">

How can I use that ? For example, the arm needs the initial position of this arm to be 6 degrees  of liberty. We need to publish six different topics. i thinking this parameters but i don't know if this is true :

pkg = rostopic

type = pub servo4

name = std_msgs/UInt

args = entre 0  to 180

Siphax gravatar image Siphax  ( 2021-11-12 22:58:16 -0600 )edit
0

answered 2021-11-12 22:58:42 -0600

Siphax gravatar image

Hi, please can you help me,i have project arm robot with ROS in Raspberry, i know how run two arduino same time but i need publish different valor of just each topic , the commade is :

rostopic pub servo4 std_msgs/UInt16 180

<node pkg="rostopic" type="rostopic" name="rostopic" args="pub {pub args}" <="" p="">

How can I use that ? For example, the arm needs the initial position of this arm to be 6 degrees  of liberty. We need to publish six different topics. i thinking this parameters but i don't know if this is true :

pkg = rostopic

type = pub servo4

name = std_msgs/UInt

args = entre 0  to 180

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-03-29 16:37:22 -0600

Seen: 4,907 times

Last updated: Mar 29 '16