robomaster_ros icon indicating copy to clipboard operation
robomaster_ros copied to clipboard

namespace problem when launch multiple s1.launch

Open zhuhaier1992 opened this issue 2 years ago • 3 comments

Hi Jerome, I have been learning and using ROS2 recently, and this repo is really helpful. It allows multiple control of robomaster, combined with ROS2 which makes coding much easier, thanks a lot! When I use it to control three S1, the namespace become strange. I simply set each serial number and their respective name to RM4, RM5, RM6. But the namespace become:

/RM4
/RM4/RM5
/RM4/RM5/RM6

Which is strange, because when I do the same thing to three EP, the namespace is normal:

/RM1
/RM2
/RM3

zhuhaier1992 avatar Dec 15 '23 08:12 zhuhaier1992

By the way, I used a launch file to launch multiple launches, I don't know if this could be the problem. The launch file startup.launch.py is as follows:

from launch_ros.substitutions import FindPackageShare
from launch import LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_xml.launch_description_sources import XMLLaunchDescriptionSource

from launch_ros.actions import Node
from launch.substitutions import PathJoinSubstitution, TextSubstitution

def generate_launch_description():

    return LaunchDescription([
        IncludeLaunchDescription(
            XMLLaunchDescriptionSource([
                PathJoinSubstitution([
                    FindPackageShare('robomaster_ros'),
                    'launch',
                    'ep.launch'
                ])
            ]),
            launch_arguments={
                'name': 'RM1',
                'serial_number': '3JKDH2T00159G8',
            }.items()
        ),
        IncludeLaunchDescription(
            XMLLaunchDescriptionSource([
                PathJoinSubstitution([
                    FindPackageShare('robomaster_ros'),
                    'launch',
                    'ep.launch'
                ])
            ]),
            launch_arguments={
                'name': 'RM2',
                'serial_number': '3JKCJC400302GS',
            }.items()
        ),
        IncludeLaunchDescription(
            XMLLaunchDescriptionSource([
                PathJoinSubstitution([
                    FindPackageShare('robomaster_ros'),
                    'launch',
                    'ep.launch'
                ])
            ]),
            launch_arguments={
                'name': 'RM3',
                'serial_number': '3JKCJC400301ZP',
            }.items()
        ),
    ])
'''
The launch file for S1 simply replace 'ep.launch' to 's1.launch'.

zhuhaier1992 avatar Dec 15 '23 08:12 zhuhaier1992

Hi @zhuhaier1992, sorry for the delay.

I corrected the s1.launch. The problem was caused by me pushing a namespace outside of a group. Btw, {ep|s1}.launch are deprecated. Better to use main.launch model:={ep|s1}

jeguzzi avatar Apr 25 '24 08:04 jeguzzi

Hi @zhuhaier1992, sorry for the delay.

I corrected the s1.launch. The problem was caused by me pushing a namespace outside of a group. Btw, {ep|s1}.launch are deprecated. Better to use main.launch model:={ep|s1}

No problem, much thanks again. I was worried if you are ok during this period, I'm really glad you are back:)

zhuhaier1992 avatar Apr 26 '24 02:04 zhuhaier1992