Cartographer.launch.py Not Found

This is an error report.


Screenshot of the error


Error details

As seen in terminal, it the cartographer.launch.py is not being found in the share directory. I am not sure if it is a simple error on my end, but I have tried rebuilding a couple of times and seeing if there are different solutions but I can't seem to find one.

Hi @mariellarsanchez ,

Welcome to this Community!

Usually building the ROS2 packages from scratch would solve this issue. But I would like to see the contents of the setup.py file in full. I feel that your setup.py file is lacking some extra codes.

First try to re-build from scratch:

cd ~/ros2_ws
rm -rf ./build ./install ./log
colcon build
source install/setup.bash
ros2 launch <package_name> <launch_file_name>

To build from scratch basically means tat you delete the build, install and log folders and build the ROS2 workspace again, simple!

If the above step does not work for you, then please post the full contents of your setup.py file here as a markdown formatted code-block. Refer: Extended Syntax | Markdown Guide

Regards,
Girish

Hi! This is my setup.py


Thanks for your help.

Hi @mariellarsanchez ,

Did you try rebuilding from scratch?

Going through your setup.py file, I don’t find any issues with the file contents. So your setup.py file should work as it is. However, I can suggest one change:
Try replacing the following line in your setup.py file:

packages=find_packages(exclude=['test']),

with the following line:

packages=[package_name],

That could possibly fix your issue, I guess.
But after you do this change, you must rebuild from scratch, by deleting the build, install and log folders from the ros2_ws folder before you do colcon build.

Try this and let me know if that worked for you.

Regards,
Girish

Hello,

Unfortunately I am getting the same issue. I changed the line and rebuilt it from scratch but I can’t seem to get it to work. What else can I try?

Best,
Mariella S.

Hi @mariellarsanchez ,

I think I found out the cause of your problem. It seems to be the setuptools version that is not supported for the version of ROS2 that is running in the course environment.
You need to downgrade the setuptools version to resolve this issue.

Here are the steps to fix the issue:

  1. Downgrade the version of setuptools python package.

    cd ~
    sudo apt update
    python3 -m pip install setuptools==56.2.0
    
  2. Once installed, you can compile your ROS2 packages the normal way after deleting the build, install and log folders (this step is also called building / compiling from scratch):

    cd ~/ros2_ws
    rm -rf ./build ./install ./log
    colcon build && source install/setup.bash
    ros2 launch <package_name> <launch_file_name>
    

After doing the above steps in the exact order indicated, your issue should be resolved.
You should then be able to launch and run cartographer.

Try these above steps and let me know if that solved your problem.

Regards,
Girish

Hello again,

Unfortunately, I just tried it and it did not resolve the issue.
I am not sure if that is related to this when I try to use

sudo apt update

otherwise I still have the same problem. :frowning_face:

Best,
Mariella

Hi @mariellarsanchez ,

I had the same output as you have.

You need to issue the commands one by one, no all together. I am aware that I have grouped two sets of commands, but they need to be executed one-by-one.

Please try executing them separately (within the same terminal, not in different terminals), and then let me know.

I saw the same exact output that you have shown me in the picture, so I can assure you that issuing the commands one after another will work.

Please try and let me know!

Regards,
Girish

Hello @girishkumar.kannan ,

I am still getting the same issue, I followed the instructions and did each line of command separately, but again same exact issue.

Best,
Mariella

Hi @mariellarsanchez ,

I was able to replicate your exact issue, yet I was able to solve it with the solution that I mentioned in my last response. It is weird that the solution is not effective in your case.

I am tagging two admins here: @albertoezquerro and @duckfrost2 ,
One of them should be able to help you with your issue by checking your course environment setup and your course files.

You should have your issue fixed in about 1 day.

In the meantime, try this:

  1. Open the course environment (freshly) and immediately install setuptools using the python ... command line mentioned in my previous post.
    python3 -m pip install setuptools==56.2.0
    
  2. Delete your cartographer_slam package.
    cd ~/ros2_ws/src
    rm -rf ./cartographer_slam
    
  3. Create the package again:
    cd ~/ros2_ws/src
    ros2 pkg create cartographer_slam --build-type ament_python --dependencies rclpy
    cd cartographer_slam
    mkdir launch config
    touch ./config/cartographer.lua
    touch ./launch/cartographer.launch.py
    
  4. Add the necessary contents to the launch file, config file and setup.py files.
  5. Finally, rebuild your ROS2 workspace from scratch and try launching cartographer.

Let me / us know if the above steps worked for you. If it did not then one of the admins would be able to assist you better.

Regards,
Girish

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.