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?
Asked by Adwait_Naik on 2019-09-27 23:19:42 UTC
Comments
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?Asked by ffusco on 2019-09-28 01:00:29 UTC
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
Asked by Adwait_Naik on 2019-09-28 03:15:26 UTC
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 the planning scene interface. Is it so?Asked by ffusco on 2019-10-01 03:00:48 UTC
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.
Asked by Adwait_Naik on 2019-10-01 03:19:51 UTC
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!Asked by ffusco on 2019-10-01 03:48:27 UTC
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.
Asked by Adwait_Naik on 2019-10-01 03:51:38 UTC