I also changed my code to try to accomodate the abGOModifier(ArmSpeedSelect) code.
the first section of code shown here is what I originally had and the second is what I changed it to, but when I try to compile the changed code I get an error. Do you know why?
This is the original code:
[code] IF (DualShock(2).bit2 = 0) AND (GripperPressure>GripperHoldPressure) THEN ;L1 Button test
Gripper1 = (Gripper1-80) min Gripper_MIN ;Gripper Close
ENDIF
IF (DualShock(2).bit0 = 0)THEN ;L2 Button test
TargetGripper1 = (TargetGripper1+40) max Gripper_MAX ;Gripper Open
ENDIF
IF (DualShock(2).bit3 = 0) THEN ;R1 Button test
TargetWristAngle1 = (TargetWristAngle1-40) min WristRotate_MIN ;Wrist Rotate CW
ENDIF
IF (DualShock(2).bit1 = 0) THEN ;R2 Button test
TargetWristAngle1 = (TargetWristAngle1+40) max WristRotate_MAX ;Wrist Rotate CCW
ENDIF
IF ABS(Dualshock(5) - 128) > DeadZone THEN ;Left Stick L/R
IF IKSolutionWarning THEN ;Allow only movement to the base
WristPosX = WristPosX -((Dualshock(5) - 128)/12) MIN 0 ;X Position
ELSE
WristPosX = WristPosX -(Dualshock(5) - 128)/12 ;X Position
ENDIF
ENDIF[/code]
This is the changed code:
[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).bit0 = 0)THEN ;L2 Button test
TargetGripper1 = (TargetGripper1+abGOModifier(ArmSpeedSelect)) max Gripper_MAX ;Gripper Open
ENDIF
IF (DualShock(2).bit3 = 0) THEN ;R1 Button test
TargetWristAngle1 = (TargetWristAngle1-40) min WristRotate_MIN ;Wrist Rotate CW
ENDIF
IF (DualShock(2).bit1 = 0) THEN ;R2 Button test
TargetWristAngle1 = (TargetWristAngle1+40) max WristRotate_MAX ;Wrist Rotate CCW
ENDIF
IF ABS(Dualshock(5) - 128) > DeadZone THEN ;Left Stick L/R
IF IKSolutionWarning THEN ;Allow only movement to the base
WristPosX = WristPosX -((Dualshock(5) - 128)/12) MIN 0 ;X Position
ELSE
WristPosX = WristPosX -(Dualshock(5) - 128)/12 ;X Position
ENDIF
ENDIF[/code]
The program doesn’t say which line the error is on… also if the program didn’t compile how would we check if the gripper was moving too fast?
and one more problem is that we bought a continuous servo for the base, but it doesn’t stop when the remote control is released and it moves too fast. Do you know how we can make the continuous servo slow down and stop when the joystick is released?
Can’t help much with error, when I don’t have your sources, or know what the error message is and which line it is complaining about…
As for moving rotating the wrist faster or closing the gripper faster, there has been a lot of discussions and code excerpts up on the thread: viewtopic.php?f=6&t=7923&start=45
As for continuous servos. They work differently. That is if the servo pulse is 1500us (more or less, may need to adjust what the zero point is per servo). The servo will stop rotating. If the value is less than this, it will rotate one direction, and if it is greater than this it will rotate the other direction. The farther away from the center point the faster it will rotate… To do this you will need to rework some of the code.
That is you need to look where the value of BaseAngle1 is used. Currently it is modified to be some angle, instead you need to to change this to be something like some delta speed from 1500 or simply a value in us.
You need to update where this value gets set…
IF ABS(Dualshock(3) - 128) > DeadZone THEN ;Right Stick L/R
BaseAngle1 = BaseAngle1 -(Dualshock(3) - 128)/abBSpeedDivisor(ArmSpeedSelect) ;Base Rotation
ENDIF
This part may be as simple as setting the BaseAngle1 to some value centered around 1500 that is proportional to how far the joystick is moved… Could be something like:
IF ABS(Dualshock(3) - 128) > DeadZone THEN ;Right Stick L/R
BaseAngle1 = 1500 -(Dualshock(3) - 128) * 3 ;Base Rotation
ELSe
BaseAngle1 = 1500
ENDIF
This would give you a range of us of something like: 1120-1880 (rounded…) which may be too much or too little. You can always experiment with different multipliers or combinations of multipliers and divisors…
Note: if you go this route you may want to rename the variable to something like BaseSpeed or the like. Also need to check other places where this value is set and probably update. Example: if old code set it to 0 you may need to set it to 1500. Also with this change you will need to change the movement function and change how the variable gets used… (Note: it will be a different variable name in the function…) But if you go the above route you will need to change the movement function to simply use the value passed in instead of what it is doing now and trying to convert degrees into us…