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.
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)…
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 :
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
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 
[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] 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'].
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.
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…)
So I just tried…
…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)?