Well, as my signature says things are bound to screw up sometime and it is now.
I finally got around to putting my obstacle avoidance program and object finding program into one code. It compiles and runs fine until it gets to this subroutine.
[code];[WAITFORPREVMOVE] Loop that wait for the previous servo move to be finished
idle var byte
finished var byte
junk var word
WaitForPrevMove
finished = true
gethservo BasePin,junk,idle
if(NOT idle)then
finished=false
endif
gethservo ShoulderPin,junk,idle
if(NOT idle)then
finished=false
endif
gethservo ElbowPin,junk,idle
if(NOT idle)then
finished=false
endif
gethservo WristPin,junk,idle
if(NOT idle)then
finished=false
endif
gethservo GripperPin,junk,idle
if(NOT idle)then
finished=false
endif
gethservo WristRotatepin,junk,idle
if(NOT idle)then
finished=false
endif
sound p9,[500\500];first sound command that repeats over and over
if(NOT finished)then WaitForPrevMove
sound p9,[1000\4000];second sound command that I never here at all
_mPrev_BasePos1 = BasePosition1
_mPrev_ShoulderPos1 = ShoulderPosition1
_mPrev_ElbowPos1 = ElbowPosition1
_mPrev_WristPos1 = WristPosition1
_mPrev_GripperPos1 = GripperPosition1
_mPrev_WristRotatePos1 = WristRotatePosition1
return[/code]
Using sound commands I found that the code is going into an endless loop within the subroutine. The thing that’s really getting me is that this exact same code is used in my object finding program and it works perfectly! This is where the waitforprevmove subroutine is entered. Again, this is copied and pasted from another code where it works perfectly.
[code]servo_driver
;Inverse Kinematic calculations
GOSUB ArmIK [WristPosX, WristPosY, GlobalGripperAngle1]
ShoulderAngle1 = -IKShoulderAngle1+900
ElbowAngle1 = IKElbowAngle1+900
WristAngle1 = -IKWristAngle1
GOSUB CheckLimits
GOSUB WaitForPrevMove ;it enters right here
sound p9,[1000\1000];I never here this either
GOSUB Movement baseangle1,-ShoulderAngle1, -ElbowAngle1, -WristAngle1, -Gripper1, -WristRotateAngle1, 250]
return [/code]
I concluded that the only thing that could be the culprit was the gethservo commands malfinctioning for some reason beyond my understanding. Sorry if you don’t understand. This really hard for me to explain. Infinite thankyou to anyone that helps in any way.