Application with two publishers with the same name
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:
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?