siemens / ros-sharp

ROS# is a set of open source software libraries and tools in C# for communicating with ROS from .NET applications, in particular Unity3D
Apache License 2.0
961 stars 365 forks source link

rotation frame #390

Closed jocacace closed 3 years ago

jocacace commented 3 years ago

Hi guys,

I am not able to understand the rotation frame of an object. In particular, when I use the Pose subscriber I specify the object transform in the script parameter. However, it seems that the object rotates in the world frame and not in the body frame. Differently, using the twist script, velocity data are applied in the body frame. Can someone clarify this point?

Regards,

MartinBischoff commented 3 years ago

Hi @jocacace ,

all your statements above are correct. Clarification:

Twist specifies linear and angular velocities of an object. Pose specifies the position and orientation of an object.

In the scripts TwistSubscriber and TwistPublisher, twist is read / written in local frame. In the scripts PoseStampedSubscriber and PoseStampedPublisher pose is read / written in global frame.

We wrote those scripts this way a long time ago since we found this convention most reasonable and practical in our projects. I don't remember if I found a ROS reference specifying this convention or it just fit best to the robots we worked with.

Feel free to change these scripts - as well as all other ROS# scripts - to your liking! Unity Transform has many methods to quickly set or convert points, directions and vectors in/to local and gobal space and back.

If you find an official ROS statement that defines in which frame Twist and Pose should generally be specified, to which contradicts our convention above, please do share this info or send a pull request with the corrections.

Best regards!