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

ROS2 rviz node -> two robots with different namespaces

asked 2021-06-28 10:19:04 -0500

definitive gravatar image

updated 2021-06-29 09:34:24 -0500

I want to run rviz node with two robots using different namespaces in a single environment. Currently, by providing minor changes in config files, I am able to run robots in two separate GUI windows:

rviz_node_1 = Node(
    namespace="arm_1",
    package="rviz2",
    condition=IfCondition(launch_rviz),
    executable="rviz2",
    name="rviz2_moveit_1",
    output="log",
    arguments=["-d", rviz_config_file],
    parameters=[
        robot_description_1,
        robot_description_semantic_1,
        ompl_planning_pipeline_config_1,
        robot_description_kinematics_1
    ],
)
rviz_node_2 = Node(
    namespace="arm_2",
    package="rviz2",
    condition=IfCondition(launch_rviz),
    executable="rviz2",
    name="rviz2_moveit_2",
    output="log",
    arguments=["-d", rviz_config_file],
    parameters=[
        robot_description_2,
        robot_description_semantic_2,
        ompl_planning_pipeline_config_2,
        robot_description_kinematics_2
    ],
)

In this case, everything works properly. Removing namespaces and pushing all parameter to single node is impossible - arguments have same parameters keys. On the other hand pushing namespace directly in dicts doesn't work, e.g.:

from

robot_description_1 = {"robot_description": robot_description_content_1}
robot_description_2 = {"robot_description": robot_description_content_2}

to

robot_description_rviz = {"arm_1": {"robot_description": robot_description_content_1},
                          "arm_2": {"robot_description": robot_description_content_2}}

MotionPlanning is not able to initialize scene. Of course "Move group namespace" within rviz Display panel is already changed, but it doesn't change anything. How to run rviz node with possibility to run two MotionPlanning visualization in different namespaces?

@edit I don't know why, but it was necessary to change namespace in .rviz config. Doing it by hand using GUI doesn't work. In addition with two remappings I am able to get interactive marker within rviz.

    ("/get_planner_params", "/arm_1/get_planner_params")
    ("/query_planner_interface", "/arm_1/query_planner_interface")

So I guess there is a conflict between rviz node services & actions I/O. Rviz node while running with namespace (NODE_NS_DESC):

/arm_1/rviz2_moveit
  Subscribers:
    /display_planned_path: moveit_msgs/msg/DisplayTrajectory
    /parameter_events: rcl_interfaces/msg/ParameterEvent
    /arm_1/recognized_object_array: object_recognition_msgs/msg/RecognizedObjectArray
    /arm_1/rviz_moveit_motion_planning_display/robot_interaction_interactive_marker_topic/feedback: visualization_msgs/msg/InteractiveMarkerFeedback
  Publishers:
    /clicked_point: geometry_msgs/msg/PointStamped
    /goal_pose: geometry_msgs/msg/PoseStamped
    /initialpose: geometry_msgs/msg/PoseWithCovarianceStamped
    /parameter_events: rcl_interfaces/msg/ParameterEvent
    /arm_1/attached_collision_object: moveit_msgs/msg/AttachedCollisionObject
    /arm_1/planning_scene: moveit_msgs/msg/PlanningScene
    /arm_1/planning_scene_world: moveit_msgs/msg/PlanningSceneWorld
    /arm_1/rviz_moveit_motion_planning_display/robot_interaction_interactive_marker_topic/update: visualization_msgs/msg/InteractiveMarkerUpdate
    /arm_1/trajectory_execution_event: std_msgs/msg/String
    /rosout: rcl_interfaces/msg/Log
  Service Servers:
    /arm_1/rviz2_moveit/describe_parameters: rcl_interfaces/srv/DescribeParameters
    /arm_1/rviz2_moveit/get_parameter_types: rcl_interfaces/srv/GetParameterTypes
    /arm_1/rviz2_moveit/get_parameters: rcl_interfaces/srv/GetParameters
    /arm_1/rviz2_moveit/list_parameters: rcl_interfaces/srv/ListParameters
    /arm_1/rviz2_moveit/set_parameters: rcl_interfaces/srv/SetParameters
    /arm_1/rviz2_moveit/set_parameters_atomically: rcl_interfaces/srv/SetParametersAtomically
    /arm_1/rviz_moveit_motion_planning_display/robot_interaction_interactive_marker_topic/get_interactive_markers: visualization_msgs/srv/GetInteractiveMarkers
  Service Clients:
    /arm_1/clear_octomap: std_srvs/srv/Empty
    /arm_1/compute_cartesian_path: moveit_msgs/srv/GetCartesianPath
    /arm_1/get_planner_params: moveit_msgs/srv/GetPlannerParams
    /arm_1/query_planner_interface: moveit_msgs/srv/QueryPlannerInterfaces
    /arm_1/set_planner_params: moveit_msgs/srv/SetPlannerParams
  Action Servers:

  Action Clients:
    /arm_1/execute_trajectory: moveit_msgs/action/ExecuteTrajectory
    /arm_1/move_action: moveit_msgs/action/MoveGroup

Rviz node without namespace (NODE_DESC) looks similar, except arm_1 occurrence. Remapping all of those stuff mentioned above is pointless and doesn't work - I still need second part of clients, services, pubs and subs for next robot. How to force a single rviz node to run two instances of moveit_rviz_plugin/MotionPlanning class with namespaces around NODE_DESC? Two instances of MotionPlanning with different Move Group Namespace and Name in rviz config is not enough. It seems to overwrite NODE_DESC.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-07-01 07:44:12 -0500

jafar_abdi gravatar image

It's not possible with MoveIt2 because we can't specify the namespace of the move group node when creating a move group interface instance, it should be fixed in https://github.com/ros-planning/movei..., once it's merged this could be marked as solved

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2021-06-28 10:19:04 -0500

Seen: 1,357 times

Last updated: Jul 01 '21