Tutorial 01 - Robot Arm Setup

Main Script Lua Code

--Function for moving robot arm to a given location
function MoveArm(target, pos)
    vel = 0.7
    accel = 70
    jerk = 50
    -- Put experimental values for above three parameters
    currentVel = {0,0,0,0}
    currentAccel = {0,0,0,0}
    maxVel = {vel,vel,vel,vel}
    maxAccel = {accel, accel, accel, accel}
    maxJerk = {jerk, jerk, jerk, jerk}
    targetVel = {0,0,0,0}
    quaternion = {0,0,0,0}

    sim.rmlMoveToPosition(target, -1, -1, currentVel, currentAccel, maxVel, maxAccel, maxJerk, pos, quaternion, targetVel)
end

function sysCall_threadmain()

    base = sim.getObjectHandle('IRB4600')
    IK_Target = sim.getObjectHandle('Target')

    pos = {0.65, 1.45, 0.6} -- Put any location that the robot can reach in (x,y,z) coordinates
    MoveArm(IK_Target, pos)
    pos2 = {0.75, -1.45, 0.6} -- Put any location that the robot can reach in (x,y,z) coordinates
    MoveArm(IK_Target, pos2)

end

function sysCall_cleanup()
    -- Put some clean-up code here
end

No comments:

Post a Comment

Popular Posts