# Is it possible to tilt or give some orientation to the objects in planning scene?

Hi,

I am trying to add objects like sphere, cylinder, cube to my planning scene I want to tilt the object by some angle. How to do it using python?

edit retag close merge delete

When you fill the collision object message, you specify the geometry using the field primitives, which you can translate/rotate individually by specifying a corresponding pose in primitive_poses. Is this enough information or do you need a more detailed explanation?

( 2019-09-28 01:00:29 -0500 )edit

Thanks for responding.

This is my code for adding objects to planning scene. I would be really grateful if you could guide me how to implement the primitive poses in my code.

Thanks a lot

def addBox(self, name, size_x, size_y, size_z, x, y, z, use_service=True):
s = SolidPrimitive()
s.dimensions = [size_x, size_y, size_z]
s.type = s.BOX

ps = PoseStamped()
ps.pose.position.x = x
ps.pose.position.y = y
ps.pose.position.z = z
ps.pose.orientation.w = 1.0

( 2019-09-28 03:15:26 -0500 )edit
1

You're almost there: just change the orientation part and you're good to go! Keep in mind that orientation uses unit quaternions. Given a unit axis of rotation u=[ux,uy,uz] and an angle theta, the quaternion [w,x,y,z] is defined as [cos(theta/2), ux*sin(theta/2), uy*sin(theta/2), uz*sin(theta/2)]. As an example, if you want the box to be rotated around the x-axis of -90 degrees, the w and x components would be 1/√2 and -1/√2 respectively, ie, ps.pose.orientation.w=0.5**0.5 and ps.pose.orientation.x=-0.5**0.5. You can easily find more info about unit quaternions online if you wish! As a side note: I assume that your class method addSolidPrimitive actually informs move_group's planning scene about the object, meaning that you already know how to use ...(more)

( 2019-10-01 03:00:48 -0500 )edit

Sir, Thanks for explaining in depth. No, I am not well versed with the planning scene interface otherwise why would I ask such question. I am still learning.

( 2019-10-01 03:19:51 -0500 )edit