Hi!
In my plugin i am trying to move the a robot (Kassow), by changing it’s position matrix. And after every move i want to check if the robot reaches all of the points in the routine.
Now when i try to get the joint angles using InternalJointValues it always returns the joint values from the original position.
Is there a way i can manually trigger the inverse kinematic solver, or an other way to achieve my goals?
Here is relevant part of the code, i’ve been doing:
def MoveComponentRel(component, x=0, y=0, z=0): # vcComponent, float, float, float
vec = vcVector.new(component.PositionMatrix.P.X+x, component.PositionMatrix.P.Y+y, component.PositionMatrix.P.Z+z)
m = component.PositionMatrix
m.P = vec
component.PositionMatrix = m
app.render()
simu.update()
robot #vcComponent from different part of the code
robot_obj = getRobot(robot)
MoveComponentRel(robot, step_x, 0, step_z)
for statement in robot_obj.Program.MainRoutine.Statements:
if statement.Type != VC_STATEMENT_LINMOTION and statement.Type != VC_STATEMENT_PTPMOTION: break
for point in statement.Positions:
for i, joint in enumerate(robot_obj.Joints):
JOINTS_VALUES_POINT[joint.Name] = point.InternalJointValues[i]
print(point.Name, joint.Name, point.InternalJointValues[i])
if point.InternalJointValues[i] < int(joint.MinValue) or int.InternalJointValues[i] > int(joint.MaxValue):
outofreach += 1
Tom