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

Change user point of view via python api


i am trying to change the point of view for the user via the python api. I want to create custom camera position like Top, Front, Left view.
Is that possible?

If not, is it possible to that with simulated cameras instead?
By displaying the simulated cameras to a custom tkinter gui?
To set the world reference frame with respect to the view in the GUI you can use setViewPose(). For example:
RDK.setViewPose(robomath.xyzrpw_2_pose([0,0,-10000,0,0,-90])) # Top view.
RDK.setViewPose(robomath.xyzrpw_2_pose([0,0,-10000,0,-90,-90])) # Front view.
RDK.setViewPose(robomath.xyzrpw_2_pose([0,0,-10000,90,0,180])) # Right view.
I double click a Python program with these lines to quickly get to the nearest cubic view:
from robodk import robolink    # RoboDK API
from robodk import robomath    # Robot toolbox
RDK = robolink.Robolink()

pose = RDK.ViewPose() # Get current view pose.
pose_xyzrpw = robomath.pose_2_xyzrpw(pose) # Convert pose format.
pose_xyzrpw_cubic = pose_xyzrpw [0:3] + [round(ang/90, 0)*90 for ang in pose_xyzrpw [3:]] # Round pose to nearest cubic view.
RDK.setViewPose(robomath.xyzrpw_2_pose(pose_xyzrpw_cubic)) # Set cubic view pose.
To set the view of a camera, place it in a reference frame, and adjust the orientation of that frame using setPoseFrame(). With respect to the camera image, the frame's X-axis is to the right, the Y-axis is down, and the Z-axis is into the image plane.

Kind regards,

Ah thank you Maarten.
This solved my question

Users browsing this thread:
1 Guest(s)