Open EdvardGrodem opened 3 years ago
From what I can tell form the code the conversion is implemented, but not used by the transform publisher. https://github.com/fsstudio-team/ZeroSimROSUnity/blob/ead163a96296c3b3dbd83315e050941c259b3892/Runtime/Scripts/ROS/MessageTypes/Geometry/ZOROSGeometryMessages.cs#L36-L67
So I tried this out by creating a simple scene with a TF Publisher with coordinates (1, 2, 3) and looked at the result in RViz and the TF position is (3, -1, 2) as expected. See attached images.
We have run ROS gmapper successfully. What SLAM system are you using?
@EdvardGrodem are you still having issues? Found a major issue with converting Unity Quaternion to ROS. v0.1.14 should fix that.
FYI: Specifically the issue was that roll and pitch were swapped and yaw was fine. Because yaw was fine we never noticed it because all the mobile robot we worked with roll and pitch didn't matter only yaw.
Hi, we are still struggeling with running SLAM, however I do not think it's due to the left handed coordinate system anymore. I think the initial confusion was due to the cameras not having the z-axis pointing into the image as is common convention. We found the settings for correcting this.
@EdvardGrodem can you elaborate on the camera coordinate system and how it was fixed? Is there a patch or pull request that you can provide?
Hi, sorry for not coming back to this sooner. In ZOROSRBGDepthPublisher we used the Camera Rotation Degrees to align the camera with our preferred coordinate system.
On this note, I am struggling to understand the vector conversion. I am expecting
FromUnityVector(ToUnityVector3([0.1, 0.2, 0.3])) == [0.1, 0.2, 0.3]
but it does not seem to be true
Is this method correct? It looks to me that this is wrong.
/// ROS Coordinate System (See: https://www.ros.org/reps/rep-0103.html)
/// x forward
/// y left
/// z up
///
/// Unity Coordinate System:
/// x right
/// y up
/// z forward
public UnityEngine.Vector3 ToUnityVector3() {
return new UnityEngine.Vector3((float)-this.x, (float)this.z, (float)this.y);
}
Using your comment on the coordinate system, shouldn't the method be rather as below? Am I missing something?
public UnityEngine.Vector3 ToUnityVector3() {
return new UnityEngine.Vector3((float)-this.y, (float)this.z, (float)this.x);
}
Hi, after trying to run SLAM from the simulator we have some trouble with the coordinate frames from Unity. I know Unity uses a left handed coordinate system. Does ZeroSim account for this when publishing transforms?