uArm Crashes

I’m using Python3 the send commands to a uArm Swift Pro. I have many of the commands working but frequently the arm crashes, either to the table top or in some other position and I cannot communicate with the arm.

This command is what seem to cause the loss of control:
swift.send_cmd_async(chr(0x18))

The Python script does not crash. I can continue to send commands but the arm is not responding.

In some cases I can still open and close the gripper!!!

Any suggestions?

My guess is that flushing the command causes an inconsistency between the actual position and the position that the uArm thinks it is at. So when you try to move again, it is moving from a false position causing it to go in the wrong place (e.g. crashing to the table top)

Since you interrupted, the encoder may take a while to figure out the actual position is. Maybe just wait like 5 s before you send it another command?

The loss of control (communication?) occurs immediately after the 0x18 command. It crashes before I send a new move command.

The program flow is:
hardware pin goes low —> move starts
hardware pin goes high —> send “!”, 0x18, “~”

It does not always happen. sometimes it happens immediately and sometimes it happens after a few moves.

Waiting does not help, I never get control back.

Do you have any other suggestions?

Thanks.

If you are running your code as previous stated:

swift.send_cmd_async(msg = “!”)
swift.send_cmd_async(chr(0x18))
swift.send_cmd_async(msg = “~”)

You are sending 3 successsive commands without really waiting, so it is strange. async is short for asynchronous, so I would think there is no guarantee even order of execution is conserved.

While a bit cumbersome, I would sleep between commands to somewhat guarantee order of operations.

OK, I can try that. If I send the commands synchronously what would be the effect?

I put a time.sleep(5) wait between the 0x18 and the “~” and the crash definitely happens after the 0x18 prior to the “~” command. I suppose it could be after the “!” I havent tested that with a delay yet.

In any case, what I’m trying to accomplish is to use this arm in a children’s museum exhibit. I would like to have real-time control with two joysticks and inserting delays kind of defeats the concept of “real-time”

If you can offer any other approach I would appreciate your input.

Thanks,
Geoff

Hm… Isn’t this (uArm Controller - YouTube) essentially what you want to accomplish? It seems like Daniel should be able to find you the code for that. :slight_smile:

Yes, and there is also a user manual for the uarm controller: http://download.ufactory.cc/docs/en/uArm%20Controller_20190718.pdf

OK, I just ordered a controller. I do not see where to purchase the USB Type-C cable for connection to the arm. Can you supply one?

I wish this had been suggested at the beginning of our discussion.

Can you offer any more information about using joysticks?

My code so far controls the X-axis, Y-axis, Z-axis, wrist angle, and gripper open and close. I plan on using two joysticks each with a pushbutton. One joystick for X and Y, one for Z and wrist, one button to close the gripper, and the other button to open the gripper.

Thank you.

I would still like to make this work with my own code as well.

Can you provide any more information about why the arm crashes?

Please refer to my previous posts.

Thank you.

I looked at the joystick driver on GitHub. It looks as though the code only prints out that the joystick has been moved.

I do not see the actual commands sent to the arm. Where are those commands defined?

I apologize if this is obvious but I have very little Arduino experience.

Thanks

Don’t worry, the controller come with the cables.

OK, great.

Can you offer any more information about using joysticks?

My code so far controls the X-axis, Y-axis, Z-axis, wrist angle, and gripper open and close. I plan on using two joysticks each with a pushbutton. One joystick for X and Y, one for Z and wrist, one button to close the gripper, and the other button to open the gripper.

I would still like to make this work with my own code as well.
Can you provide any more information about why the arm crashes?
Please refer to my previous posts.

I looked at the joystick driver on GitHub. It looks as though the code only prints out that the joystick has been moved.
I do not see the actual commands sent to the arm. Where are those commands defined?

I reply you in another post.