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

spawner/unspawner cannot be run directly on windows #605

Closed
wmmc88 opened this issue Jan 5, 2022 · 0 comments · Fixed by #607
Closed

spawner/unspawner cannot be run directly on windows #605

wmmc88 opened this issue Jan 5, 2022 · 0 comments · Fixed by #607
Labels

Comments

@wmmc88
Copy link
Contributor

wmmc88 commented Jan 5, 2022

Describe the bug
The spawner executable in the controller_manager package cannot be run on windows.

To Reproduce
Several related issues:

Using spawner.py works but you get a deprecation warning:

❯ ros2 run controller_manager spawner.py joint_state_broadcaster --controller-manager /controller_manager
C:\Users\melvi\git-repos\ros2_upstream_ws\install\lib\controller_manager\spawner.py:204: DeprecationWarning: 'spawner.py' is deprecated, please use 'spawner' (without .py extension)
  warnings.warn(

Using spawner directly results in a conflict in ros2run:

❯ ros2 run controller_manager spawner joint_state_broadcaster --controller-manager /controller_manager
Multiple executables found:
- C:\Users\melvi\git-repos\ros2_upstream_ws\install\lib\controller_manager\spawner
- C:\Users\melvi\git-repos\ros2_upstream_ws\install\lib\controller_manager\spawner.py

launching spawner from ros2launch using the following snippet fails:

joint_state_broadcaster_spawner := Node(
        package="controller_manager",
        executable="spawner",
        arguments=["joint_state_broadcaster", "--controller-manager", "/controller_manager"],
    )
[ERROR] [spawner.PY-3]: exception occurred while executing process:
Traceback (most recent call last):
  File "C:\dev\ros2_rolling\install\Lib\site-packages\launch\actions\execute_local.py", line 540, in __execute_process
    transport, self._subprocess_protocol = await async_execute_process(
  File "C:\dev\ros2_rolling\install\Lib\site-packages\osrf_pycommon\process_utils\async_execute_process_asyncio\impl.py", line 139, in async_execute_process
    transport, protocol = await _async_execute_process_nopty(
  File "C:\dev\ros2_rolling\install\Lib\site-packages\osrf_pycommon\process_utils\async_execute_process_asyncio\impl.py", line 45, in _async_execute_process_nopty
    transport, protocol = await loop.subprocess_exec(
  File "C:\python38\lib\asyncio\base_events.py", line 1630, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "C:\python38\lib\asyncio\windows_events.py", line 389, in _make_subprocess_transport
    transp = _WindowsSubprocessTransport(self, protocol, args, shell,
  File "C:\python38\lib\asyncio\base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "C:\python38\lib\asyncio\windows_events.py", line 885, in _start
    self._proc = windows_utils.Popen(
  File "C:\python38\lib\asyncio\windows_utils.py", line 153, in __init__
    super().__init__(args, stdin=stdin_rfd, stdout=stdout_wfd,
  File "C:\python38\lib\subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\python38\lib\subprocess.py", line 1311, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
OSError: [WinError 193] %1 is not a valid Win32 application

Expected behavior
Spawner is launcher without errors or warnings

Environment (please complete the following information):

  • OS: Windows
  • Version: master
  • Anything that may be unusual about your environment

Additional context
The issue looks like its because the spawner script is using a shebang which isn't properly supported in windows. If the desired behaviour is to be able to use spawner instead of the deprecated spawner.py, the script should be installed as a console_script using ament_python_install_package. Changes needed to do this would be similar to ros/xacro#304

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant