Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent Movements #14

Open
RetroJimmyX opened this issue Aug 8, 2022 · 1 comment
Open

Concurrent Movements #14

RetroJimmyX opened this issue Aug 8, 2022 · 1 comment

Comments

@RetroJimmyX
Copy link

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!

@dannystaple
Copy link
Member

Hello, that video was likely mine. At some point (and this is worthy of a feature request), I should modify this code to be concurrent, or demonstrate such patterns.

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

No branches or pull requests

2 participants