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

Application with two publishers with the same name

asked 2021-10-20 21:19:36 -0500

Otavio gravatar image

updated 2021-10-20 21:24:07 -0500

Setup:

  • PC: ros2 foxy
  • Arduino due: micro-ros arduino

Problem description:

I'm trying to control my robot via keyboard. For this I'm using a link. As I understand it, teleop_twist_keyboard creates an editor called "cmd_vel":

pub = node.create_publisher(geometry_msgs.msg.Twist, 'cmd_vel', 10)

On the other hand, in my arduino Due, I also create an editor called "cmd_vel", with the command:

RCCHECK(rclc_node_init_default(&cmd_vel, "vel_test", "", &support));

The application seems to be working fine, but there's something I don't understand. The following image demonstrates the order of execution:

image description

Through it you can see that first I run the teleop_twist_keyboard and then the micro ros agent on my PC. In this order, an editor is created with the name "cmd_vel" by teleop_twist_keyboard and then an editor with the same name is created by arduino Due.

In this context, my question is: when I create an editor with the same name as an existing one, does the first one disappear to make room for the second one? What happens from behind? Am I really creating two or just taking advantage of what was defined first?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-10-21 00:28:56 -0500

Pablogs gravatar image

If you create multiple publishers and subscribers on the same topic, ros2 topic list will show the topic once.

If you need to introspect the entities that are using a topic use ros2 topic info /cmd_vel -v you should have at least 2 entities: the keyboard teleop publisher and your Arduino Due subscriber.

BTW, what is an editor in a ROS 2 context?

edit flag offensive delete link more

Comments

Sorry, I think I confused some concepts. One was that I was believing an editor was a node, but actually an editor (publisher) is "inside" a node.

Anyway, I reviewed some concepts and managed to understand. Also because when I run ros2 topic info / cmd_vel -v, as you had suggested, I get the expected result (two entities)

Otavio gravatar image Otavio  ( 2021-11-02 19:46:33 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-10-20 21:19:36 -0500

Seen: 201 times

Last updated: Oct 21 '21