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!!!
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?
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.
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.
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?