Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get a pose According to an user frame
Hi everyone , i'm trying to get the actual pose of my robot  according to a frame selected by the user. 
I need this , because i'm comparing the actual pose with a target which has been defined according to an user frame.

My problem is , when i got the actual pose of my robot , it's got it  according to the  robot base .

(Ps : everything is made as online programming )

1: The user pick a frame , and i use SetPoseFrame() for changing the reference frame ( doesn't seem to work)

# user picck a frame
FRAME = RDK.ItemUserPick('Select a reference frame', ITEM_TYPE_FRAME)

2: I ask for the joint and i solve the forward kinematic , then i have the actual pose of my robot and i find the xyz coordinate 

##----------------robot position --------------##
robot_joints = ROBOT.Joints()
robot_position = ROBOT.SolveFK(robot_joints)
3: i get the pose of the target selected by the user 
##--------------------collision target-----------##
targetCollide =RDK.ItemUserPick('Select a collide target', ITEM_TYPE_TARGET)
poseCollide= targetCollide.Pose()

when i compare  by example the both x coordinate , for the target x cordinate i got it according to the frame choosen by the user  concerning the actual x position it's according to the robot base. 
I would like to know if there is an elegant way to get the robot position according to an user frame ?

I finally figured it ou , i used this instead :

# user picck a frame 
FRAME = RDK.ItemUserPick('Select a reference frame', ITEM_TYPE_FRAME)

robot_joints = ROBOT.Joints()
#robot_position = ROBOT.SolveFK(robot_joints)
I don't think the solution you provided is correct. You should pre/post multiply poses to properly calculate a pose with respect to a reference frame and a specific tool.

If you have a tool and a reference and you want to calculate the pose of given robot joints you should do this:

robot = RDK.ItemUserPick("Select a robot", ITEM_TYPE_ROBOT)
tool = robot.getLink(ITEM_TYPE_TOOL) # Get the active tool item
reference = robot.getLink(ITEM_TYPE_FRAME) # Get the active reference of the robot
tool_pose = robot.PoseTool() # pose of the active tool (with respect to the robot flange)
reference_pose = robot.PoseFrame() # pose of the active robot reference (with respect to the robot base)

# Calculate the relative target given joint values:
joints = [10,20,30,40,50,60]
pose_robot = robot.SolveFK(joints) # pose of the robot flange with respect to the robot base

# Calculate the pose of the TCP with respect to the reference frame:
pose_target = reference_pose.inv() * pose_robot * tool_pose

More information here to better understand the relationship:

Users browsing this thread:
1 Guest(s)