ROS2 rosject part 1 : source issue

hello,

I’ve already spent few hours on this problem so I need help…

i’m stuck after using the teleop program (which works perfectly) when i’m trying to launch mine i’m getting this error:

user:~/ros2_ws$ ros2 launch wall_follower start_wall_following.launch.py
Package ‘wall_follower’ not found: “package ‘wall_follower’ not found, searching: [’/home/simulations/ros2_sims_ws/install/ros1_bridge’, ‘/opt/ros/foxy’]”

I think I messed something with the sources but even restarting the whole environement does nothing.
I point out that the “colcon build” function work correctly and everything seems to be ok if I refer to the ROS2 BASICS course.

Any Idea ? Thanks for your help.

Hi @Riddeen ,

I have not taken ROS2 yet but have completed ROS1. I have experienced the same issue once and that was because I messed some stuff too. So try to check these…

  1. Did you stop teleop program before you started your wall_follower?
  2. Are you sure your program is in the correct directory/folder path?
  3. Is the launch file pointing correctly to the sources?

I hope I was helpful!

Regards,
Girish

hi @girishkumar.kannan,

  1. yes I stoped the teleop program.
  2. Yes (see picture).
    image
    3.my launch file is ok (even the run fuction did not work and it doesn’t need any launch file => “package not found”)

from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description():
return LaunchDescription([
Node(
package=“wall_follower”,
executable=“wall_following”,
output=“screen”),
])

I think it’s my fault when i try several “source” commands… I did this because of an other issue i think with the bridge between ROS1 and ROS2:
/cmd_vel topic is not available when using “ros2 topic list” command (and the simulation and the bridge are launched accordingly to the course explanations)…

I also completed the ROS1 Rosject :slight_smile:

1 Like

Hi @Riddeen ,

I guess you must then wait for the experts to answer you!

I just finished ROS1 on both Python and C++. Currently confused if I should start ROS2 now or complete all ROS1 courses first!

Cheers,
Girish

1 Like

Have you done

source /opt/ros/foxy/setup.bash
source /home/simulations/ros2_sims_ws/install/setup.bash
source ~/ros2_ws/install/setup.bash

?

i’m with c++ but
image
in a python package the launch must be .py?
maybe it has to be just start_wall_following.launch
i don’t really know just saying

Hi @bayodesegun,

I just tried it but it has no effect… It can’t find my “wall_follower” package.

The launch file can be in .py or .launch.

That simply means it hasn’t be properly created. Did you copy it from somewhere?
Please go over the steps to create it properly.

What ? The entire ros2 course uses the extension “.launch.py” and for the rosject not?!
Even if this is true it doesn’t explain why the “ros2 run” command also do not work (which didn’t need any launch file).

PS : “Did you copy it from anywhere ?” => Yes from the Rosject notbook itself :
image

Did you take this course before answer me ? I would say i’m very grateful that your take on your time to help me but if you don’t know what is all about please let someone who already did it try to help me. Or at least don’t be so affirmative saying “That simply means it hasn’t be properly created”.

I’m currently doing all the things from zero but if an admin could answer me or at least restore my environment this would be nice.
Because i’m aware the problem is probably myself :rofl:
Thanks.

Ok, now it seems to work fine (at least the first problem).

what i did:
I created a new package from zero whith just a different name to avoid conflict with the old one.
BUT SAME PROBLEM…
So, I deleted the Build and Install folder and now (after “colcon” and “source”) IT WORKS without any idea on what was the problem…

But now I’m encountering the problem which indirectly causes this (because of me messing something trying to solve it…)

It seems that the /cmd_vel topic is not available (ROS1 to ROS2 bridge).

user:~/ros2_ws$ ros2 topic info /cmd_vel
Unknown topic '/cmd_vel'

I followed all the steps:

  • in the first shell the simulation is lauched.
  • in the second one the bridge between ROS1 & 2 is launched.
  • and in the third shell the teleop works perfectly.
    but when I shutdown the teleop and launch my program it begins normaly and stops with this error:
user:~/ros2_ws$ ros2 launch wall_follower_pkg start_wall_following.launch.py
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2022-09-08-20-52-25-792625-1_xterm-2997
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [wall_following-1]: process started with pid [3109]
[wall_following-1] Traceback (most recent call last):
[wall_following-1]   File "/home/user/ros2_ws/install/wall_follower_pkg/lib/wall_follower_pkg/wall_following", line 33, in <module>
[wall_following-1]     sys.exit(load_entry_point('wall-follower-pkg==0.0.0', 'console_scripts', 'wall_following')())
[wall_following-1]   File "/home/user/ros2_ws/install/wall_follower_pkg/lib/python3.8/site-packages/wall_follower_pkg/wall_following.py", line 50, in main
[wall_following-1]     wall_follower = WallFollower()
[wall_following-1]   File "/home/user/ros2_ws/install/wall_follower_pkg/lib/python3.8/site-packages/wall_follower_pkg/wall_following.py", line 11, in __init__
[wall_following-1]     self.cmd_pub = self.create_publisher(Twist, "/cmd_vel", 10)
[wall_following-1]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/node.py", line 1140, in create_publisher
[wall_following-1]     check_for_type_support(msg_type)
[wall_following-1]   File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/type_support.py", line 20, in check_for_type_support
[wall_following-1]     ts = msg_type.__class__._TYPE_SUPPORT
[wall_following-1] AttributeError: type object 'type' has no attribute '_TYPE_SUPPORT' This might be a ROS 1 message type but it should be a ROS 2 message type. Make sure to source your ROS 2 workspace after your ROS 1 workspace.
[ERROR] [wall_following-1]: process has died [pid 3109, exit code 1, cmd '/home/user/ros2_ws/install/wall_follower_pkg/lib/wall_follower_pkg/wall_following --ros-args -r __node:=wall_following'].

here is my code if it can help:

# scrubbed!

Thanks ! :slight_smile:

Well, I’m not saying you should use the .launch extension, I’m just saying you can use it, even in a Python package! And also that using .launch.py was not the issue.

I meant that did you copy your package source code from somewhere instead of creating it from scratch?

Well, in ROS when you see all the package folders present and it still does not work, that’s the logical conclusion. Either not properly created/sourced. That’s why even ros2 run did not work, because if that was working the problem would be in the launch file.

Before you start your ros2 program, source ros2 in the shell. You have that hint in the error message itself:
[wall_following-1] AttributeError: type object 'type' has no attribute '_TYPE_SUPPORT' This might be a ROS 1 message type but it should be a ROS 2 message type. Make sure to source your ROS 2 workspace after your ROS 1 workspace.

Hi @bayodesegun

Yes off course ! I’m pretty sure that “I” made something wrong. I just missunderstood what you were saying. So thanks for the precisions :wink:

Yes i saw it.
So i did this :

cd ~/ros_2_ws
source /opt/ros/foxy/setup.bash
source install/setup.bash

But it didn’t work… Are these commands good ? (I also desperatly tried different combinations…)

(Sorry for the answer delay, I’m currently livivig in Canada…)

EDIT:
So I just tried…

cd ~/ros_2_ws
source /opt/ros/foxy/setup.bash

…only and it works ! but if run teleop, ctrl_c and source whith the commands above it wont work again. I have to close the shell and reopen a new one.
So for now I can manage to test my code but I’m currious to know what command should I do to avoid starting a new shell (taking into account that the ones above are maybe necessary but not sufficient)?

I’m progressing :rofl: :rofl: :rofl:

This topic was automatically closed after 18 hours. New replies are no longer allowed.