Skip to content

Concurrent Movements #14

Description

@RetroJimmyX

I watched a youtube video about controlling the arm with Flask and Python and noticed the use of the OR operator "|" in the code to produce concurrent movements. The code was
arm.move(usb_arm.WristUp|usb_arm.ElbowUp)
In the Python program I made to control the arm, I'm using a function, to which I pass the arguments of which component to use and move by how much. e.g.
def arm_control(component,time): if component == "e": if time > 0: arm.move(usb_arm.ElbowUp, time) elif time < 0: arm.move(usb_arm.ElbowDown, time)

It means that essentially I can type easy command such as e3 or s-2 to move the elbow up for 3 seconds or the should down for 2 seconds. I have my code on my repository (word of warning - I'm not a programmer!)

Apologies for posting here but struggling to find a solution. Any ideas how I can use my code to call functions concurrently? Is it just a case of using something like this to call my function simulatenously? i.e.
p1 = Process(target = arm_control("e",3)) p1.start() p2 = Process(target = arm_control("s",-2)) p2.start()

...or is the a neater way to do this and utilise the feature you have with the "|" operator?

HUGE thanks in advance!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions