Ha,
Got it.
Thanks
Ha,
Got it.
Thanks
Dear Lynx,
Has some improvements. But, one thing that doesn’t seem right. We had burn the gripper servo twice. Any advice?
Thanks
May be that the limits need to be refined. That is the values of Gripper_MIN, Gripper_MAX. Do you have EnableFSR defined on your arm (and have a FSR?). When I have issues like this, I would probably modify the code where L1/L2 are used and add something like: serout s_out, i9600, [sdec TargetGripper1, 13]
To each of them and then try moving the gripper in each direction and see if you get to the limits…
Kurt
May be that the limits need to be refined. That is the values of Gripper_MIN, Gripper_MAX. Do you have EnableFSR defined on your arm (and have a FSR?). When I have issues like this, I would probably modify the code where L1/L2 are used and add something like: serout s_out, i9600, [sdec TargetGripper1, 13]
To each of them and then try moving the gripper in each direction and see if you get to the limits…
I tried the gripper with a servo tester. It only took 90 degree to fully open and close. In the code, it is Gripper_MIN con -720 and Gripper_MAX con 680. Should I set to Gripper_MIN con -450 and Gripper_MAX con 450?
Maybe. Try it see if it works… You said it only took 90 degrees, but was it such that + and - 45 was the end points, or could it have been +48 and -42… The fun thing is, it is not hard to experiment and see what works for you here.
Good Luck
Kurt
Hi,
I need the robot arm to extend fully outward, but the elbow seems to only be able to rotate the arm upwards 45 degrees from its neutral position instead of the full 90 that it is supposedly capable. I edited the mechanical limit of the elbow servo in the program from 450 to 900 to try to change the servo rotation to 90 degrees, but that had no effect. Is there something else I need to do to make the arm’s full extension possible? Or is there something else that needs to be changed in the program to do this?
Here is the program for the mechanical limits of the arm. You can see that I already changed the elbow maximum to 900 (originally the elbow minimum was -710 and the maximum was 450):
Base_MIN con -900 ;Mechanical limits of the Base
Base_MAX con 900
Shoulder_MIN con -780 ;Mechanical limits of the Shoulder
Shoulder_MAX con 900
Elbow_MIN con -710 ;Mechanical limits of the Elbow
Elbow_MAX con 900
Wrist_MIN con -900 ;Mechanical limits of the Wrist
Wrist_MAX con 900
Gripper_MIN con -720 ;Mechanical limits of the Gripper
Gripper_MAX con 680
WristRotate_MIN con -760 ;Mechanical limits of the WristRotate
WristRotate_MAX con 830
Hi,
I still need help on my previous problem above, but i just discovered another. Although the normal controls for the gripper are supposed to be L1 to close the gripper and L2 to open the gripper, the L1 button on our robot arm actually opens the gripper instead of closing it. Also, the gripper automatically closes when the L1 button is released. Sometimes, after the release of the L1 button the gripper still does not fully close and then the L2 button must be pressed to close the gripper fully. Can you help explain the inconsistency between the listed controls and the issues we are experiencing? We would like to have the gripper open when the L1 button is pressed and close when the L2 button is pressed, when not pressing any button, for it to stay in a half open neutral position. Is it possible? (We use Aalternate Gripper with HS-225MG servo)
If the gripper is moving when no button are pressed I suspect there is an issue with the controller.
Have you tried the code that was posted in the Help for 2012 Science Olympiad Competition? viewtopic.php?f=6&t=7923 It might make more sense for you to use that code as it has had many problems fixed.
In an earlier version of the the code that I updated there was an issue with the gripper with one of the buttons. That was it was setting the wrong variable and as soon as you released the button if I remember correctly it returned back to near the center location… Fixed in the thread that Robot Dude mentioned… I think the normal code will stay when you release the button stays where it is when you released it. You can change that to move back to the center pretty easily. For example the L1 code might look something like:
[code] IF (DualShock(2).bit2 = 0) AND (GripperPressure>GripperHoldPressure) THEN ;L1 Button test
TargetGripper1 = (TargetGripper1-abGOModifier(ArmSpeedSelect)) min Gripper_MIN ;Gripper Close
ENDIF
IF DualShock(2).bit2 AND (LastButton(1).bit2 = 0) THEN ;L1 Button release test
TargetGripper1 = 0 ; put to center position…
ENDIF
[/code]
L2 would be similar…
As for moving the elbow more than 45 degrees. I believe that is all controlled by the math, in the function: ArmIK [IKWristPosX, IKWristPosY, IKGripperAngle1].
My guess is that the math is setup such that if it thought it needed to go farther that the shoulder would move to get to the desired location… When the elbow does not extend to where you want it, is the shoulder at it’s min or max position? If this is the case, my guess is to get what you want, the math would need to be changed, to detect that the shoulder has been constrained and then recalculate the elbow from there. But I am guessing as I did not write this code…
Kurt
Kurt,
Thank you for your help. In referring to your comment, “the math would need to be changed, to detect that the shoulder has been constrained and then recalculate the elbow from there”. Can you point out which part of the code I need to look at? I will see if I can figure out myself.
Thanks
As I mentioned it would need to be updated in the ArmIK function:
[code]ArmIK [IKWristPosX, IKWristPosY, IKGripperAngle1]
;IKSW - Length between Shoulder and wrist
#ifdef USESQR
IKSW2 = SQR((((IKWristPosY-BaseLength)(IKWristPosY-BaseLength))+(IKWristPosXIKWristPosX))(c4DEC/4))
#else
IKSW2 = TOINT(FSQRT(TOFLOAT((((IKWristPosY-BaseLength)(IKWristPosY-BaseLength))+(IKWristPosXIKWristPosX))(c4DEC/4))))
#endif
;IKA1 - Angle between SW line and the ground in rad
GOSUB GetAtan2 (IKWristPosY-BaseLength), IKWristPosX], IKA14
;IKA2 - Angle of the line S>W with respect to the humerus in radians
Temp1 = (((HumerusLength*HumerusLength) - (UlnaLength*UlnaLength))*(c4DEC/4) + (IKSW2*IKSW2))
Temp2 = ((2*HumerusLength)*c2DEC * IKSW2)
GOSUB GetArcCos (Temp1 / (Temp2/c4DEC)) *2 ], IKA24
;Elbow Angle
Temp1 = (((HumerusLength*HumerusLength) + (UlnaLength*UlnaLength))*(c4DEC/4) - (IKSW2*IKSW2))
Temp2 = (2*HumerusLength*Ulnalength)
GOSUB GetArcCos (Temp1 / Temp2) * 4]
IKElbowAngle1 = -(1800-AngleRad4*180/3141)
;Shoulder Angle
IKShoulderAngle1 = (IKA14 + IKA24) * 180 / 3141
;Wrist Angle
IKWristAngle1 = IKGripperAngle1-IKElbowAngle1-IKShoulderAngle1
;Set the Solution quality
IKSolutionWarning = ((IKSW2*2) > ((UlnaLength+HumerusLength-40)c2DEC))
IKSolutionError = ((IKSW22) > ((UlnaLength+HumerusLength)*c2DEC))
return[/code]
But the Angle checks are not done on these actual angles as you can see in the main function:
[code] ;Inverse Kinematic calculations
GOSUB ArmIK [WristPosX, WristPosY, GlobalGripperAngle1]
ShoulderAngle1 = -IKShoulderAngle1+900
ElbowAngle1 = IKElbowAngle1+900
WristAngle1 = -IKWristAngle1
GOSUB CheckLimits
[/code]
Actually if I were to play a little more with this code, I would probably move all of this secondary code into the ArmIK function as it is replicated everywhere that it ArmIK is called.
Kurt
Kurt,
Thank you for your prompt reply. We will look into it.
Another strange problem occur. We use HS-645GM for our wrist. It was shaky when the servo start to work. I thought the servo is bad. I went to a hobby shop to buy a new one today, guess what, all their HS-645MG inventory are shaky with Bot Board II Atom Pro 28. I test with 225. It works fine. Are you aware of this?
There is nothing wrong with the 645 servos. Post a video and images of your wiring so we can see what you are doing wrong.
Ok, we will video it tonight and submit the video tonight.
Thanks
The video will help us to determine the possible problems, but the images of the board and it’s power supply wiring is also required to help us determine the cause of the problem.
I have never had any problems with 645mg servos I have used. Usually when I hear something like this, I assume some sort of power issue. Something like supplying more than 6V to the servo or not supplying enough current (to small of a battery or wall wort, or bad wiring, like using a AA battery holder with bad contacts and small wires).
As for the wrist not going beyond 45 degrees. I extracted a lot of the arm code into a test program where I simply entered an X, Y and wrist angle and then printed out all of the calculated values. With my arm an AL5D, it should be able to reach out to about 334 units in X direction with Y at 69… with the lengths of 147 and 187. Sure enough the elbow came in right around 900, but was limited to 450. I changed my test program like:
Elbow_MAX con 850
And it was reflected in the outputs, so I think simply changing this should work… However, depending on the age of your Arm, there may be an issue. That is my AL5D is built with two large scale digital servos (HS-5745MG), which Lynxmotion does not carry anymore. I am guessing that unless these servos are reprogrammed they probably have a maximum range of 140 degrees, which I am seeing. I believe the newer Arms are now using non digital servos (HS-755HB, and HS-805BB), which do have a full range of 180 degrees. Maybe someday I may have to update my arm to the current version. Digitals are nice but I hate the noise and the lack of ability to turn the servo off. So far these are the only 2 digital servos I have (except for the Robonova still sitting in a box somewhere ).
So the question is, which version do you have?
Kurt
Kurt,
Thank you for your info. Will give them a try.
Hi,
Everything seems to be working fine now thank you so much for your help. One more question, if we wanted to increase the speed at which the gripper opens and closes how could we only speed up the gripper and none of the other servos? Also the gripper seems to automatically close and only opens if we keep holding L1. Do you know how to increase the speed of the gripper?
I am glad it is working OK for you now!
Speed of gripper… Look at where L1 and L2 are processed. Currently in My code it looks something like:
IF (DualShock(2).bit2 = 0) AND (GripperPressure>GripperHoldPressure) THEN ;L1 Button test
TargetGripper1 = (TargetGripper1-abGOModifier(ArmSpeedSelect)) min Gripper_MIN ;Gripper Close
ENDIF
IF DualShock(2).bit2 AND (LastButton(1).bit2 = 0) THEN ;L1 Button release test
TargetGripper1 = 0 ; put to center position...
ENDIF
Note: The second IF in this code was the stuff I hacked in earlier that I believe should put the gripper back to middle position when you release the L1 button. You may want this or not… If not simply remove that second part that says button release test…
But in this code you see that the Gripper changes by the amount: abGOModifier(ArmSpeedSelect)) each time the code goes through this while the button is still pressed. The values of abGoModifier is defined in a byte table:
abGOModifier bytetable 20, 40, 60, 80 ; Gripper Opening/Closing Speed (L1/L2)
To change the speeds in this code you can simply change these values to something larger…
Also later in the code there is a block of code to make sure the gripper does not go too fast. It was mainly in there such that for example you hit the button to center the gripper and it is a long distance from center it will still only move at some maximum speed. In the original version this max speed was come defined constant that I believe had a value of 40. If you are using that version of the code simply increase that value. My current version says the maximum speed is the value from the above byte table. That code looks like:
;Limit gripper max speed
IF (ABS(Gripper1-TargetGripper1) > abGOModifier(ArmSpeedSelect)) THEN
IF ((Gripper1-TargetGripper1) >= 0) THEN
IF (GripperPressure>GripperHoldPressure) THEN
Gripper1 = Gripper1 - abGOModifier(ArmSpeedSelect)
ENDIF
ELSE
Gripper1 = Gripper1 + abGOModifier(ArmSpeedSelect)
ENDIF
ELSE
Gripper1 = TargetGripper1
ENDIF
Hint: look in the code for the comment “Limit gripper max speed” to see what your code is currently doing.
Good luck
Kurt
Hi Lynx,
In my program I do not have this line.
abGOModifier bytetable 20, 40, 60, 80 ; Gripper Opening/Closing Speed (L1/L2)
My version is ps2arm1.bas
If I change my code to use abGOModifier, I need to put it somewhere. I put it in here. Please let me know if that is wrong.
;--------------------------------------------------------------------
;[TABLES]
GetACos bytetable 255,253,252,251,250,248,247,246,244,243,242,241,239,238,237,235,234,233,232,230,229,228,226,|
225,224,223,221,220,219,217,216,215,213,212,211,209,208,207,206,204,203,201,200,199,197,196,|
195,193,192,191,189,188,186,185,184,182,181,179,178,177,175,174,172,171,169,168,166,165,163,|
162,160,159,157,156,154,153,151,149,148,146,145,143,141,140,138,136,135,133,131,129,128,126,|
124,122,120,118,116,115,113,111,109,106,104,102,100,98,96,93,91,89,86,83,81,78,75,73,70,66,63,|
60,56,52,48,44,38,33,26,15,0
abGOModifier bytetable 20, 40, 60, 80 ; Gripper Opening/Closing Speed (L1/L2)
;--------------------------------------------------------------------