Hi !
I am planning on building a AL5A PS2 controlled arm using an Arduino UNO, and I am having problems for the code which i took from the Lynxmotion website. (lynxmotion.com/images/html/build091b.htm)
Since I will be not using a Botboarduino and an arm with wrist rotation, I have deleted certain parts of the original code and assigned different pins to each servos. However, even though there is no error in the new code according to the Arduino software, I am not sure if the modifications I did are indeed right and that the arm will not encounter problems.
Could someone please help me ?
Attachments : the modified code
Thanks for your help
PS2_Control_MODIFIED.ino (5.17 KB)
Hi,
We’ve compared your code to the original (diff) and verified the modifications quickly.
Everything seems good and it should not cause any issues.
That being said, please note that you did not have to remove any code for the wrist rotate (even if you do not have that feature) since it does not impact the inverse kinematic calculations. Therefore, you could just run the orignial code directly (with modifications for assigned pins…).
Of course, there is no harm in removing it, either.
Good luck!
Sincerely,
Thank you for your answer !
I have uploaded the original lynxmotion code in my arduino and the servos are responding correctly but they are really slow. I have changed my 6V external power battery and the problem persists. When I test all servos with a simpler code there is no speed problem but they tend to go back to their original position.
So I guess that the original code has to be modified but i don’t know where
attachment : the “simple” code for the servos with no speed pb
sketch_aug01a.ino (1006 Bytes)
Hi,
Please note that the example code does not control the servomotors directly. Instead, it causes the target position of the end effector to change incrementally every loop. They purposefully move slowly to allow good position control.
The “problem” is not related to power, as you have noticed.
Your code directly relates the position of the analog sticks (each channel) to a servomotor position, which would allow instantaneous updates to the position. Since the analog joysticks are auto-centering, of course the servomotors in the robotic arm return to their center position too, since their position is directly proportional to the joystick axis positions due to how your code uses those positions (direct map).
Well, since it is a 2D inverse kinematic (IK) system, you would need to change how it incrementally changes the positions and how fast those loops are performed. Therefore, we recommend that you experiment with the code so you can understand how it works and how it changes position based on the button presses / joystick actions.
You may want to read this topic about the inverse kinematics in this example code.
Sincerely,