micro-ROS-Agent icon indicating copy to clipboard operation
micro-ROS-Agent copied to clipboard

A way to set a ROS namespace in the Agent

Open bjsowa opened this issue 3 years ago • 13 comments

I would like to have the ability to set an arbitrary ROS namespace of the node from the computer running the Agent. The way of doing this in ROSSerial is to just run the serial_node under a namespace. In micro-ROS it's a little more problematic because the namespace has to be passed to rclc_node_init_default function, so it has to be retrieved before the ROS communication is initialized.

The way I see it could work is when the Agent could be run with some parameters and the client had functions to retrieve these parameters. Then, I could just define the namespace parameter and retrieve it in the firmware before initializing the node.

bjsowa avatar Mar 21 '22 17:03 bjsowa

The name handling of the micro-ROS nodes is completely handled on the client-side. In fact, the micro-ROS agent does not do any modification on any property of the entities created by the client. I'll take a look at that.

It would be important in your use case that the client knows in which namespace it is being exposed or it is ok if the agent just overrides the client name prepending a namespace?

pablogs9 avatar Mar 22 '22 06:03 pablogs9

ping @bjsowa

pablogs9 avatar May 17 '22 08:05 pablogs9

It's not important that the client knows in which namespace it is running. As long as all names are mapped correctly on the agent side it's ok for me.

bjsowa avatar May 27 '22 12:05 bjsowa

@bjsowa here we have a PoC, could you test it? https://github.com/micro-ROS/micro-ROS-Agent/pull/145

Just do:

ros2 run micro_ros_agent micro_ros_agent serial --dev [DEVICE] -v6 --namespace-remapping /mynamespace

And let us know if this is what you needed.

pablogs9 avatar May 30 '22 10:05 pablogs9

Amy update on this?

pablogs9 avatar Jun 14 '22 05:06 pablogs9

@pablogs9 Any plan on continuing the PoC? The current implementation doesn't seem to work.

Also, do you think it would be possible to implement Domain ID remapping? This is even more important for me than namespace remapping.

bjsowa avatar Aug 26 '22 15:08 bjsowa

No bandwidth to work on this right now. I'll keep this open for the future. If you make some advances do not hesitate to PR your progress.

pablogs9 avatar Sep 05 '22 05:09 pablogs9

I would also like to set up the ROS namespace in the agent instead of in the microcontroller. Has a possible solution been found for this yet? (I want to pass an id from the microros_agent launche file to the microcontroller)

#145 has also not been resolved so far.

Publicano avatar May 09 '23 08:05 Publicano

--namespace-remapping /mynamespace

This is not working for me. I run:

ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/ttyACM0 --namespace-remapping /chori

I also tried:

from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
    return LaunchDescription([
        Node(
            package='micro_ros_agent',
            namespace='chori',
            output='screen',
            executable='micro_ros_agent',
            name='micro_ros_agent',
            arguments=["serial", "--dev", "/dev/ttyACM0"]
        )
    ])

and, nothing, the topics comming from my board are located under / namespace.

elgarbe avatar Dec 20 '23 20:12 elgarbe

I was wondering is there were any news on this. On top of what is mentioned above, I also tried to remap topic to include a namespace, using SetRemap in an ActionGroup or the remapping option in the Node itself, to no avail.

flabrosse avatar Mar 06 '24 15:03 flabrosse