unable to run ros package executable
Hello, I am trying to run a python script using the rosrun command, but each time I attempt to do this I get this message
Usage: rosrun [--prefix cmd] [--debug] PACKAGE EXECUTABLE [ARGS]
rosrun will locate PACKAGE and try to find
an executable named EXECUTABLE in the PACKAGE tree.
If it finds it, it will run it with ARGS.
The command I use to run my python script is rosrun assignment_subscriber.py
I have tried the following:
$ source devel/setup.bash
chmod +x assignment_subscriber.py
but ros will still not run the script. I am very new to ros so I may be overlooking something very simple as far as configuration, but I still haven't figured it out. Please help. Thanks
assignement_subscriber.py
#!/usr/bin/env python
import rospy
import turtle
def poseCallback(pose_message):
rospy.loginfo(" Postion:%s, %d, %z" % (data.x, data.y, data.theta))
print ("pose callback")
print ('y = %z' %)
print ('y = %f' %)
print ('yaw = '.%)
if __name__ == '__main__':
try:
rospy.init_node('turtlesim_motion_pose', anonymous=True)
rospy.Subscriber("turtle_position", Position, poseCallback)
rospy.spin()
except rospy.ROSInterruptException:
rospy.loginfo("node terminated.")
You don't show us the most important thing: the exact command line you use to try and run your script.
Please add that to your question (use the
edit
button/link).Additionally: this may just be the formatting of your code in this question, but all lines in the
poseCallback(..)
function are incorrectly indented.do you create pkg or only write python scrip?
Thank you all for your responses. I clone a repo that already contained source files and other folders. I did run a catkin_make to build the project and have already ran a few programs from the clone repo. The problem lies when I try to add my own source file such as assignment_subscriber.py
here is a link to the repo: https://github.com/aniskoubaa/ros_ess... The command I use to run my python script is rosrun assignment_subscriber.py