I have Points table with 351 different positions stored in the robot (InitialPose - P350). I’d like to use MovJ and MovP commands to move the robot among these positions. I have a holding register in PLC where requested number of position is stored (1 - 350). I want to concatenate this number with “P” to create a pointer to a motion point in the Points table (e.g. P1).
I’m trying to do it via Lua script, see here:
local PositionNumber_Raw = GetHoldRegs(ID, 1, 1, “U16”)
local PositionNumber = math.floor(PositionNumber_Raw[1])
local RequestedPosition = “P” … PositionNumber (which creates string “P1”)
–Move the robot to requested position
MovJ(RequestedPosition)
Sync()
In this case I get the error message “No input parameters forr MovJ instruction”.
If I use something like this:
if PositionNumber == 1 then
MovJ(P1)
Sync()
end
…it works perfectly.
Where do I do the mistake? Where’s the difference between “P1” and this P1? How can I covert string “P1” to motion point pointer P1? It’s quite clear repeating the if - then - sequence for each of these 351 positions makes the code long and confusing.
Thanks for help.