ms-iot / vscode-ros

Visual Studio Code extension for Robot Operating System (ROS) development
https://marketplace.visualstudio.com/items?itemName=ms-iot.vscode-ros
MIT License
408 stars 95 forks source link

[bug] Remapping is ignored on both ROS1 and ROS2 #1150

Open sandilyasg opened 1 year ago

sandilyasg commented 1 year ago

(Please add appropriate labels)

\<Version of the plugin> v0.8.4

\<Copy the Version information from the Help | About menu> Version: 1.82.2 Commit: abd2f3db4bdb28f9e95536dfa84d8479f1eb312d Date: 2023-09-14T05:51:20.981Z Electron: 25.8.1 ElectronBuildId: 23779380 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Linux x64 5.4.0-150-generic snap

what is the bug

\<current behavior> I get the following error from VS code debugger: "Error from roslaunch: WARN: unrecognized 'remap' tag in tag"

Repro steps

\<how to reproduce the bug. Please attach sample files or github repo if appropriate.>

  1. I have 2 main launch files, one that I launch from the linux terminal, and one via the launch.json in VS Code (both shown below). Launched in VS code: master_rag_simulation.launch: `

`

Launched from terminal: master_rag_sim_terminal.launch:

`

` When I launch this file, particularly the "multi_karto_gtsam_posfilter.launch" file, I get the following error from VS code:

"Error from roslaunch: WARN: unrecognized 'remap' tag in tag"

This is what my multi_karto_gtsam_posfilter.launch file looks like: `

<include file="$(find turtlebot3_slam)/launch/turtlebot3_karto_gtsam.launch">
  <!-- <arg name="output_to_screen" value="log"/> -->
  <arg name="output_to_screen" value="screen"/>
  <arg name="ns" value="tb3_0"/>
  <remap from="/$(arg ns)/scan" to="/$(arg ns)/scan_filtered"/>
</include>
<include file="$(find turtlebot3_slam)/launch/turtlebot3_karto_gtsam.launch">
  <arg name="output_to_screen" value="log"/>
  <arg name="ns" value="tb3_1"/>
  <remap from="/$(arg ns)/scan" to="/$(arg ns)/scan_filtered"/>
</include>
<include file="$(find turtlebot3_slam)/launch/turtlebot3_karto_gtsam.launch">
  <arg name="output_to_screen" value="log"/>
  <arg name="ns" value="tb3_2"/>
  <remap from="/$(arg ns)/scan" to="/$(arg ns)/scan_filtered"/>
</include>

`

expected behavior

\<what you would expect to happen> I expect to see no error or warning, and the debugger steps through breakpoints in the C++ nodes.

additional context

\<any additional information would be helpful for a better understanding> I see that this error originates from tools/roslaunch/src/roslaunch/xmlloader.py, line 583. When I run the launch files from my terminal, they work correctly with no errors.

xoofee commented 1 year ago

I met the same problem with python launch file. Ros extension in VSCODE ignore the remappings in launch.py when start debuging

If run command in terminal, it has no problem

sandilyasg commented 1 year ago

@xoofee what do you mean Python launch file? As in you have a .launch file which includes a python node? Yes if run from the terminal, this remapping problem does not occur. Would be nice to get it to work in VS code ROS extension

xoofee commented 1 year ago

yes, I mean xxx.launch.py file in python format, this is an example

`from launch import LaunchDescription from launch_ros.actions import Node

def generate_launch_description(): return LaunchDescription([ Node( package='ros_test', namespace='', executable='ros_test_node', remappings=[ ('~/input', '/localization/kinematic_state'), ]
), ]) `

However, if I do not use the tilde ~/ in my topic name, just 'input', the VS code ROS extension has no problem for the remap.

sandilyasg commented 1 year ago

@xoofee thanks for your reply. Where do I find this .launch.py file, is it generated for any .launch file that I have or did you specifically create it yourself for use with VSCode ROS extension?

ooeygui commented 10 months ago

Just to confirm -This looks like it repros on both ROS1 and ROS2?