jeguzzi / robomaster_ros

ROS2 for DJI Robomaster EP and S1
https://jeguzzi.github.io/robomaster_ros
MIT License
49 stars 10 forks source link

namespace problem when launch multiple s1.launch #10

Open zhuhaier1992 opened 7 months ago

zhuhaier1992 commented 7 months ago

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 commented 7 months ago

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'.
jeguzzi commented 2 months ago

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}

zhuhaier1992 commented 2 months ago

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:)