ich bin gerade ein bisschen am verzweifeln... Ich habe eine Ubuntu Installation (12.04.) ich beschäftige mich gerade mit python.
Um möglichst komfortable, schnell aber auch effizient voran zu kommen habe ich mir die IDE Spyder installiert und aber auch andere, wie IDLE.
Funktionieren tut aber leider nicht so wirklich...
Wenn ich den Code ausführen möchte, führt das in IDEs immer zu einem Fehler. Im gegensatz dazu, wenn ich das Script mit die Console
Code: Alles auswählen
python move.py
Habt ihr eine Idee

Fehler in Spyder:
Code: Alles auswählen
Traceback (most recent call last):
File "/home/manfred/move2.py", line 15, in <module>
rospy.init_node('MyFirstNode', anonymous=True)
File "/opt/ros/hydro/lib/python2.7/dist-packages/rospy/client.py", line 303, in init_node
rospy.core.configure_logging(resolved_node_name)
File "/opt/ros/hydro/lib/python2.7/dist-packages/rospy/core.py", line 235, in configure_logging
_log_filename = rosgraph.roslogging.configure_logging('rospy', level, filename=filename)
File "/opt/ros/hydro/lib/python2.7/dist-packages/rosgraph/roslogging.py", line 87, in configure_logging
rosgraph_d = rospkg.RosPack().get_path('rosgraph')
File "/usr/lib/python2.7/dist-packages/rospkg/rospack.py", line 200, in get_path
raise ResourceNotFound(name, ros_paths=self._ros_paths)
rospkg.common.ResourceNotFound: rosgraph
Hier der Code:
Code: Alles auswählen
#!/usr/bin/python
##import roslib
import rospy
from geometry_msgs.msg import Vector3, Twist
def publish_velocities(v, w):
tw = Twist(Vector3(v,0,0), Vector3(0,0,w))
pub.publish(tw)
rospy.sleep(1.0)
if __name__ == '__main__':
pub = rospy.Publisher('cmd_vel', Twist)
rospy.init_node('MyFirstNode', anonymous=True)
v = 0.5; w = 0.5
try:
while not rospy.is_shutdown():
publish_velocities(v, w)
except rospy.ROSInterruptException:
pass
--------------
Nachtrag: Der folgende Code funktioniert in Spyder. Ich gehe irgendwie davon aus, dass die imports Probleme machen... Dafür kenne ich mich aber leider nicht gut genug aus

Code: Alles auswählen
finished = False
while not finished:
try:
print("Eingabe?"),
input = raw_input()
print("Deine Eingabe-> %s" % input)
if input == "q":
print("quit")
finished = True
except (KeyboardInterrupt, SystemExit):
finished = True