'I get this error when I attempt to run the code.. attempt to index global 'file' (a nil value) stack traceback:
I get this error when I attempt to run the code.. attempt to index global 'file' (a nil value) stack traceback: I am trying to import a csv file on vrep but its giving me this error.
readFile=function(filename)
file = io.open(filename, "r")
matrix = {}
for row in file:lines() do
print(row)
nums = {}
for num in row:gmatch("%-*%d+%.*%d*") do
print(num)
table.insert(nums, tonumber(num))
end
table.insert(matrix, nums)
end
return matrix
end
has_grabed_an_object = false
grab_object=nil
jh={-1,-1,-1,-1,-1,-1}
for i=1,6,1 do
jh[i]=sim.getObjectHandle('LBR_iiwa_7_R800_joint'..i)
end
Dummy_target=sim.getObjectHandle('Target')
accel=5
jerk=10
currentVel={0,0,0,0,0,0,0}
currentAccel={0,0,0,0,0,0,0}
maxVel={0.5,0.5,0.5,0.5,0.5,0.5,0.5}
maxAccel={0.5,0.5,0.5,0.5,0.5,0.5,0.5}
maxJerk={0.5,0.5,0.5,0.5,0.5,0.5,0.5}
targetVel={0,0,0,0,0,0,0}
positions = readFile("pickup1.csv")
for index, points in ipairs(positions) do
sim.rmlMoveToPosition(Dummy_target, -1, -1, currentVel, currentAccel, maxVel, maxAccel, maxJerk, points, targetQuaternion, targetVel)
end
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
