Roslaunch topics_quiz topics_quiz.launch: ERROR : unable to proceed image is attached


I have been not able to perform launch I checked file name and they are correct according to me. Please guide me how to proceed further as I am new to ros and not familiar with debugging too much.

Hi @Hemant_Pandey ,

Welcome to this Community!

Could you post the contents of your launch file as a Markdown Fenced Code Block?

Regards,
Girish

<launch>
    <node pkg="topics_quiz" type="my_script.py" name="topics_quiz_node" output="screen">
    </node>
</launch>

Hi @Hemant_Pandey ,

Your launch file seems fine.

Did you do chmod +x my_script.py? That is what the error seems to inform.

Try this and let me know if it worked.

Regards,
Girish

Hi @girishkumar.kannan I did that but error is same I am able to see the script in green color indicating executable permission is given


Regards,
Hemant

Hi @Hemant_Pandey ,

Did you source your workspace after building your package?
Did you do the following steps:

cd ~
cd ~/catkin_ws
catkin_make --only-pkg-with-deps topics_quiz
source devel/setup.bash

before running the following command?

roslaunch topics_quiz topics_quiz.launch

Let me know if this worked for you.

Regards,
Girish

Hi @girishkumar.kannan I did the sourcing once again as you suggested but still the error is same. Do you think there is some error in workspace?
Regards.
Hemant

Hi @Hemant_Pandey ,

I have one last idea / method that you can try.

  1. Open the course.
  2. Once IDE loads, download the src folder into your computer, right click src and Download.
  3. Now delete build and devel folders, if they are present, else go to next step.
  4. Delete src folder [once you have downloaded it].
  5. Delete the catkin_ws folder after deleting src folder.
  6. Create the ros workspace again: cd ~ && mkdir -p catkin_ws/src
  7. Go inside catkin_ws and build: cd ~/catkin_ws && catkin_make
  8. Once previous step is done, copy your folders from the src folder that you downloaded, back into the src folder in the IDE. You can extract the zipped file on your computer and then drag and drop the files into IDE parent folder.
  9. Re-build: cd ~/catkin_ws && catkin_make && source devel/setup.bash
  10. Try launching any package using roslaunch ... command.

Let me know if these steps worked for you.

Regards,
Girish

Hi @girishkumar.kannan I tried the steps you provided and gave proper permissions for the files but still same error is coming in case of topics_quiz but above steps solved issues for few other packages which were not running. Is there any trouble with my python script:

#! usr/bin/env python

import rospy
from geometry_msgs.msg import Twist
from sensor_msgs.msg import LaserScan


def laser_callback(data):

    cmd_vel_msg = Twist()
    if data.ranges[len(data.ranges)//2] > 1:
        if cmd_vel_msg.angular.z != 0:
            cmd_vel_msg.angular.z = 0
        cmd_vel_msg.linear.x = 0.5
    else:
        cmd_vel_msg.angular.z = 0.5

    if min(data.ranges[700:]) < 1:
        cmd_vel_msg.angular.z = -0.5

    if min(data.ranges[:20]) < 1:

        cmd_vel_msg.angular.z = 0.5

    cmd_vel_pub.publish(cmd_vel_msg)


if __name__ == '__main__':
    rospy.init_node('topics_quiz_node')
    cmd_vel_pub = rospy.Publisher('/cmd_vel', Twist, queue_size=10)
    laser_sub = rospy.Subscriber(
        '/kobuki/laser/scan', LaserScan, laser_callback)
    rospy.spin()

Regards,
Hemant

Hi @girishkumar.kannan I finally found the error :slightly_smiling_face: and it was really silly I forgot 1 forward slash in very 1st line /usr/bin/env python, I really grateful for your help :smiley:,
Thanks a lot!
Regards,
Hemant.

HI @Hemant_Pandey ,

Glad to know you solved your problem!

The first image that you posted does have the “shebang” line written incorrectly.

Anyways, I will add this also into my list of error diagnostics!

Please mark the appropriate post as “Solution” so this issue can be closed.

Regards,
Girish

Hi @Hemant_Pandey ,

You must actually mark your post as “Solution” because you have solved your own issue.

Regards,
Girish