ros is not able to find scripts
I'm running Ubuntu 20.04 on a virtual machine using ros2 foxy
After building and trying to run a node, ros comes up with an error saying the file wasn't found
FileNotFoundError: [Errno 2] No such file or directory: '/home/cgartner/Workspaces/NRMC2022/install/nrmc_2022_pkg/lib/nrmc_2022_pkg/camera.py'
However, I tried double checking the file exists there by going to the exact address in the terminal and I found that the file does exist at that location.
Here is the full traceback
cgartner@ubuntu:~/Workspaces/NRMC2022$ ros2 run nrmc_2022_pkg camera.py
Traceback (most recent call last): File "/opt/ros/foxy/bin/ros2", line 11, in <module> load_entry_point('ros2cli==0.9.11', 'console_scripts', 'ros2')() File "/opt/ros/foxy/lib/python3.8/site-packages/ros2cli/cli.py", line 67, in main rc = extension.main(parser=parser, args=args) File "/opt/ros/foxy/lib/python3.8/site-packages/ros2run/command/run.py", line 70, in main return run_executable(path=path, argv=args.argv, prefix=prefix) File "/opt/ros/foxy/lib/python3.8/site-packages/ros2run/api/__init__.py", line 61, in run_executable process = subprocess.Popen(cmd) File "/usr/lib/python3.8/subprocess.py", line 858, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: '/home/cgartner/Workspaces/NRMC2022/install/nrmc_2022_pkg/lib/nrmc_2022_pkg/camera.py'
CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(nrmc_2022_pkg)
# Default to C99
if(NOT CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 99)
endif()
# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# find dependencies
find_package(ament_cmake REQUIRED)
find_package(ament_cmake_python REQUIRED)
find_package(rclpy REQUIRED)
find_package(rosidl_default_generators REQUIRED)
ament_python_install_package(scripts/)
# Custom ros msgs here
set(msgs
"msg/vision/TwoCameraImage.msg"
)
# # Custom ros services here
# set(serv
# )
rosidl_generate_interfaces(${PROJECT_NAME}
${msgs}
# ${serv}
)
# All node files listed here
set(nodes
scripts/computer_main.py
scripts/processes.py
scripts/subsystems/controller.py
scripts/subsystems/bob/bob.py
scripts/subsystems/drivetrain/drivetrain.py
scripts/subsystems/dump/dump.py
scripts/subsystems/vision/vision.py
scripts/subsystems/vision/camera.py
)
install(PROGRAMS
${nodes}
DESTINATION lib/${PROJECT_NAME}/
)
# # All launch files here
# set(launch_files
# )
# install(DIRECTORY
# ${launch_files}
# DESTINATION share/${PROJECT_NAME}
# )
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
# uncomment the line when a copyright and license is not present in all source files
#set(ament_cmake_copyright_FOUND TRUE)
# the following line skips cpplint (only works in a git repo)
# uncomment the line when this package is not in a git repo
#set(ament_cmake_cpplint_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
endif()
ament_package()
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>nrmc_2022_pkg</name>
<version>0.0.0</version>
<description>TODO: Package description</description>
<maintainer email="cgartner@todo.todo">cgartner</maintainer>
<license>TODO: License declaration</license>
<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>
<build_depend>rosidl_default_generators</build_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
<depend>rclpy</depend>
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<member_of_group>rosidl_interface_packages</member_of_group>
<export> ...