10-13-2020, 11:52 AM (This post was last modified: 10-13-2020, 11:55 AM by michael.lang.)
I’m trying to create a quite simple point follow project with a Kuka robot. So the point following works fine, but I want to rotate the end-effector around the z axis (joint angle 6) for all data points about a changing value (-10° to +10°). How can I accomplish that? As far as I understood I can only add the orientation to the kinematic data but not any rotation. I attached the rdk-file for information.
20201013simulationKuka.rdk (Size: 340.49 KB / Downloads: 484)
In your Point Follow Project, there's a "Program events" option.
On the right column, you have the "on action" check-box and the text box related to it.
This will add an action to each point of the point follow project.
You can then use a subroutine to simply rotate Joint 6 +-10 degrees.
In your Point Follow Project, there's a "Program events" option.
On the right column, you have the "on action" check-box and the text box related to it.
This will add an action to each point of the point follow project.
You can then use a subroutine to simply rotate Joint 6 +-10 degrees.
Jeremy
Thanks for your fast reply! So I think that works basically, but then the rotation would just happen after every single movement and not like a combined movement. Even though I don't want to enter the values manually. So I was playing around a bit and adapted the 'Csv File To Program' Python script trying to do the same thing but here I got the issue that its not doing the roation even though Python doesn't give any error. Maybe you could also have a look into that and tell me what I'm doing wrong. I suspect these lines to not work as I want:
robotJoints[5][0] = rotationTool # manipulate the joint angle 6 to the desired rotation
robot.setJoints(robotJoints) # set the robot joint angle 6 to the rotation value
Or could it be a solution to add the rotation of the joint angle 6 to the general movement in this line:
program.MoveL(pi)
How would I do that though? Your help is greatly appreciated!
In your Point Follow Project, there's a "Program events" option.
On the right column, you have the "on action" check-box and the text box related to it.
This will add an action to each point of the point follow project.
You can then use a subroutine to simply rotate Joint 6 +-10 degrees.
Jeremy
Thanks for your fast reply! So I think that works basically, but then the rotation would just happen after every single movement and not like a combined movement. Even though I don't want to enter the values manually. So I was playing around a bit and adapted the 'Csv File To Program' Python script trying to do the same thing but here I got the issue that its not doing the roation even though Python doesn't give any error. Maybe you could also have a look into that and tell me what I'm doing wrong. I suspect these lines to not work as I want:
robotJoints[5][0] = rotationTool # manipulate the joint angle 6 to the desired rotation
robot.setJoints(robotJoints) # set the robot joint angle 6 to the rotation value
Or could it be a solution to add the rotation of the joint angle 6 to the general movement in this line:
program.MoveL(pi)
How would I do that though? Your help is greatly appreciated!
Another problem I encountered:
-If I'm using python the 6 robot joint angles stay the same for all 120 points in the csv-file when generating the robot program with the csv-post-processor. If I add the points and the point follow project manually I get the correct joint angles in my csv...
In your Point Follow Project, there's a "Program events" option.
On the right column, you have the "on action" check-box and the text box related to it.
This will add an action to each point of the point follow project.
You can then use a subroutine to simply rotate Joint 6 +-10 degrees.
Jeremy
Thanks for your fast reply! So I think that works basically, but then the rotation would just happen after every single movement and not like a combined movement. Even though I don't want to enter the values manually. So I was playing around a bit and adapted the 'Csv File To Program' Python script trying to do the same thing but here I got the issue that its not doing the roation even though Python doesn't give any error. Maybe you could also have a look into that and tell me what I'm doing wrong. I suspect these lines to not work as I want:
robotJoints[5][0] = rotationTool # manipulate the joint angle 6 to the desired rotation
robot.setJoints(robotJoints) # set the robot joint angle 6 to the rotation value
Or could it be a solution to add the rotation of the joint angle 6 to the general movement in this line:
program.MoveL(pi)
How would I do that though? Your help is greatly appreciated!
Another problem I encountered:
-If I'm using python the 6 robot joint angles stay the same for all 120 points in the csv-file when generating the robot program with the csv-post-processor. If I add the points and the point follow project manually I get the correct joint angles in my csv...
I guess the problem with getting the same angles for all points while using the Python script is that the robot joints remain the same when checking the joint move (data_downsampled-3 was added with Python script, Target 122 manually, see the Robot joints). Why is this happening and how can I fix it? Thanks!
Here are a few suggestions to improve your code and workflow:
1. One important detail is that you are updating the joint values for a cartesian target. Cartesian targets prioritize the Cartesian data. Updating the joint values won't change the target but may change the configuration flags. Therefore, if you want to define a rotation for a target you could better do something like this:
Code:
target.setPose(p_i * rotz(rotate_deg*pi/180))
2. I recommend you to link each target to your robot. This way, when you update the pose of the target, the joint values are updated accordingly (using the active tool and active reference, you can update the active tool and references using setPoseFrame and setPoseTool on a robot respectively).
Code:
target = RDK.AddTarget('T%i' % i, frame, robot)
# target.setAsCartesianTarget() # This is the default behavior, not needed
target.setPose(pose_i) # this recalculates the robot joints if it is a Cartesian target
joints = target.Joints().list() # get the robot joints for the last pose provided
3. You can convert the Mat joints object returned by the Joints function to a list by calling list(). Example:
Code:
robotJoints = robot.Joints().list() # get current robot joint angles as a list of float
robotJoints[5] = rotationTool # set the joint 6
robot.setJoints(robotJoints) # set the robot joint angle 6 to the rotation value
4. You could automatically recalculate all joint targets by calling:
Code:
program.setParam("RecalculateTargets")
This is useful if you change the coordinate system or the tool of a program and you want to access updated joint values later.
You could also use InstructionListJoints function to obtain a full detailed list of the robot path in the joint space.
5. The variable pi is used by RoboDK to set the pi number (math.pi) and it may lead to confusion I updated it ito p_i.
I made some minor edits to the sample file you provided to reflect some of these suggestions, I have not tested it.
10-22-2020, 10:48 AM (This post was last modified: 10-22-2020, 11:44 AM by michael.lang.)
Thank you Albert for this detailed answer, this helped me a lot and actually now everything seems to work fine :)
Just one little thing that confuses me:
Whenever I use MoveL(inear) the csv-postprocessor gives me the cartesian and joint data. When I use MoveJ(oint) it gives only the joint angle data. For my current application I need the joint angles to feed the robot. What is "better" for my application, is there something wrong if I change from one to the other? The joint angles are exactly the same.
This is the default behavior of RoboDK.
Joints for MoveJ
Joints + Cartesian for MoveL.
You can change that behavior in "Tools"->"Options"->"Programs"
"Output for joint movements"
"Output for linear movements"
There is no "better solution". Both should give you the same result. But we generally recommend keeping the default values if you don't have a specific reason to do otherwise.
10-23-2020, 07:26 AM (This post was last modified: 10-23-2020, 07:26 AM by michael.lang.)
(10-22-2020, 05:29 PM)Jeremy Wrote: Hi Micheal,
This is the default behavior of RoboDK.
Joints for MoveJ
Joints + Cartesian for MoveL.
You can change that behavior in "Tools"->"Options"->"Programs"
"Output for joint movements"
"Output for linear movements"
There is no "better solution". Both should give you the same result. But we generally recommend keeping the default values if you don't have a specific reason to do otherwise.
Jeremy
Hi Jeremy,
okay good to know, thank you for the clarification!