ROS2 always starts wrong node rclpy
I just started to program a new node of my project and tried to start it now and it always starts the wrong node. I have two nodes written in python, the first I wrote works fine, but the second one always starts the first instead of the second. Here my package.xml, setup.py and setup.cfg of the new node (CartpoleView):
package.xml:
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cartpole_view</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="info@luhbots.de">leonard</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclpy</depend>
<depend>custom_msgs</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_python</build_type>
</export>
</package>
setup.py of CartPole node:
from setuptools import setup
package_name = 'cartpole_view'
setup(
name=package_name,
version='0.0.0',
packages=[],
py_modules=[
'scripts.main'
],
install_requires=['setuptools'],
zip_safe=True,
author='user',
author_email="user@todo.todo",
maintainer='user',
maintainer_email="user@todo.todo",
keywords=['ROS', 'ROS2'],
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Topic :: Software Development',
],
description='TODO: Package description.',
license='Apache License, Version 2.0',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'cartpole_view = scripts.main:main'
],
},
)
and setup.cfg of CartPole node:
[develop]
script-dir=$base/lib/cartpole_view
[install]
install-scripts=$base/lib/cartpole_view
And now the same for my other node (which is always started instead of CartPole node):
package.xml:
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>python_learner</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="info@luhbots.de">leonard</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<depend>rclpy</depend>
<depend>custom_msgs</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<export>
<build_type>ament_python</build_type>
</export>
</package>
setup.py:
from setuptools import setup
package_name = 'python_learner'
setup(
name=package_name,
version='0.0.0',
packages=[],
py_modules=[
'scripts.main',
'scripts.gym_interface',
'scripts.test',
'scripts.test_2',
'scripts.double_deep_q_n'
],
install_requires=['setuptools'],
zip_safe=True,
author='user',
author_email="user@todo.todo",
maintainer='user',
maintainer_email="user@todo.todo",
keywords=['ROS', 'ROS2'],
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
'Topic :: Software Development',
],
description='TODO: Package description.',
license='Apache License, Version 2.0',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'python_learner = scripts.main:main'
],
},
)
and setup.cfg:
[develop]
script-dir=$base/lib/python_learner
[install]
install-scripts=$base/lib/python_learner
If I build it using colcon build
the cartpole node is being built, but if I start it with ros2 run cartpole_view cartpole_view
it starts the gym_interface script, which is part of the python_learner
node.... Anybody has any idea why this might be? I can't see anything wrong with the names etc. I tried deleting the install, build and log folders and rebuild the whole project, but still the same.