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?
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 inprimitive_poses
. Is this enough information or do you need a more detailed explanation?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
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 angletheta
, 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
andps.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 methodaddSolidPrimitive
actually informsmove_group
's planning scene about the object, meaning that you already know how to use ...(more)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.
I hope my comment did not sound "offending": since you posted a class method that was calling another method for which code was not provided, I assumed the problem was not about adding the object but just about properly setting its orientation. Could you please edit your question by adding a slim version of your class code? In particular, the class definition (just to know whether you are inheriting from another class), the constructor and the method
addSolidPrimitive
. In this way it will be easier to understand what additional information you need. Meanwhile, I can point you to the relevant section from the MoveIt tutorial (kinetic) - you likely read it already, but I believe it is worth mentioning it anyway!Not at all offending. Sir, Its pleasure to have people like you who are giving guidance. Thank a lot I will try to implement as per your suggestion.