Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Post processor with more detailed information

#1
Hi guys, a robot moves in a simple rectangle path in the videos. To generate the Robot program, I choose a postprocessor. The result shows a few lines describing the path, as shown in the video. However, In the simulation, as I drag the slider in the bottom. There are 2260 small steps to compose the whole path. Is it possible to get the information of these small steps by editing or choosing an appropriate postprocessor?
I really really appreciate the help from you guys. :)


Attached Files
.mp4   RoboDK_Example.mp4 (Size: 11.4 MB / Downloads: 182)
#2
You can use the InstructionListJoints function provided by RoboDK Python API:
https://robodk.com/doc/en/PythonAPI/robo...ListJoints
#3
That's really helpful, thanks a lot for the information.
#4
Hi Sergei, I tried the function INSTRUCTIONLISTJOINTS and got the information of J1 - J6, X_TCP, Y_TCP, and Z_TCP. Is it possible to save R_TCP, P_TCP, and W_TCP as well by using this or another function? Thanks for your time and patience.
#5
The InstructionListJoints function can export the XYZ of the TCP but not the orientation angles. However, you can calculate the full pose (position and orientation) by going over each set of joints and using SolveFK to calculate the forward kinematics.

Example:
Code:
TimeBasedFast = 5     # Make the calculation time-based (adds a time stamp added to the previous options)
output_flag = TimeBasedFast
time_step = 0.012 # time step in seconds for time based calculation

error_msg, joint_list, error_code = self.progitem.InstructionListJoints(1, 1, None, COLLISION_OFF, output_flag, time_step)
filedata = []
time_stamp = 0
for jnts in joint_list:               
    step_sec = jnts[nDOFs+4]
    time_stamp += step_sec
    joint_values = jnts[nDOFs]
    xyzabc = Pose_2_KUKA(robot.SolveFK(joint_values, tool))
    line_data = [time_stamp] + joint_values + xyzabc
    line_str = [("%+.6f" % x) for x in line_data]               
    filedata.append(" ".join(line_str))
#6
(11-11-2024, 03:39 PM)GarrisonCao Wrote: Hi guys, a robot moves in a simple rectangle path in the videos. To generate the Robot program, I choose a postprocessor. The result shows a few lines describing the path, as shown in the video. However, In the simulation, as I drag the slider in the bottom. There are 2260 small steps to compose the whole path. Is it possible to get the information of these small steps by editing or choosing an appropriate postprocessor?
I really really appreciate the help from you guys. :)

(11-29-2024, 02:45 PM)Albert Wrote: The InstructionListJoints function can export the XYZ of the TCP but not the orientation angles. However, you can calculate the full pose (position and orientation) by going over each set of joints and using SolveFK to calculate the forward kinematics.

Example:
Code:
TimeBasedFast = 5     # Make the calculation time-based (adds a time stamp added to the previous options)
output_flag = TimeBasedFast
time_step = 0.012 # time step in seconds for time based calculation

error_msg, joint_list, error_code = self.progitem.InstructionListJoints(1, 1, None, COLLISION_OFF, output_flag, time_step)
filedata = []
time_stamp = 0
for jnts in joint_list:               
    step_sec = jnts[nDOFs+4]
    time_stamp += step_sec
    joint_values = jnts[nDOFs]
    xyzabc = Pose_2_KUKA(robot.SolveFK(joint_values, tool))
    line_data = [time_stamp] + joint_values + xyzabc
    line_str = [("%+.6f" % x) for x in line_data]               
    filedata.append(" ".join(line_str))

Got it, Albert, thanks very much for the information and example.
#7
(11-29-2024, 02:45 PM)Albert Wrote: The InstructionListJoints function can export the XYZ of the TCP but not the orientation angles. However, you can calculate the full pose (position and orientation) by going over each set of joints and using SolveFK to calculate the forward kinematics.

Example:
Code:
TimeBasedFast = 5     # Make the calculation time-based (adds a time stamp added to the previous options)
output_flag = TimeBasedFast
time_step = 0.012 # time step in seconds for time based calculation

error_msg, joint_list, error_code = self.progitem.InstructionListJoints(1, 1, None, COLLISION_OFF, output_flag, time_step)
filedata = []
time_stamp = 0
for jnts in joint_list:               
    step_sec = jnts[nDOFs+4]
    time_stamp += step_sec
    joint_values = jnts[nDOFs]
    xyzabc = Pose_2_KUKA(robot.SolveFK(joint_values, tool))
    line_data = [time_stamp] + joint_values + xyzabc
    line_str = [("%+.6f" % x) for x in line_data]               
    filedata.append(" ".join(line_str))
Hello Albert, I used the function InstructionListJoints to and calculated the TCPs. However, as I changed the length of mm_step and deg_step, the output was always the same, only if I changed the time_step. Here are my code. As we modify the length of mm_step and deg_step, should the output changes as well or not? 
Thanks very much for your time and patience.

Code:
from robolink import *  # RoboDK API
from robodk import *    # RoboDK Matrices
import os
TimeBasedFast = 5     # Make the calculation time-based (adds a time stamp added to the previous options)
output_flag = TimeBasedFast
Save_Path = r"C:\Users\garrison\Desktop\DetailedPathTCPTest_T1_Step10.txt"
RDK = Robolink()
prog = RDK.ItemUserPick('Select a Program', ITEM_TYPE_PROGRAM)
robot = prog.getLink(ITEM_TYPE_ROBOT)
joints_matrix = robot.Joints()
error_msg, joint_list, error_code = prog.InstructionListJoints(mm_step = 10, deg_step = 10,
                                                               save_to_file = None,
                                                               flags =output_flag, time_step = 1)
filedata = []
# calculate TCP
jointsJ1toJ6 = [row[0:6] for row in joint_list]
Row_jointsJ1toJ6 = len(jointsJ1toJ6)
for Row_jointsJ1toJ6 in jointsJ1toJ6:
    xyzabc = Pose_2_KUKA(robot.SolveFK(Row_jointsJ1toJ6))
    filedata.append(xyzabc)
# save file   
with open(Save_Path,mode='w',encoding='utf-8') as file:
    for RowToOutput in filedata:
        rounded_data = ["{:.3f}".format(x) for x in RowToOutput]
        file.write(" ".join(rounded_data) + "\n")
#8
Yes, you can set the output of the InstructionListJoints function to split the position by a fixed step in mm (position) by setting the output flag to Position.

Example:
Code:
Position= 1
Speed= 2
SpeedAndAcceleration= 3
TimeBased= 4
TimeBasedFast= 5
output_flag = Position
You can find more information here:
https://robodk.com/doc/en/PythonAPI/robo...ointsFlags
#9
Hi Albert, thanks for your great help again.
#10
Thank you for your feedback.
  




Users browsing this thread:
1 Guest(s)