I'm working on a KRL program that will allow the robot to be controlled in a limited sense by a remote computer using Ethernet KRL. By "limited" I mean that the capability will be there to load a series of positions on the robot (along with associated velocities, approximation criteria, etc.) and then have it execute the desired motion. We're setting up a communication protocol and I want to have six different commands available (from the PC to the KR C)
1. Get status
2. Get position
3. Send stop
4. Clear pose sequence
5. Add to pose sequence
6. Execute pose sequence
This would be straightforward except for the fact that we want these commands to be available while the robot is in motion (that is, while it's moving through a series of positions). Roughly speaking, my idea for effecting this is to run a loop that first checks for EKRL messages (with timeout of zero), then executes the appropriate subroutine, and finally moves to the current position in the sequence (and increments the sequence index). A rough sketch of this follows in pseudo-code.
loop
ethread()
if newMessage
switch messageCommandType
1: ethwrite(status)
2: ethwrite(position)
3: somehow execute BRAKE command (I guess in an interrupt program)
readyToMove = false
4: sequenceLength = 0
sequencePosesIndex = 0
5: sequenceLength++
sequencePoses[sequenceLength] = messagePoseData
lcpdat[sequenceLength] = messageLCPData
6: readyToMove = true
endif
if readyToMove
ldat_act = lcpdat[sequencePosesIndex]
fdat_act = myFdat
bas(#cp_params, lcpdat[sequencePosesIndex].vel) ; I'm not sure about this. It seems this call to bas() takes in two velocities, one in ldat_act and one in the call.
lin sequencePoses[sequencePosesIndex] c_vel
sequencePosesIndex++
endif
if sequencePosesIndex > sequenceLength ; Done moving through sequence of positions
sequencePosesIndex = 0
sequenceLength = 0
readyToMove = false
endif
endloop
Display More
I have concerns about this approach, mainly about the advance run. Do you know if with this ethread and possibly ethwrite between the motion commands (lin) will approximation still be possible? I'm thinking another approach is to (possibly?) have the Ethernet stuff be in sps.sub and let the arrays of positions and ldat's be global. It would be more work to set up but seems like it has the potential to be cleaner and better performing than keeping it all in a single KRL program. I'd appreciate any comments.
PS --- It's an older controller, a KR C2 running I don't know which version of the software.