Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] launch.json for ros package does not pass launchfile arguments to roslaunch #645

Open
philippewarren opened this issue Jan 13, 2022 · 1 comment
Assignees
Labels
bug Something isn't working ROS1

Comments

@philippewarren
Copy link

philippewarren commented Jan 13, 2022

  • Linux: Ubuntu 20.04
  • ROS 1: Noetic
  • VSCode ROS extension: 0.7.0

Version: 1.63.2
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:39:46.686Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Linux x64 5.11.0-46-generic

What is the bug

Same as #513, but using arguments instead of args as mentionned.
Here is my configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "test",
            "type": "ros",
            "request": "launch",
            "target": "${workspaceFolder}/test/thing.launch",
            "arguments": [
                "message:=test2"
            ],
            "preLaunchTask": "make_debug",
        }
    ]
}

Here is my launch file:

<launch>
    <arg name="message" default="test1"/>

    <node name="test" pkg="test_pkg" type="test.py" output="screen">
        <param name="message" type="string" value="$(arg message)"/>
    </node>
</launch>

Simple test node

#! /bin/env python

import rospy
from std_msgs.msg import String


class Thing:
    def __init__(self):
        self.pub = rospy.Publisher('/test_message', String, queue_size=10)
        self.rate = rospy.Rate(10)  # 10hz
        self.message = rospy.get_param("~message", "Hello")

    def run(self):
        while not rospy.is_shutdown():
            self.pub.publish(self.message)
            self.rate.sleep()


if __name__ == '__main__':
    rospy.init_node('test', anonymous=True)
    thing = Thing()
    try:
        thing.run()
    except rospy.ROSInterruptException:
        pass

The test message should then be test2 but it is test1.

Repro steps

  1. Open a ROS package with a launch file with a command line argument
  2. Set up a VSCode launch.json file with this argument
  3. See that the argument is not passed to the launch file

The example files above could be used if added in a simple ROS package, and if the pkg attribute in the launch file was changed to match.

Expected behavior

The arguments in the arguments part of the launch.json should be passed to the launch file.

@philippewarren philippewarren added the bug Something isn't working label Jan 13, 2022
@ooeygui
Copy link
Member

ooeygui commented Jan 13, 2022

Thank you for the bug and the simple repro steps. I'll take a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ROS1
Projects
None yet
Development

No branches or pull requests

2 participants