1
$\begingroup$

Are there any Python3 modules used to program robotic movement by declaring a device or component and then providing the instructions? I am not looking for modules that test the components.

$\endgroup$
1
  • $\begingroup$ Hi Devyn, this question as written is going to elicit very subjective answers. Can you rephrase it a little bit to describe what "easy" means as far as your specific application? $\endgroup$
    – Ian
    Commented Jul 1, 2013 at 16:03

1 Answer 1

1
$\begingroup$

This is an extremely general question. What code you will use will depend on the type of "robotic movement" you are attempting to achieve, and what platform you are running the code on.

Let's say you want to control a stepper motor from python running on a Raspberry Pi. Stephen Phillips has written a nice python class for this purpose. The code was for Python 2.x, but the only changes you need to make to port it to python 3 are to add parenthesis to the print statements and change the backticks to repr() because python 3 has cleaned up the print syntax. See the output of python's 2to3 command below:

@@ -41,10 +41,10 @@
         steps = (steps % self.steps_per_rev)
         if steps > self.steps_per_rev / 2:
             steps -= self.steps_per_rev
-            print "moving " + `steps` + " steps"
+            print("moving " + repr(steps) + " steps")
             self._move_acw(-steps / 8)
         else:
-            print "moving " + `steps` + " steps"
+            print("moving " + repr(steps) + " steps")
             self._move_cw(steps / 8)
         self.step_angle = target_step_angle

@@ -98,7 +98,7 @@
     GPIO.setmode(GPIO.BOARD)
     m = Motor([18,22,24,26])
     m.rpm = 5
-    print "Pause in seconds: " + `m._T`
+    print("Pause in seconds: " + repr(m._T))
     m.move_to(90)
     sleep(1)
     m.move_to(0)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.