- 10/09/2019 at 04:43 #16895
I woud like to move robot via python API using coordinates instead of moveJoint.
Any suitable python API?
Attachments:You must be logged in to view attached files.010/09/2019 at 08:37 #16898
Maybe there’s a better way but what I do is I create a vcMotionTarget, set the target matrix and then read out the calculated joint values.Python12345678comp = getComponent()controller = comp.getBehaviour('Controller')motionTarget = controller.createTarget()motionTarget.TargetMode = VC_MOTIONTARGET_TM_WORLDTARGETmotionTarget.Target = yourTargetMatrixjointValues = motionTarget.JointValues
Hope that helps!1+10/09/2019 at 08:55 #16903
vcHelpers.Robot2 has many methods you could use such as linearMoveToPosition(). Robot2 is a wrapper class for the robot controller and you can also use the controller class itself a little bit like Johnny described. I fleshed out his example a bit so check the snippet below. Using the actual robot controller instead of Robot2 wrapper grants you a bit more control over the motion and in the snippet below things such as tool, base, configuration and motion type are defined for the target. And of course the target matrix. For translating the matrix I used matrices translateAbs() method. But check the reference guide (in help) for more info about the vcRobotController and vcHelpers.Robot2.Python12345678910111213141516def OnRun():controller = comp.getBehaviour('Controller')m = vcMatrix.new()m.translateAbs(800, 0, 800)m.setWPR(0, 180, 0)motionTarget = controller.createTarget()motionTarget.TargetMode = VC_MOTIONTARGET_TM_NORMALmotionTarget.BaseName = "BASE_1"motionTarget.ToolName = "Tool_TCP"motionTarget.MotionType = VC_MOTIONTARGET_MT_LINEARmotionTarget.RobotConfig = 0motionTarget.Target = mcontroller.moveTo(motionTarget)
-k1+10/09/2019 at 11:42 #16909
I understand that.
Thank you for the detailed example.0
You must be logged in to reply to this topic.